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

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

Issue 1112823005: Ensure that HistoryController's current entry is updated on inert commits. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use switch statement. Created 5 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
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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 if (HistoryEntry::HistoryNode* parent_history_node = 154 if (HistoryEntry::HistoryNode* parent_history_node =
155 current_entry_->GetHistoryNodeForFrame(parent)) { 155 current_entry_->GetHistoryNodeForFrame(parent)) {
156 parent_history_node->AddChild(item, frame->GetRoutingID()); 156 parent_history_node->AddChild(item, frame->GetRoutingID());
157 } 157 }
158 } 158 }
159 159
160 void HistoryController::UpdateForCommit(RenderFrameImpl* frame, 160 void HistoryController::UpdateForCommit(RenderFrameImpl* frame,
161 const WebHistoryItem& item, 161 const WebHistoryItem& item,
162 WebHistoryCommitType commit_type, 162 WebHistoryCommitType commit_type,
163 bool navigation_within_page) { 163 bool navigation_within_page) {
164 if (commit_type == blink::WebBackForwardCommit) { 164 switch (commit_type) {
165 if (!provisional_entry_) 165 case blink::WebBackForwardCommit:
166 return; 166 if (!provisional_entry_)
167 current_entry_.reset(provisional_entry_.release()); 167 return;
168 } else if (commit_type == blink::WebStandardCommit) { 168 current_entry_.reset(provisional_entry_.release());
169 CreateNewBackForwardItem(frame, item, navigation_within_page); 169 break;
170 } else if (commit_type == blink::WebInitialCommitInChildFrame) { 170 case blink::WebStandardCommit:
171 UpdateForInitialLoadInChildFrame(frame, item); 171 CreateNewBackForwardItem(frame, item, navigation_within_page);
172 break;
173 case blink::WebInitialCommitInChildFrame:
174 UpdateForInitialLoadInChildFrame(frame, item);
175 break;
176 case blink::WebHistoryInertCommit:
177 // Even for inert commits (e.g., location.replace, client redirects), make
178 // sure the current entry gets updated, if there is one.
179 if (current_entry_) {
180 if (HistoryEntry::HistoryNode* node =
181 current_entry_->GetHistoryNodeForFrame(frame)) {
182 node->set_item(item);
183 }
184 }
185 break;
186 default:
187 NOTREACHED() << "Invalid commit type: " << commit_type;
172 } 188 }
173 } 189 }
174 190
175 HistoryEntry* HistoryController::GetCurrentEntry() { 191 HistoryEntry* HistoryController::GetCurrentEntry() {
176 return current_entry_.get(); 192 return current_entry_.get();
177 } 193 }
178 194
179 WebHistoryItem HistoryController::GetItemForNewChildFrame( 195 WebHistoryItem HistoryController::GetItemForNewChildFrame(
180 RenderFrameImpl* frame) const { 196 RenderFrameImpl* frame) const {
181 if (navigation_params_.get()) { 197 if (navigation_params_.get()) {
(...skipping 21 matching lines...) Expand all
203 if (!current_entry_) { 219 if (!current_entry_) {
204 current_entry_.reset( 220 current_entry_.reset(
205 new HistoryEntry(new_item, target_frame->GetRoutingID())); 221 new HistoryEntry(new_item, target_frame->GetRoutingID()));
206 } else { 222 } else {
207 current_entry_.reset(current_entry_->CloneAndReplace( 223 current_entry_.reset(current_entry_->CloneAndReplace(
208 new_item, clone_children_of_target, target_frame, render_view_)); 224 new_item, clone_children_of_target, target_frame, render_view_));
209 } 225 }
210 } 226 }
211 227
212 } // namespace content 228 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698