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

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: Rebase 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
« no previous file with comments | « no previous file | 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 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->toWebLocalFrame()->load(
96 request, blink::WebFrameLoadType::BackForward, item.second,
97 blink::WebHistorySameDocumentLoad);
95 } 98 }
96 for (const auto& item : different_document_loads) { 99 for (const auto& item : different_document_loads) {
97 WebFrame* frame = item.first; 100 WebFrame* frame = item.first;
98 RenderFrameImpl* render_frame = RenderFrameImpl::FromWebFrame(frame); 101 RenderFrameImpl* render_frame = RenderFrameImpl::FromWebFrame(frame);
99 if (!render_frame) 102 if (!render_frame)
100 continue; 103 continue;
101 render_frame->SetPendingNavigationParams(make_scoped_ptr( 104 render_frame->SetPendingNavigationParams(make_scoped_ptr(
102 new NavigationParams(*navigation_params_.get()))); 105 new NavigationParams(*navigation_params_.get())));
103 frame->loadHistoryItem(item.second, 106 WebURLRequest request = frame->toWebLocalFrame()->requestFromHistoryItem(
104 blink::WebHistoryDifferentDocumentLoad, 107 item.second, cache_policy);
105 cache_policy); 108 frame->toWebLocalFrame()->load(
109 request, blink::WebFrameLoadType::BackForward, item.second,
110 blink::WebHistoryDifferentDocumentLoad);
106 } 111 }
107 } 112 }
108 113
109 void HistoryController::RecursiveGoToEntry( 114 void HistoryController::RecursiveGoToEntry(
110 WebFrame* frame, 115 WebFrame* frame,
111 HistoryFrameLoadVector& same_document_loads, 116 HistoryFrameLoadVector& same_document_loads,
112 HistoryFrameLoadVector& different_document_loads) { 117 HistoryFrameLoadVector& different_document_loads) {
113 DCHECK(provisional_entry_); 118 DCHECK(provisional_entry_);
114 DCHECK(current_entry_); 119 DCHECK(current_entry_);
115 RenderFrameImpl* render_frame = RenderFrameImpl::FromWebFrame(frame); 120 RenderFrameImpl* render_frame = RenderFrameImpl::FromWebFrame(frame);
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 bool clone_children_of_target) { 223 bool clone_children_of_target) {
219 if (!current_entry_) { 224 if (!current_entry_) {
220 current_entry_.reset(new HistoryEntry(new_item)); 225 current_entry_.reset(new HistoryEntry(new_item));
221 } else { 226 } else {
222 current_entry_.reset(current_entry_->CloneAndReplace( 227 current_entry_.reset(current_entry_->CloneAndReplace(
223 new_item, clone_children_of_target, target_frame, render_view_)); 228 new_item, clone_children_of_target, target_frame, render_view_));
224 } 229 }
225 } 230 }
226 231
227 } // namespace content 232 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/renderer/render_frame_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698