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

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

Issue 2253053003: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 std::make_pair(main_frame, provisional_entry_->root())); 91 std::make_pair(main_frame, provisional_entry_->root()));
92 } 92 }
93 93
94 bool has_main_frame_request = false; 94 bool has_main_frame_request = false;
95 for (const auto& item : same_document_loads) { 95 for (const auto& item : same_document_loads) {
96 WebFrame* frame = item.first; 96 WebFrame* frame = item.first;
97 RenderFrameImpl* render_frame = RenderFrameImpl::FromWebFrame(frame); 97 RenderFrameImpl* render_frame = RenderFrameImpl::FromWebFrame(frame);
98 if (!render_frame) 98 if (!render_frame)
99 continue; 99 continue;
100 render_frame->SetPendingNavigationParams( 100 render_frame->SetPendingNavigationParams(
101 base::WrapUnique(new NavigationParams(*navigation_params_.get()))); 101 base::MakeUnique<NavigationParams>(*navigation_params_.get()));
102 WebURLRequest request = frame->toWebLocalFrame()->requestFromHistoryItem( 102 WebURLRequest request = frame->toWebLocalFrame()->requestFromHistoryItem(
103 item.second, cache_policy); 103 item.second, cache_policy);
104 frame->toWebLocalFrame()->load( 104 frame->toWebLocalFrame()->load(
105 request, blink::WebFrameLoadType::BackForward, item.second, 105 request, blink::WebFrameLoadType::BackForward, item.second,
106 blink::WebHistorySameDocumentLoad); 106 blink::WebHistorySameDocumentLoad);
107 if (frame == main_frame) 107 if (frame == main_frame)
108 has_main_frame_request = true; 108 has_main_frame_request = true;
109 } 109 }
110 for (const auto& item : different_document_loads) { 110 for (const auto& item : different_document_loads) {
111 WebFrame* frame = item.first; 111 WebFrame* frame = item.first;
112 RenderFrameImpl* render_frame = RenderFrameImpl::FromWebFrame(frame); 112 RenderFrameImpl* render_frame = RenderFrameImpl::FromWebFrame(frame);
113 if (!render_frame) 113 if (!render_frame)
114 continue; 114 continue;
115 render_frame->SetPendingNavigationParams( 115 render_frame->SetPendingNavigationParams(
116 base::WrapUnique(new NavigationParams(*navigation_params_.get()))); 116 base::MakeUnique<NavigationParams>(*navigation_params_.get()));
117 WebURLRequest request = frame->toWebLocalFrame()->requestFromHistoryItem( 117 WebURLRequest request = frame->toWebLocalFrame()->requestFromHistoryItem(
118 item.second, cache_policy); 118 item.second, cache_policy);
119 frame->toWebLocalFrame()->load( 119 frame->toWebLocalFrame()->load(
120 request, blink::WebFrameLoadType::BackForward, item.second, 120 request, blink::WebFrameLoadType::BackForward, item.second,
121 blink::WebHistoryDifferentDocumentLoad); 121 blink::WebHistoryDifferentDocumentLoad);
122 if (frame == main_frame) 122 if (frame == main_frame)
123 has_main_frame_request = true; 123 has_main_frame_request = true;
124 } 124 }
125 125
126 return has_main_frame_request; 126 return has_main_frame_request;
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
297 } 297 }
298 298
299 HistoryEntry* HistoryController::GetCurrentEntry() { 299 HistoryEntry* HistoryController::GetCurrentEntry() {
300 return current_entry_.get(); 300 return current_entry_.get();
301 } 301 }
302 302
303 WebHistoryItem HistoryController::GetItemForNewChildFrame( 303 WebHistoryItem HistoryController::GetItemForNewChildFrame(
304 RenderFrameImpl* frame) const { 304 RenderFrameImpl* frame) const {
305 if (navigation_params_.get()) { 305 if (navigation_params_.get()) {
306 frame->SetPendingNavigationParams( 306 frame->SetPendingNavigationParams(
307 base::WrapUnique(new NavigationParams(*navigation_params_.get()))); 307 base::MakeUnique<NavigationParams>(*navigation_params_.get()));
308 } 308 }
309 309
310 if (!current_entry_) 310 if (!current_entry_)
311 return WebHistoryItem(); 311 return WebHistoryItem();
312 return current_entry_->GetItemForFrame(frame); 312 return current_entry_->GetItemForFrame(frame);
313 } 313 }
314 314
315 void HistoryController::RemoveChildrenForRedirect(RenderFrameImpl* frame) { 315 void HistoryController::RemoveChildrenForRedirect(RenderFrameImpl* frame) {
316 if (!provisional_entry_) 316 if (!provisional_entry_)
317 return; 317 return;
318 if (HistoryEntry::HistoryNode* node = 318 if (HistoryEntry::HistoryNode* node =
319 provisional_entry_->GetHistoryNodeForFrame(frame)) 319 provisional_entry_->GetHistoryNodeForFrame(frame))
320 node->RemoveChildren(); 320 node->RemoveChildren();
321 } 321 }
322 322
323 void HistoryController::CreateNewBackForwardItem( 323 void HistoryController::CreateNewBackForwardItem(
324 RenderFrameImpl* target_frame, 324 RenderFrameImpl* target_frame,
325 const WebHistoryItem& new_item, 325 const WebHistoryItem& new_item,
326 bool clone_children_of_target) { 326 bool clone_children_of_target) {
327 if (!current_entry_) { 327 if (!current_entry_) {
328 current_entry_.reset(new HistoryEntry(new_item)); 328 current_entry_.reset(new HistoryEntry(new_item));
329 } else { 329 } else {
330 current_entry_.reset(current_entry_->CloneAndReplace( 330 current_entry_.reset(current_entry_->CloneAndReplace(
331 new_item, clone_children_of_target, target_frame, render_view_)); 331 new_item, clone_children_of_target, target_frame, render_view_));
332 } 332 }
333 } 333 }
334 334
335 } // namespace content 335 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/gpu/frame_swap_message_queue_unittest.cc ('k') | content/renderer/input/input_event_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698