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

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

Issue 1157863005: Use WebFrame::loadRequest for reloads and history navigations (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Adressed comments Created 5 years, 6 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 20 matching lines...) Expand all
31 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 31 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
33 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 */ 34 */
35 35
36 #include "content/renderer/history_controller.h" 36 #include "content/renderer/history_controller.h"
37 37
38 #include "content/common/navigation_params.h" 38 #include "content/common/navigation_params.h"
39 #include "content/renderer/render_frame_impl.h" 39 #include "content/renderer/render_frame_impl.h"
40 #include "content/renderer/render_view_impl.h" 40 #include "content/renderer/render_view_impl.h"
41 #include "third_party/WebKit/public/web/WebFrameLoadType.h"
41 #include "third_party/WebKit/public/web/WebLocalFrame.h" 42 #include "third_party/WebKit/public/web/WebLocalFrame.h"
42 43
43 using blink::WebFrame; 44 using blink::WebFrame;
44 using blink::WebHistoryCommitType; 45 using blink::WebHistoryCommitType;
45 using blink::WebHistoryItem; 46 using blink::WebHistoryItem;
46 using blink::WebURLRequest; 47 using blink::WebURLRequest;
47 48
48 namespace content { 49 namespace content {
49 50
50 HistoryController::HistoryController(RenderViewImpl* render_view) 51 HistoryController::HistoryController(RenderViewImpl* render_view)
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 std::make_pair(main_frame, provisional_entry_->root())); 83 std::make_pair(main_frame, provisional_entry_->root()));
83 } 84 }
84 85
85 for (const auto& item : same_document_loads) { 86 for (const auto& item : same_document_loads) {
86 WebFrame* frame = item.first; 87 WebFrame* frame = item.first;
87 RenderFrameImpl* render_frame = RenderFrameImpl::FromWebFrame(frame); 88 RenderFrameImpl* render_frame = RenderFrameImpl::FromWebFrame(frame);
88 if (!render_frame) 89 if (!render_frame)
89 continue; 90 continue;
90 render_frame->SetPendingNavigationParams(make_scoped_ptr( 91 render_frame->SetPendingNavigationParams(make_scoped_ptr(
91 new NavigationParams(*navigation_params_.get()))); 92 new NavigationParams(*navigation_params_.get())));
92 frame->loadHistoryItem(item.second, 93 WebURLRequest request = frame->toWebLocalFrame()->requestFromHistoryItem(
93 blink::WebHistorySameDocumentLoad, 94 item.second, cache_policy);
94 cache_policy); 95 frame->loadRequest(request, blink::BackForward, item.second,
96 blink::WebHistorySameDocumentLoad);
95 } 97 }
96 for (const auto& item : different_document_loads) { 98 for (const auto& item : different_document_loads) {
97 WebFrame* frame = item.first; 99 WebFrame* frame = item.first;
98 RenderFrameImpl* render_frame = RenderFrameImpl::FromWebFrame(frame); 100 RenderFrameImpl* render_frame = RenderFrameImpl::FromWebFrame(frame);
99 if (!render_frame) 101 if (!render_frame)
100 continue; 102 continue;
101 render_frame->SetPendingNavigationParams(make_scoped_ptr( 103 render_frame->SetPendingNavigationParams(make_scoped_ptr(
102 new NavigationParams(*navigation_params_.get()))); 104 new NavigationParams(*navigation_params_.get())));
103 frame->loadHistoryItem(item.second, 105 WebURLRequest request = frame->toWebLocalFrame()->requestFromHistoryItem(
104 blink::WebHistoryDifferentDocumentLoad, 106 item.second, cache_policy);
105 cache_policy); 107 frame->loadRequest(request, blink::BackForward, item.second,
108 blink::WebHistoryDifferentDocumentLoad);
106 } 109 }
107 } 110 }
108 111
109 void HistoryController::RecursiveGoToEntry( 112 void HistoryController::RecursiveGoToEntry(
110 WebFrame* frame, 113 WebFrame* frame,
111 HistoryFrameLoadVector& same_document_loads, 114 HistoryFrameLoadVector& same_document_loads,
112 HistoryFrameLoadVector& different_document_loads) { 115 HistoryFrameLoadVector& different_document_loads) {
113 DCHECK(provisional_entry_); 116 DCHECK(provisional_entry_);
114 DCHECK(current_entry_); 117 DCHECK(current_entry_);
115 RenderFrameImpl* render_frame = RenderFrameImpl::FromWebFrame(frame); 118 RenderFrameImpl* render_frame = RenderFrameImpl::FromWebFrame(frame);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 if (!current_entry_) { 222 if (!current_entry_) {
220 current_entry_.reset( 223 current_entry_.reset(
221 new HistoryEntry(new_item, target_frame->GetRoutingID())); 224 new HistoryEntry(new_item, target_frame->GetRoutingID()));
222 } else { 225 } else {
223 current_entry_.reset(current_entry_->CloneAndReplace( 226 current_entry_.reset(current_entry_->CloneAndReplace(
224 new_item, clone_children_of_target, target_frame, render_view_)); 227 new_item, clone_children_of_target, target_frame, render_view_));
225 } 228 }
226 } 229 }
227 230
228 } // namespace content 231 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/render_frame_impl.cc » ('j') | content/renderer/render_frame_impl.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698