webkit  2cdf99a9e3038c7e01b3c37e8ad903ecbe5eecf1
https://github.com/WebKit/webkit
BackForwardList.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2006, 2010 Apple Inc. All rights reserved.
3  * Copyright (C) 2008 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
4  * Copyright (C) 2009 Google, Inc. All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  * 1. Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  * 2. Redistributions in binary form must reproduce the above copyright
12  * notice, this list of conditions and the following disclaimer in the
13  * documentation and/or other materials provided with the distribution.
14  *
15  * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
16  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
18  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
19  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
23  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
25  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26  */
27 
28 #pragma once
29 
30 #include <WebCore/BackForwardClient.h>
31 #include <wtf/HashSet.h>
32 #include <wtf/Vector.h>
33 
34 typedef Vector<Ref<WebCore::HistoryItem>> HistoryItemVector;
35 typedef HashSet<RefPtr<WebCore::HistoryItem>> HistoryItemHashSet;
36 
38 public:
39  static Ref<BackForwardList> create() { return adoptRef(*new BackForwardList()); }
40  virtual ~BackForwardList();
41 
42  void addItem(Ref<WebCore::HistoryItem>&&) override;
43  void goBack();
44  void goForward();
45  void goToItem(WebCore::HistoryItem*) override;
46 
50  WebCore::HistoryItem* itemAtIndex(int) override;
51 
54 
55  int capacity();
56  void setCapacity(int);
57  bool enabled();
58  void setEnabled(bool);
59  int backListCount() override;
60  int forwardListCount() override;
62 
63  void close() override;
64  bool closed();
65 
68 
69 private:
70  explicit BackForwardList();
71 
72  HistoryItemVector m_entries;
73  HistoryItemHashSet m_entryHash;
74  unsigned m_current;
75  unsigned m_capacity;
76  bool m_closed;
77  bool m_enabled;
78 };
WebCore::HistoryItem * forwardItem()
Definition: BackForwardList.mm:123
bool containsItem(WebCore::HistoryItem &)
Definition: BackForwardList.mm:259
WebCore::HistoryItem * itemAtIndex(int) override
Definition: BackForwardList.mm:202
virtual ~BackForwardList()
Definition: BackForwardList.mm:45
Definition: BackForwardClient.h:37
int forwardListCount() override
Definition: BackForwardList.mm:197
void removeItem(WebCore::HistoryItem &)
Definition: BackForwardList.mm:239
bool enabled()
Definition: BackForwardList.mm:177
WebCore::HistoryItem * currentItem()
Definition: BackForwardList.mm:116
void backListWithLimit(int, Vector< Ref< WebCore::HistoryItem >> &)
Definition: BackForwardList.mm:130
const Vector< Ref< WebCore::HistoryItem > > & entries() const
Definition: BackForwardList.h:70
void setEnabled(bool)
Definition: BackForwardList.mm:182
static Ref< BackForwardList > create()
Definition: BackForwardList.h:39
Definition: HistoryItem.h:60
HashSet< RefPtr< WebCore::HistoryItem > > HistoryItemHashSet
Definition: BackForwardList.h:36
void close() override
Definition: BackForwardList.mm:226
bool closed()
Definition: BackForwardList.mm:234
void addItem(Ref< WebCore::HistoryItem > &&) override
Definition: BackForwardList.mm:50
int backListCount() override
Definition: BackForwardList.mm:192
void forwardListWithLimit(int, Vector< Ref< WebCore::HistoryItem >> &)
Definition: BackForwardList.mm:140
void goForward()
Definition: BackForwardList.mm:87
WebCore::HistoryItem * backItem()
Definition: BackForwardList.mm:109
void goToItem(WebCore::HistoryItem *) override
Definition: BackForwardList.mm:94
Vector< Ref< WebCore::HistoryItem > > HistoryItemVector
Definition: BackForwardList.h:34
void goBack()
Definition: BackForwardList.mm:80
int capacity()
Definition: BackForwardList.mm:156
Definition: BackForwardList.h:38
Ref< T > adoptRef(T &)
Definition: Ref.h:208
void setCapacity(int)
Definition: BackForwardList.mm:161