Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(552)

Side by Side Diff: content/renderer/history_controller.cc

Issue 266013002: Remove HistoryController::GetPreviousEntry. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase; remove browser half of quirk. Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/renderer/history_controller.h ('k') | content/renderer/render_frame_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 Nokia Corporation and/or its subsidiary(-ies) 7 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. 8 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved.
9 * (http://www.torchmobile.com/) 9 * (http://www.torchmobile.com/)
10 * 10 *
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 if (same_document_loads.empty() && different_document_loads.empty()) { 69 if (same_document_loads.empty() && different_document_loads.empty()) {
70 // If we don't have any frames to navigate at this point, either 70 // If we don't have any frames to navigate at this point, either
71 // (1) there is no previous history entry to compare against, or 71 // (1) there is no previous history entry to compare against, or
72 // (2) we were unable to match any frames by name. In the first case, 72 // (2) we were unable to match any frames by name. In the first case,
73 // doing a different document navigation to the root item is the only valid 73 // doing a different document navigation to the root item is the only valid
74 // thing to do. In the second case, we should have been able to find a 74 // thing to do. In the second case, we should have been able to find a
75 // frame to navigate based on names if this were a same document 75 // frame to navigate based on names if this were a same document
76 // navigation, so we can safely assume this is the different document case. 76 // navigation, so we can safely assume this is the different document case.
77 different_document_loads.push_back( 77 different_document_loads.push_back(
78 std::make_pair(main_frame, provisional_entry_->root())); 78 std::make_pair(main_frame, provisional_entry_->root()));
79 } else if (different_document_loads.empty()) {
80 // If we have only same document navigations to perform, immediately
81 // declare the load "committed" by updating the current entry.
82 // TODO(japhet): This is a historical quirk, because same-document
83 // history navigations call UpdateForCommit() with commit type
84 // HistoryInertCommit. If that is fixed, we can remove this block.
85 previous_entry_.reset(current_entry_.release());
86 current_entry_.reset(provisional_entry_.release());
87 } 79 }
88 80
89 for (size_t i = 0; i < same_document_loads.size(); ++i) { 81 for (size_t i = 0; i < same_document_loads.size(); ++i) {
90 WebFrame* frame = same_document_loads[i].first; 82 WebFrame* frame = same_document_loads[i].first;
91 if (!RenderFrameImpl::FromWebFrame(frame)) 83 if (!RenderFrameImpl::FromWebFrame(frame))
92 continue; 84 continue;
93 frame->loadHistoryItem(same_document_loads[i].second, 85 frame->loadHistoryItem(same_document_loads[i].second,
94 blink::WebHistorySameDocumentLoad, 86 blink::WebHistorySameDocumentLoad,
95 cache_policy); 87 cache_policy);
96 } 88 }
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 } 145 }
154 } 146 }
155 147
156 void HistoryController::UpdateForCommit(RenderFrameImpl* frame, 148 void HistoryController::UpdateForCommit(RenderFrameImpl* frame,
157 const WebHistoryItem& item, 149 const WebHistoryItem& item,
158 WebHistoryCommitType commit_type, 150 WebHistoryCommitType commit_type,
159 bool navigation_within_page) { 151 bool navigation_within_page) {
160 if (commit_type == blink::WebBackForwardCommit) { 152 if (commit_type == blink::WebBackForwardCommit) {
161 if (!provisional_entry_) 153 if (!provisional_entry_)
162 return; 154 return;
163 previous_entry_.reset(current_entry_.release());
164 current_entry_.reset(provisional_entry_.release()); 155 current_entry_.reset(provisional_entry_.release());
165 } else if (commit_type == blink::WebStandardCommit) { 156 } else if (commit_type == blink::WebStandardCommit) {
166 CreateNewBackForwardItem(frame, item, navigation_within_page); 157 CreateNewBackForwardItem(frame, item, navigation_within_page);
167 } else if (commit_type == blink::WebInitialCommitInChildFrame) { 158 } else if (commit_type == blink::WebInitialCommitInChildFrame) {
168 UpdateForInitialLoadInChildFrame(frame, item); 159 UpdateForInitialLoadInChildFrame(frame, item);
169 } 160 }
170 } 161 }
171 162
172 HistoryEntry* HistoryController::GetCurrentEntry() { 163 HistoryEntry* HistoryController::GetCurrentEntry() {
173 return current_entry_.get(); 164 return current_entry_.get();
174 } 165 }
175 166
176 HistoryEntry* HistoryController::GetPreviousEntry() {
177 return previous_entry_.get();
178 }
179
180 WebHistoryItem HistoryController::GetItemForNewChildFrame( 167 WebHistoryItem HistoryController::GetItemForNewChildFrame(
181 RenderFrameImpl* frame) const { 168 RenderFrameImpl* frame) const {
182 if (!current_entry_) 169 if (!current_entry_)
183 return WebHistoryItem(); 170 return WebHistoryItem();
184 return current_entry_->GetItemForFrame(frame); 171 return current_entry_->GetItemForFrame(frame);
185 } 172 }
186 173
187 void HistoryController::RemoveChildrenForRedirect(RenderFrameImpl* frame) { 174 void HistoryController::RemoveChildrenForRedirect(RenderFrameImpl* frame) {
188 if (!provisional_entry_) 175 if (!provisional_entry_)
189 return; 176 return;
190 if (HistoryEntry::HistoryNode* node = 177 if (HistoryEntry::HistoryNode* node =
191 provisional_entry_->GetHistoryNodeForFrame(frame)) 178 provisional_entry_->GetHistoryNodeForFrame(frame))
192 node->RemoveChildren(); 179 node->RemoveChildren();
193 } 180 }
194 181
195 void HistoryController::CreateNewBackForwardItem( 182 void HistoryController::CreateNewBackForwardItem(
196 RenderFrameImpl* target_frame, 183 RenderFrameImpl* target_frame,
197 const WebHistoryItem& new_item, 184 const WebHistoryItem& new_item,
198 bool clone_children_of_target) { 185 bool clone_children_of_target) {
199 if (!current_entry_) { 186 if (!current_entry_) {
200 current_entry_.reset( 187 current_entry_.reset(
201 new HistoryEntry(new_item, target_frame->GetRoutingID())); 188 new HistoryEntry(new_item, target_frame->GetRoutingID()));
202 } else { 189 } else {
203 previous_entry_.reset(current_entry_.release()); 190 current_entry_.reset(current_entry_->CloneAndReplace(
204 current_entry_.reset(previous_entry_->CloneAndReplace(
205 new_item, clone_children_of_target, target_frame, render_view_)); 191 new_item, clone_children_of_target, target_frame, render_view_));
206 } 192 }
207 } 193 }
208 194
209 } // namespace content 195 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/history_controller.h ('k') | content/renderer/render_frame_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698