OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
3 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 3 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 28 matching lines...) Expand all Loading... |
39 namespace WebCore { | 39 namespace WebCore { |
40 | 40 |
41 class Frame; | 41 class Frame; |
42 class HistoryItem; | 42 class HistoryItem; |
43 class SerializedScriptValue; | 43 class SerializedScriptValue; |
44 class StringWithDirection; | 44 class StringWithDirection; |
45 | 45 |
46 class HistoryController { | 46 class HistoryController { |
47 WTF_MAKE_NONCOPYABLE(HistoryController); | 47 WTF_MAKE_NONCOPYABLE(HistoryController); |
48 public: | 48 public: |
49 enum HistoryUpdateType { UpdateAll, UpdateAllExceptBackForwardList }; | |
50 | |
51 explicit HistoryController(Frame*); | 49 explicit HistoryController(Frame*); |
52 ~HistoryController(); | 50 ~HistoryController(); |
53 | 51 |
54 void saveScrollPositionAndViewStateToItem(HistoryItem*); | 52 void saveScrollPositionAndViewStateToItem(HistoryItem*); |
55 void clearScrollPositionAndViewState(); | 53 void clearScrollPositionAndViewState(); |
56 void restoreScrollPositionAndViewState(); | 54 void restoreScrollPositionAndViewState(); |
57 | 55 |
58 void updateBackForwardListForFragmentScroll(); | 56 void updateBackForwardListForFragmentScroll(); |
59 | 57 |
60 void saveDocumentState(); | 58 void saveDocumentState(); |
61 void saveDocumentAndScrollState(); | 59 void saveDocumentAndScrollState(); |
62 void restoreDocumentState(); | 60 void restoreDocumentState(); |
63 | 61 |
64 void updateForBackForwardNavigation(); | |
65 void updateForReload(); | |
66 void updateForStandardLoad(HistoryUpdateType updateType = UpdateAll); | |
67 void updateForRedirectWithLockedBackForwardList(); | |
68 void updateForClientRedirect(); | 62 void updateForClientRedirect(); |
69 void updateForCommit(); | 63 void updateForCommit(); |
70 void updateForSameDocumentNavigation(); | 64 void updateForSameDocumentNavigation(); |
71 void updateForFrameLoadCompleted(); | 65 void updateForFrameLoadCompleted(); |
72 | 66 |
73 HistoryItem* currentItem() const { return m_currentItem.get(); } | 67 HistoryItem* currentItem() const { return m_currentItem.get(); } |
74 void setCurrentItem(HistoryItem*); | 68 void setCurrentItem(HistoryItem*); |
75 void setCurrentItemTitle(const StringWithDirection&); | 69 void setCurrentItemTitle(const StringWithDirection&); |
76 bool currentItemShouldBeReplaced() const; | 70 bool currentItemShouldBeReplaced() const; |
77 | 71 |
78 HistoryItem* previousItem() const { return m_previousItem.get(); } | 72 HistoryItem* previousItem() const { return m_previousItem.get(); } |
79 | 73 |
80 HistoryItem* provisionalItem() const { return m_provisionalItem.get(); } | 74 HistoryItem* provisionalItem() const { return m_provisionalItem.get(); } |
81 void setProvisionalItem(HistoryItem*); | 75 void setProvisionalItem(HistoryItem*); |
82 | 76 |
83 void pushState(PassRefPtr<SerializedScriptValue>, const String& title, const
String& url); | 77 void pushState(PassRefPtr<SerializedScriptValue>, const String& title, const
String& url); |
84 void replaceState(PassRefPtr<SerializedScriptValue>, const String& title, co
nst String& url); | 78 void replaceState(PassRefPtr<SerializedScriptValue>, const String& title, co
nst String& url); |
85 | 79 |
86 void setDefersLoading(bool); | 80 void setDefersLoading(bool); |
87 | 81 |
88 private: | 82 private: |
89 friend class Page; | 83 friend class Page; |
90 bool shouldStopLoadingForHistoryItem(HistoryItem*) const; | 84 bool shouldStopLoadingForHistoryItem(HistoryItem*) const; |
91 void goToItem(HistoryItem*, FrameLoadType); | 85 void goToItem(HistoryItem*, FrameLoadType); |
92 | 86 |
93 void initializeItem(HistoryItem*); | 87 void initializeItem(HistoryItem*); |
94 PassRefPtr<HistoryItem> createItem(); | 88 PassRefPtr<HistoryItem> createItem(); |
95 PassRefPtr<HistoryItem> createItemTree(Frame* targetFrame, bool clipAtTarget
); | 89 PassRefPtr<HistoryItem> createItemTree(Frame* targetFrame, bool clipAtTarget
); |
96 | 90 |
| 91 void updateForBackForwardNavigation(); |
| 92 void updateForReload(); |
| 93 void updateForStandardLoad(); |
| 94 void updateForRedirectWithLockedBackForwardList(); |
| 95 |
97 void recursiveSetProvisionalItem(HistoryItem*, HistoryItem*, FrameLoadType); | 96 void recursiveSetProvisionalItem(HistoryItem*, HistoryItem*, FrameLoadType); |
98 void recursiveGoToItem(HistoryItem*, HistoryItem*, FrameLoadType); | 97 void recursiveGoToItem(HistoryItem*, HistoryItem*, FrameLoadType); |
99 bool isReplaceLoadTypeWithProvisionalItem(FrameLoadType); | 98 bool isReplaceLoadTypeWithProvisionalItem(FrameLoadType); |
100 bool isReloadTypeWithProvisionalItem(FrameLoadType); | 99 bool isReloadTypeWithProvisionalItem(FrameLoadType); |
101 void recursiveUpdateForCommit(); | 100 void recursiveUpdateForCommit(); |
102 void recursiveUpdateForSameDocumentNavigation(); | 101 void recursiveUpdateForSameDocumentNavigation(); |
103 bool itemsAreClones(HistoryItem*, HistoryItem*) const; | 102 bool itemsAreClones(HistoryItem*, HistoryItem*) const; |
104 bool currentFramesMatchItem(HistoryItem*) const; | 103 bool currentFramesMatchItem(HistoryItem*) const; |
105 void updateBackForwardListClippedAtTarget(bool doClip); | 104 void updateBackForwardListClippedAtTarget(bool doClip); |
106 void updateCurrentItem(); | 105 void updateCurrentItem(); |
107 | 106 |
108 Frame* m_frame; | 107 Frame* m_frame; |
109 | 108 |
110 RefPtr<HistoryItem> m_currentItem; | 109 RefPtr<HistoryItem> m_currentItem; |
111 RefPtr<HistoryItem> m_previousItem; | 110 RefPtr<HistoryItem> m_previousItem; |
112 RefPtr<HistoryItem> m_provisionalItem; | 111 RefPtr<HistoryItem> m_provisionalItem; |
113 | 112 |
114 bool m_frameLoadComplete; | 113 bool m_frameLoadComplete; |
115 | 114 |
116 bool m_defersLoading; | 115 bool m_defersLoading; |
117 RefPtr<HistoryItem> m_deferredItem; | 116 RefPtr<HistoryItem> m_deferredItem; |
118 FrameLoadType m_deferredFrameLoadType; | 117 FrameLoadType m_deferredFrameLoadType; |
119 }; | 118 }; |
120 | 119 |
121 } // namespace WebCore | 120 } // namespace WebCore |
122 | 121 |
123 #endif // HistoryController_h | 122 #endif // HistoryController_h |
OLD | NEW |