OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "content/browser/web_contents/web_contents_impl.h" | 5 #include "content/browser/web_contents/web_contents_impl.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 // fully clear the RenderView's view of the session history. | 217 // fully clear the RenderView's view of the session history. |
218 params->pending_history_list_offset = -1; | 218 params->pending_history_list_offset = -1; |
219 params->current_history_list_offset = -1; | 219 params->current_history_list_offset = -1; |
220 params->current_history_list_length = 0; | 220 params->current_history_list_length = 0; |
221 } else { | 221 } else { |
222 params->pending_history_list_offset = controller.GetIndexOfEntry(&entry); | 222 params->pending_history_list_offset = controller.GetIndexOfEntry(&entry); |
223 params->current_history_list_offset = | 223 params->current_history_list_offset = |
224 controller.GetLastCommittedEntryIndex(); | 224 controller.GetLastCommittedEntryIndex(); |
225 params->current_history_list_length = controller.GetEntryCount(); | 225 params->current_history_list_length = controller.GetEntryCount(); |
226 } | 226 } |
| 227 params->url = entry.GetURL(); |
227 if (!entry.GetBaseURLForDataURL().is_empty()) { | 228 if (!entry.GetBaseURLForDataURL().is_empty()) { |
228 params->base_url_for_data_url = entry.GetBaseURLForDataURL(); | 229 params->base_url_for_data_url = entry.GetBaseURLForDataURL(); |
229 params->history_url_for_data_url = entry.GetVirtualURL(); | 230 params->history_url_for_data_url = entry.GetVirtualURL(); |
230 } | 231 } |
231 params->referrer = entry.GetReferrer(); | 232 params->referrer = entry.GetReferrer(); |
232 params->transition = entry.GetTransitionType(); | 233 params->transition = entry.GetTransitionType(); |
233 params->page_state = entry.GetPageState(); | 234 params->page_state = entry.GetPageState(); |
234 params->navigation_type = | 235 params->navigation_type = |
235 GetNavigationType(controller.GetBrowserContext(), entry, reload_type); | 236 GetNavigationType(controller.GetBrowserContext(), entry, reload_type); |
236 params->request_time = base::Time::Now(); | 237 params->request_time = base::Time::Now(); |
237 params->extra_headers = entry.extra_headers(); | 238 params->extra_headers = entry.extra_headers(); |
238 params->transferred_request_child_id = | 239 params->transferred_request_child_id = |
239 entry.transferred_global_request_id().child_id; | 240 entry.transferred_global_request_id().child_id; |
240 params->transferred_request_request_id = | 241 params->transferred_request_request_id = |
241 entry.transferred_global_request_id().request_id; | 242 entry.transferred_global_request_id().request_id; |
242 params->is_overriding_user_agent = entry.GetIsOverridingUserAgent(); | 243 params->is_overriding_user_agent = entry.GetIsOverridingUserAgent(); |
243 // Avoid downloading when in view-source mode. | 244 // Avoid downloading when in view-source mode. |
244 params->allow_download = !entry.IsViewSourceMode(); | 245 params->allow_download = !entry.IsViewSourceMode(); |
245 params->is_post = entry.GetHasPostData(); | 246 params->is_post = entry.GetHasPostData(); |
246 if(entry.GetBrowserInitiatedPostData()) { | 247 if (entry.GetBrowserInitiatedPostData()) { |
247 params->browser_initiated_post_data.assign( | 248 params->browser_initiated_post_data.assign( |
248 entry.GetBrowserInitiatedPostData()->front(), | 249 entry.GetBrowserInitiatedPostData()->front(), |
249 entry.GetBrowserInitiatedPostData()->front() + | 250 entry.GetBrowserInitiatedPostData()->front() + |
250 entry.GetBrowserInitiatedPostData()->size()); | 251 entry.GetBrowserInitiatedPostData()->size()); |
251 | |
252 } | |
253 | |
254 if (reload_type == NavigationControllerImpl::RELOAD_ORIGINAL_REQUEST_URL && | |
255 entry.GetOriginalRequestURL().is_valid() && !entry.GetHasPostData()) { | |
256 // We may have been redirected when navigating to the current URL. | |
257 // Use the URL the user originally intended to visit, if it's valid and if a | |
258 // POST wasn't involved; the latter case avoids issues with sending data to | |
259 // the wrong page. | |
260 params->url = entry.GetOriginalRequestURL(); | |
261 } else { | |
262 params->url = entry.GetURL(); | |
263 } | 252 } |
264 | 253 |
265 params->can_load_local_resources = entry.GetCanLoadLocalResources(); | 254 params->can_load_local_resources = entry.GetCanLoadLocalResources(); |
266 params->frame_to_navigate = entry.GetFrameToNavigate(); | 255 params->frame_to_navigate = entry.GetFrameToNavigate(); |
267 | 256 |
268 if (delegate) | 257 if (delegate) |
269 delegate->AddNavigationHeaders(params->url, ¶ms->extra_headers); | 258 delegate->AddNavigationHeaders(params->url, ¶ms->extra_headers); |
270 } | 259 } |
271 | 260 |
272 void NotifyCacheOnIO( | 261 void NotifyCacheOnIO( |
(...skipping 3561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3834 } | 3823 } |
3835 | 3824 |
3836 void WebContentsImpl::OnFrameRemoved( | 3825 void WebContentsImpl::OnFrameRemoved( |
3837 RenderViewHostImpl* render_view_host, | 3826 RenderViewHostImpl* render_view_host, |
3838 int64 frame_id) { | 3827 int64 frame_id) { |
3839 FOR_EACH_OBSERVER(WebContentsObserver, observers_, | 3828 FOR_EACH_OBSERVER(WebContentsObserver, observers_, |
3840 FrameDetached(render_view_host, frame_id)); | 3829 FrameDetached(render_view_host, frame_id)); |
3841 } | 3830 } |
3842 | 3831 |
3843 } // namespace content | 3832 } // namespace content |
OLD | NEW |