OLD | NEW |
---|---|
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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
82 std::make_pair(main_frame, provisional_entry_->root())); | 82 std::make_pair(main_frame, provisional_entry_->root())); |
83 } | 83 } |
84 | 84 |
85 for (const auto& item : same_document_loads) { | 85 for (const auto& item : same_document_loads) { |
86 WebFrame* frame = item.first; | 86 WebFrame* frame = item.first; |
87 RenderFrameImpl* render_frame = RenderFrameImpl::FromWebFrame(frame); | 87 RenderFrameImpl* render_frame = RenderFrameImpl::FromWebFrame(frame); |
88 if (!render_frame) | 88 if (!render_frame) |
89 continue; | 89 continue; |
90 render_frame->SetPendingNavigationParams(make_scoped_ptr( | 90 render_frame->SetPendingNavigationParams(make_scoped_ptr( |
91 new NavigationParams(*navigation_params_.get()))); | 91 new NavigationParams(*navigation_params_.get()))); |
92 frame->loadHistoryItem(item.second, | 92 WebURLRequest request = |
93 blink::WebHistorySameDocumentLoad, | 93 frame->RequestFromHistoryItem(item.second, cache_policy); |
94 cache_policy); | 94 frame->loadRequest(request, WebFrame::WebFrameLoadTypeHistorySameDocument, |
95 item.second); | |
95 } | 96 } |
96 for (const auto& item : different_document_loads) { | 97 for (const auto& item : different_document_loads) { |
97 WebFrame* frame = item.first; | 98 WebFrame* frame = item.first; |
98 RenderFrameImpl* render_frame = RenderFrameImpl::FromWebFrame(frame); | 99 RenderFrameImpl* render_frame = RenderFrameImpl::FromWebFrame(frame); |
99 if (!render_frame) | 100 if (!render_frame) |
100 continue; | 101 continue; |
101 render_frame->SetPendingNavigationParams(make_scoped_ptr( | 102 render_frame->SetPendingNavigationParams(make_scoped_ptr( |
102 new NavigationParams(*navigation_params_.get()))); | 103 new NavigationParams(*navigation_params_.get()))); |
103 frame->loadHistoryItem(item.second, | 104 WebURLRequest request = |
104 blink::WebHistoryDifferentDocumentLoad, | 105 frame->RequestFromHistoryItem(item.second, cache_policy); |
105 cache_policy); | 106 frame->loadRequest(request, WebFrame::WebFrameLoadTypeBackForward, |
Charlie Reis
2015/05/27 23:34:35
The old names seemed like a clearer pair to me (Sa
clamy
2015/05/29 14:47:01
I brought back the WebHistoryLoadType following co
| |
107 item.second); | |
106 } | 108 } |
107 } | 109 } |
108 | 110 |
111 blink::WebHistoryItem HistoryController::FindItemForFrame( | |
112 scoped_ptr<HistoryEntry> target_entry, | |
113 RenderFrameImpl* target_frame, | |
114 blink::WebURLRequest::CachePolicy cache_policy, | |
115 blink::WebFrame::WebFrameLoadType* load_type) { | |
116 HistoryFrameLoadVector same_document_loads; | |
117 HistoryFrameLoadVector different_document_loads; | |
118 | |
119 provisional_entry_ = target_entry.Pass(); | |
120 | |
121 WebFrame* main_frame = render_view_->GetMainRenderFrame()->GetWebFrame(); | |
122 if (current_entry_) { | |
123 RecursiveGoToEntry(main_frame, same_document_loads, | |
Charlie Reis
2015/05/27 23:34:35
I'd like to avoid this if we can. I'm trying to m
clamy
2015/05/29 14:47:01
Done.
| |
124 different_document_loads); | |
125 } | |
126 | |
127 for (const auto& item : same_document_loads) { | |
128 WebFrame* frame = item.first; | |
129 RenderFrameImpl* render_frame = RenderFrameImpl::FromWebFrame(frame); | |
130 if (!render_frame || render_frame != target_frame) | |
131 continue; | |
132 *load_type = WebFrame::WebFrameLoadTypeHistorySameDocument; | |
133 return item.second; | |
134 } | |
135 for (const auto& item : different_document_loads) { | |
136 WebFrame* frame = item.first; | |
137 RenderFrameImpl* render_frame = RenderFrameImpl::FromWebFrame(frame); | |
138 if (!render_frame || render_frame != target_frame) | |
139 continue; | |
140 *load_type = WebFrame::WebFrameLoadTypeBackForward; | |
141 return item.second; | |
142 } | |
143 return blink::WebHistoryItem(); | |
144 } | |
145 | |
109 void HistoryController::RecursiveGoToEntry( | 146 void HistoryController::RecursiveGoToEntry( |
110 WebFrame* frame, | 147 WebFrame* frame, |
111 HistoryFrameLoadVector& same_document_loads, | 148 HistoryFrameLoadVector& same_document_loads, |
112 HistoryFrameLoadVector& different_document_loads) { | 149 HistoryFrameLoadVector& different_document_loads) { |
113 DCHECK(provisional_entry_); | 150 DCHECK(provisional_entry_); |
114 DCHECK(current_entry_); | 151 DCHECK(current_entry_); |
115 RenderFrameImpl* render_frame = RenderFrameImpl::FromWebFrame(frame); | 152 RenderFrameImpl* render_frame = RenderFrameImpl::FromWebFrame(frame); |
116 const WebHistoryItem& new_item = | 153 const WebHistoryItem& new_item = |
117 provisional_entry_->GetItemForFrame(render_frame); | 154 provisional_entry_->GetItemForFrame(render_frame); |
118 const WebHistoryItem& old_item = | 155 const WebHistoryItem& old_item = |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
219 if (!current_entry_) { | 256 if (!current_entry_) { |
220 current_entry_.reset( | 257 current_entry_.reset( |
221 new HistoryEntry(new_item, target_frame->GetRoutingID())); | 258 new HistoryEntry(new_item, target_frame->GetRoutingID())); |
222 } else { | 259 } else { |
223 current_entry_.reset(current_entry_->CloneAndReplace( | 260 current_entry_.reset(current_entry_->CloneAndReplace( |
224 new_item, clone_children_of_target, target_frame, render_view_)); | 261 new_item, clone_children_of_target, target_frame, render_view_)); |
225 } | 262 } |
226 } | 263 } |
227 | 264 |
228 } // namespace content | 265 } // namespace content |
OLD | NEW |