Chromium Code Reviews| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 42 #include "content/renderer/history_entry.h" | 42 #include "content/renderer/history_entry.h" |
| 43 #include "third_party/WebKit/public/platform/WebURLRequest.h" | 43 #include "third_party/WebKit/public/platform/WebURLRequest.h" |
| 44 #include "third_party/WebKit/public/web/WebHistoryCommitType.h" | 44 #include "third_party/WebKit/public/web/WebHistoryCommitType.h" |
| 45 #include "third_party/WebKit/public/web/WebHistoryItem.h" | 45 #include "third_party/WebKit/public/web/WebHistoryItem.h" |
| 46 | 46 |
| 47 namespace blink { | 47 namespace blink { |
| 48 class WebFrame; | 48 class WebFrame; |
| 49 } | 49 } |
| 50 | 50 |
| 51 namespace content { | 51 namespace content { |
| 52 struct NavigationParams; | |
|
Charlie Reis
2015/03/23 22:23:01
Style nit: Classes before structs.
Avi (use Gerrit)
2015/03/24 20:33:46
I've seen it both ways, and written it both ways,
| |
| 52 class RenderFrameImpl; | 53 class RenderFrameImpl; |
| 53 class RenderViewImpl; | 54 class RenderViewImpl; |
| 54 | 55 |
| 55 // A guide to history state in the renderer: | 56 // A guide to history state in the renderer: |
| 56 // | 57 // |
| 57 // HistoryController: Owned by RenderView, is the entry point for interacting | 58 // HistoryController: Owned by RenderView, is the entry point for interacting |
| 58 // with history. Handles most of the operations to modify history state, | 59 // with history. Handles most of the operations to modify history state, |
| 59 // navigate to an existing back/forward entry, etc. | 60 // navigate to an existing back/forward entry, etc. |
| 60 // | 61 // |
| 61 // HistoryEntry: Represents a single entry in the back/forward list, | 62 // HistoryEntry: Represents a single entry in the back/forward list, |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 103 // HistoryNode 2_1: (WebHistoryItem G (url: bar.com/e)) | 104 // HistoryNode 2_1: (WebHistoryItem G (url: bar.com/e)) |
| 104 // HistoryNode 2_3: (WebHistoryItem H (url: bar.com/f)) | 105 // HistoryNode 2_3: (WebHistoryItem H (url: bar.com/f)) |
| 105 // HistoryNode 2_2: (WebHistoryItem E (url: bar.com/c)) *REUSED* | 106 // HistoryNode 2_2: (WebHistoryItem E (url: bar.com/c)) *REUSED* |
| 106 // | 107 // |
| 107 class CONTENT_EXPORT HistoryController { | 108 class CONTENT_EXPORT HistoryController { |
| 108 public: | 109 public: |
| 109 explicit HistoryController(RenderViewImpl* render_view); | 110 explicit HistoryController(RenderViewImpl* render_view); |
| 110 ~HistoryController(); | 111 ~HistoryController(); |
| 111 | 112 |
| 112 void GoToEntry(scoped_ptr<HistoryEntry> entry, | 113 void GoToEntry(scoped_ptr<HistoryEntry> entry, |
| 114 scoped_ptr<NavigationParams> navigation_params, | |
| 113 blink::WebURLRequest::CachePolicy cache_policy); | 115 blink::WebURLRequest::CachePolicy cache_policy); |
| 114 | 116 |
| 115 void UpdateForCommit(RenderFrameImpl* frame, | 117 void UpdateForCommit(RenderFrameImpl* frame, |
| 116 const blink::WebHistoryItem& item, | 118 const blink::WebHistoryItem& item, |
| 117 blink::WebHistoryCommitType commit_type, | 119 blink::WebHistoryCommitType commit_type, |
| 118 bool navigation_within_page); | 120 bool navigation_within_page); |
| 119 | 121 |
| 120 HistoryEntry* GetCurrentEntry(); | 122 HistoryEntry* GetCurrentEntry(); |
| 121 blink::WebHistoryItem GetItemForNewChildFrame(RenderFrameImpl* frame) const; | 123 blink::WebHistoryItem GetItemForNewChildFrame(RenderFrameImpl* frame) const; |
| 122 void RemoveChildrenForRedirect(RenderFrameImpl* frame); | 124 void RemoveChildrenForRedirect(RenderFrameImpl* frame); |
| 123 | 125 |
| 124 private: | 126 private: |
| 125 typedef std::vector<std::pair<blink::WebFrame*, blink::WebHistoryItem> > | 127 typedef std::vector<std::pair<blink::WebFrame*, blink::WebHistoryItem> > |
| 126 HistoryFrameLoadVector; | 128 HistoryFrameLoadVector; |
| 127 void RecursiveGoToEntry(blink::WebFrame* frame, | 129 void RecursiveGoToEntry(blink::WebFrame* frame, |
| 128 HistoryFrameLoadVector& sameDocumentLoads, | 130 HistoryFrameLoadVector& sameDocumentLoads, |
| 129 HistoryFrameLoadVector& differentDocumentLoads); | 131 HistoryFrameLoadVector& differentDocumentLoads); |
| 130 | 132 |
| 131 void UpdateForInitialLoadInChildFrame(RenderFrameImpl* frame, | 133 void UpdateForInitialLoadInChildFrame(RenderFrameImpl* frame, |
| 132 const blink::WebHistoryItem& item); | 134 const blink::WebHistoryItem& item); |
| 133 void CreateNewBackForwardItem(RenderFrameImpl* frame, | 135 void CreateNewBackForwardItem(RenderFrameImpl* frame, |
| 134 const blink::WebHistoryItem& item, | 136 const blink::WebHistoryItem& item, |
| 135 bool clone_children_of_target); | 137 bool clone_children_of_target); |
| 136 | 138 |
| 137 RenderViewImpl* render_view_; | 139 RenderViewImpl* render_view_; |
| 138 | 140 |
| 141 // A HistoryEntry representing the currently-loaded page. | |
| 139 scoped_ptr<HistoryEntry> current_entry_; | 142 scoped_ptr<HistoryEntry> current_entry_; |
| 143 // A HistoryEntry representing the page that is being loaded, or an empty | |
| 144 // scoped_ptr if no page is being loaded. | |
| 140 scoped_ptr<HistoryEntry> provisional_entry_; | 145 scoped_ptr<HistoryEntry> provisional_entry_; |
| 146 // The NavigationParams corresponding to the last load that was initiated by | |
| 147 // |GoToEntry|. | |
|
Charlie Reis
2015/03/23 22:23:02
Let's mention that this is passed to each RenderFr
Avi (use Gerrit)
2015/03/24 20:33:46
That' actually not the case; by the time GetItemFo
Charlie Reis
2015/03/24 22:04:08
Acknowledged.
| |
| 148 scoped_ptr<NavigationParams> navigation_params_; | |
| 141 | 149 |
| 142 DISALLOW_COPY_AND_ASSIGN(HistoryController); | 150 DISALLOW_COPY_AND_ASSIGN(HistoryController); |
| 143 }; | 151 }; |
| 144 | 152 |
| 145 } // namespace content | 153 } // namespace content |
| 146 | 154 |
| 147 #endif // CONTENT_RENDERER_HISTORY_CONTROLLER_H_ | 155 #endif // CONTENT_RENDERER_HISTORY_CONTROLLER_H_ |
| OLD | NEW |