OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /* | 5 /* |
6 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. | 6 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. |
7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. | 7 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. |
8 * (http://www.torchmobile.com/) | 8 * (http://www.torchmobile.com/) |
9 * | 9 * |
10 * Redistribution and use in source and binary forms, with or without | 10 * Redistribution and use in source and binary forms, with or without |
(...skipping 17 matching lines...) Expand all Loading... |
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND | 29 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 30 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF | 31 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 32 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
33 */ | 33 */ |
34 | 34 |
35 #ifndef CONTENT_RENDERER_HISTORY_CONTROLLER_H_ | 35 #ifndef CONTENT_RENDERER_HISTORY_CONTROLLER_H_ |
36 #define CONTENT_RENDERER_HISTORY_CONTROLLER_H_ | 36 #define CONTENT_RENDERER_HISTORY_CONTROLLER_H_ |
37 | 37 |
| 38 #include <memory> |
38 #include <utility> | 39 #include <utility> |
39 | 40 |
40 #include "base/containers/hash_tables.h" | 41 #include "base/containers/hash_tables.h" |
41 #include "base/macros.h" | 42 #include "base/macros.h" |
42 #include "base/memory/scoped_ptr.h" | |
43 #include "content/common/content_export.h" | 43 #include "content/common/content_export.h" |
44 #include "content/renderer/history_entry.h" | 44 #include "content/renderer/history_entry.h" |
45 #include "third_party/WebKit/public/web/WebHistoryCommitType.h" | 45 #include "third_party/WebKit/public/web/WebHistoryCommitType.h" |
46 #include "third_party/WebKit/public/web/WebHistoryItem.h" | 46 #include "third_party/WebKit/public/web/WebHistoryItem.h" |
47 | 47 |
48 namespace blink { | 48 namespace blink { |
49 class WebFrame; | 49 class WebFrame; |
50 class WebLocalFrame; | 50 class WebLocalFrame; |
51 enum class WebCachePolicy; | 51 enum class WebCachePolicy; |
52 } | 52 } |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 // HistoryNode 2_0 (WebHistoryItem C (url: bar.com)) *REUSED* | 106 // HistoryNode 2_0 (WebHistoryItem C (url: bar.com)) *REUSED* |
107 // HistoryNode 2_1: (WebHistoryItem G (url: bar.com/e)) | 107 // HistoryNode 2_1: (WebHistoryItem G (url: bar.com/e)) |
108 // HistoryNode 2_3: (WebHistoryItem H (url: bar.com/f)) | 108 // HistoryNode 2_3: (WebHistoryItem H (url: bar.com/f)) |
109 // HistoryNode 2_2: (WebHistoryItem E (url: bar.com/c)) *REUSED* | 109 // HistoryNode 2_2: (WebHistoryItem E (url: bar.com/c)) *REUSED* |
110 // | 110 // |
111 class CONTENT_EXPORT HistoryController { | 111 class CONTENT_EXPORT HistoryController { |
112 public: | 112 public: |
113 explicit HistoryController(RenderViewImpl* render_view); | 113 explicit HistoryController(RenderViewImpl* render_view); |
114 ~HistoryController(); | 114 ~HistoryController(); |
115 | 115 |
116 void set_provisional_entry(scoped_ptr<HistoryEntry> entry) { | 116 void set_provisional_entry(std::unique_ptr<HistoryEntry> entry) { |
117 provisional_entry_ = std::move(entry); | 117 provisional_entry_ = std::move(entry); |
118 } | 118 } |
119 | 119 |
120 // Return true if the main frame ended up loading a request as part of the | 120 // Return true if the main frame ended up loading a request as part of the |
121 // history navigation. | 121 // history navigation. |
122 bool GoToEntry(blink::WebLocalFrame* main_frame, | 122 bool GoToEntry(blink::WebLocalFrame* main_frame, |
123 scoped_ptr<HistoryEntry> entry, | 123 std::unique_ptr<HistoryEntry> entry, |
124 scoped_ptr<NavigationParams> navigation_params, | 124 std::unique_ptr<NavigationParams> navigation_params, |
125 blink::WebCachePolicy cache_policy); | 125 blink::WebCachePolicy cache_policy); |
126 | 126 |
127 void UpdateForCommit(RenderFrameImpl* frame, | 127 void UpdateForCommit(RenderFrameImpl* frame, |
128 const blink::WebHistoryItem& item, | 128 const blink::WebHistoryItem& item, |
129 blink::WebHistoryCommitType commit_type, | 129 blink::WebHistoryCommitType commit_type, |
130 bool navigation_within_page); | 130 bool navigation_within_page); |
131 | 131 |
132 HistoryEntry* GetCurrentEntry(); | 132 HistoryEntry* GetCurrentEntry(); |
133 blink::WebHistoryItem GetItemForNewChildFrame(RenderFrameImpl* frame) const; | 133 blink::WebHistoryItem GetItemForNewChildFrame(RenderFrameImpl* frame) const; |
134 void RemoveChildrenForRedirect(RenderFrameImpl* frame); | 134 void RemoveChildrenForRedirect(RenderFrameImpl* frame); |
135 | 135 |
136 private: | 136 private: |
137 typedef std::vector<std::pair<blink::WebFrame*, blink::WebHistoryItem> > | 137 typedef std::vector<std::pair<blink::WebFrame*, blink::WebHistoryItem> > |
138 HistoryFrameLoadVector; | 138 HistoryFrameLoadVector; |
139 void RecursiveGoToEntry(blink::WebFrame* frame, | 139 void RecursiveGoToEntry(blink::WebFrame* frame, |
140 HistoryFrameLoadVector& sameDocumentLoads, | 140 HistoryFrameLoadVector& sameDocumentLoads, |
141 HistoryFrameLoadVector& differentDocumentLoads); | 141 HistoryFrameLoadVector& differentDocumentLoads); |
142 | 142 |
143 void UpdateForInitialLoadInChildFrame(RenderFrameImpl* frame, | 143 void UpdateForInitialLoadInChildFrame(RenderFrameImpl* frame, |
144 const blink::WebHistoryItem& item); | 144 const blink::WebHistoryItem& item); |
145 void CreateNewBackForwardItem(RenderFrameImpl* frame, | 145 void CreateNewBackForwardItem(RenderFrameImpl* frame, |
146 const blink::WebHistoryItem& item, | 146 const blink::WebHistoryItem& item, |
147 bool clone_children_of_target); | 147 bool clone_children_of_target); |
148 | 148 |
149 RenderViewImpl* render_view_; | 149 RenderViewImpl* render_view_; |
150 | 150 |
151 // A HistoryEntry representing the currently-loaded page. | 151 // A HistoryEntry representing the currently-loaded page. |
152 scoped_ptr<HistoryEntry> current_entry_; | 152 std::unique_ptr<HistoryEntry> current_entry_; |
153 // A HistoryEntry representing the page that is being loaded, or an empty | 153 // A HistoryEntry representing the page that is being loaded, or an empty |
154 // scoped_ptr if no page is being loaded. | 154 // scoped_ptr if no page is being loaded. |
155 scoped_ptr<HistoryEntry> provisional_entry_; | 155 std::unique_ptr<HistoryEntry> provisional_entry_; |
156 // The NavigationParams corresponding to the last load that was initiated by | 156 // The NavigationParams corresponding to the last load that was initiated by |
157 // |GoToEntry|. This is kept around so that it can be passed into existing | 157 // |GoToEntry|. This is kept around so that it can be passed into existing |
158 // frames modified during a history navigation in GoToEntry(), and can be | 158 // frames modified during a history navigation in GoToEntry(), and can be |
159 // passed into frames created after the commit that resulted from the | 159 // passed into frames created after the commit that resulted from the |
160 // navigation in GetItemForNewChildFrame(). | 160 // navigation in GetItemForNewChildFrame(). |
161 scoped_ptr<NavigationParams> navigation_params_; | 161 std::unique_ptr<NavigationParams> navigation_params_; |
162 | 162 |
163 DISALLOW_COPY_AND_ASSIGN(HistoryController); | 163 DISALLOW_COPY_AND_ASSIGN(HistoryController); |
164 }; | 164 }; |
165 | 165 |
166 } // namespace content | 166 } // namespace content |
167 | 167 |
168 #endif // CONTENT_RENDERER_HISTORY_CONTROLLER_H_ | 168 #endif // CONTENT_RENDERER_HISTORY_CONTROLLER_H_ |
OLD | NEW |