| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/renderer/render_frame_impl.h" | 5 #include "content/renderer/render_frame_impl.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
| (...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 double navigation_start_seconds = | 454 double navigation_start_seconds = |
| 455 (navigation_start - base::TimeTicks()).InSecondsF(); | 455 (navigation_start - base::TimeTicks()).InSecondsF(); |
| 456 frame->provisionalDataSource()->setNavigationStartTime( | 456 frame->provisionalDataSource()->setNavigationStartTime( |
| 457 navigation_start_seconds); | 457 navigation_start_seconds); |
| 458 // TODO(clamy): We need to provide additional timing values for the | 458 // TODO(clamy): We need to provide additional timing values for the |
| 459 // Navigation Timing API to work with browser-side navigations. | 459 // Navigation Timing API to work with browser-side navigations. |
| 460 } | 460 } |
| 461 } | 461 } |
| 462 | 462 |
| 463 // PlzNavigate | 463 // PlzNavigate |
| 464 FrameHostMsg_BeginNavigation_Params MakeBeginNavigationParams( | |
| 465 blink::WebURLRequest* request) { | |
| 466 FrameHostMsg_BeginNavigation_Params params; | |
| 467 params.method = request->httpMethod().latin1(); | |
| 468 params.headers = GetWebURLRequestHeaders(*request); | |
| 469 params.load_flags = GetLoadFlagsForWebURLRequest(*request); | |
| 470 params.request_body = GetRequestBodyForWebURLRequest(*request); | |
| 471 params.has_user_gesture = request->hasUserGesture(); | |
| 472 return params; | |
| 473 } | |
| 474 | |
| 475 // PlzNavigate | |
| 476 CommonNavigationParams MakeCommonNavigationParams( | 464 CommonNavigationParams MakeCommonNavigationParams( |
| 477 blink::WebURLRequest* request) { | 465 blink::WebURLRequest* request) { |
| 478 const RequestExtraData kEmptyData; | 466 const RequestExtraData kEmptyData; |
| 479 const RequestExtraData* extra_data = | 467 const RequestExtraData* extra_data = |
| 480 static_cast<RequestExtraData*>(request->extraData()); | 468 static_cast<RequestExtraData*>(request->extraData()); |
| 481 if (!extra_data) | 469 if (!extra_data) |
| 482 extra_data = &kEmptyData; | 470 extra_data = &kEmptyData; |
| 483 CommonNavigationParams params; | 471 CommonNavigationParams params; |
| 484 params.url = request->url(); | 472 params.url = request->url(); |
| 485 params.referrer = Referrer( | 473 params.referrer = Referrer( |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1030 IPC_MESSAGE_HANDLER(FrameMsg_ShowTransitionElements, | 1018 IPC_MESSAGE_HANDLER(FrameMsg_ShowTransitionElements, |
| 1031 OnShowTransitionElements) | 1019 OnShowTransitionElements) |
| 1032 IPC_MESSAGE_HANDLER(FrameMsg_Reload, OnReload) | 1020 IPC_MESSAGE_HANDLER(FrameMsg_Reload, OnReload) |
| 1033 IPC_MESSAGE_HANDLER(FrameMsg_TextSurroundingSelectionRequest, | 1021 IPC_MESSAGE_HANDLER(FrameMsg_TextSurroundingSelectionRequest, |
| 1034 OnTextSurroundingSelectionRequest) | 1022 OnTextSurroundingSelectionRequest) |
| 1035 IPC_MESSAGE_HANDLER(FrameMsg_AddStyleSheetByURL, | 1023 IPC_MESSAGE_HANDLER(FrameMsg_AddStyleSheetByURL, |
| 1036 OnAddStyleSheetByURL) | 1024 OnAddStyleSheetByURL) |
| 1037 IPC_MESSAGE_HANDLER(FrameMsg_SetAccessibilityMode, | 1025 IPC_MESSAGE_HANDLER(FrameMsg_SetAccessibilityMode, |
| 1038 OnSetAccessibilityMode) | 1026 OnSetAccessibilityMode) |
| 1039 IPC_MESSAGE_HANDLER(FrameMsg_DisownOpener, OnDisownOpener) | 1027 IPC_MESSAGE_HANDLER(FrameMsg_DisownOpener, OnDisownOpener) |
| 1040 IPC_MESSAGE_HANDLER(FrameMsg_RequestNavigation, OnRequestNavigation) | |
| 1041 IPC_MESSAGE_HANDLER(FrameMsg_CommitNavigation, OnCommitNavigation) | 1028 IPC_MESSAGE_HANDLER(FrameMsg_CommitNavigation, OnCommitNavigation) |
| 1042 #if defined(OS_ANDROID) | 1029 #if defined(OS_ANDROID) |
| 1043 IPC_MESSAGE_HANDLER(FrameMsg_SelectPopupMenuItems, OnSelectPopupMenuItems) | 1030 IPC_MESSAGE_HANDLER(FrameMsg_SelectPopupMenuItems, OnSelectPopupMenuItems) |
| 1044 #elif defined(OS_MACOSX) | 1031 #elif defined(OS_MACOSX) |
| 1045 IPC_MESSAGE_HANDLER(FrameMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) | 1032 IPC_MESSAGE_HANDLER(FrameMsg_SelectPopupMenuItem, OnSelectPopupMenuItem) |
| 1046 IPC_MESSAGE_HANDLER(InputMsg_CopyToFindPboard, OnCopyToFindPboard) | 1033 IPC_MESSAGE_HANDLER(InputMsg_CopyToFindPboard, OnCopyToFindPboard) |
| 1047 #endif | 1034 #endif |
| 1048 IPC_END_MESSAGE_MAP() | 1035 IPC_END_MESSAGE_MAP() |
| 1049 | 1036 |
| 1050 return handled; | 1037 return handled; |
| (...skipping 2797 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3848 void RenderFrameImpl::FocusedNodeChanged(const WebNode& node) { | 3835 void RenderFrameImpl::FocusedNodeChanged(const WebNode& node) { |
| 3849 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, FocusedNodeChanged(node)); | 3836 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, FocusedNodeChanged(node)); |
| 3850 } | 3837 } |
| 3851 | 3838 |
| 3852 void RenderFrameImpl::FocusedNodeChangedForAccessibility(const WebNode& node) { | 3839 void RenderFrameImpl::FocusedNodeChangedForAccessibility(const WebNode& node) { |
| 3853 if (renderer_accessibility()) | 3840 if (renderer_accessibility()) |
| 3854 renderer_accessibility()->AccessibilityFocusedNodeChanged(node); | 3841 renderer_accessibility()->AccessibilityFocusedNodeChanged(node); |
| 3855 } | 3842 } |
| 3856 | 3843 |
| 3857 // PlzNavigate | 3844 // PlzNavigate |
| 3858 void RenderFrameImpl::OnRequestNavigation( | |
| 3859 const CommonNavigationParams& common_params, | |
| 3860 const RequestNavigationParams& request_params) { | |
| 3861 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( | |
| 3862 switches::kEnableBrowserSideNavigation)); | |
| 3863 WebURLRequest request = | |
| 3864 CreateURLRequestForNavigation(common_params, | |
| 3865 request_params, | |
| 3866 scoped_ptr<StreamOverrideParameters>(), | |
| 3867 frame_->isViewSourceModeEnabled()); | |
| 3868 BeginNavigation(&request); | |
| 3869 } | |
| 3870 | |
| 3871 // PlzNavigate | |
| 3872 void RenderFrameImpl::OnCommitNavigation( | 3845 void RenderFrameImpl::OnCommitNavigation( |
| 3873 const ResourceResponseHead& response, | 3846 const ResourceResponseHead& response, |
| 3874 const GURL& stream_url, | 3847 const GURL& stream_url, |
| 3875 const CommonNavigationParams& common_params, | 3848 const CommonNavigationParams& common_params, |
| 3876 const CommitNavigationParams& commit_params) { | 3849 const CommitNavigationParams& commit_params) { |
| 3877 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( | 3850 CHECK(base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 3878 switches::kEnableBrowserSideNavigation)); | 3851 switches::kEnableBrowserSideNavigation)); |
| 3879 bool is_reload = false; | 3852 bool is_reload = false; |
| 3880 bool is_history_navigation = commit_params.page_state.IsValid(); | 3853 bool is_history_navigation = commit_params.page_state.IsValid(); |
| 3881 WebURLRequest::CachePolicy cache_policy = | 3854 WebURLRequest::CachePolicy cache_policy = |
| (...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4366 // (devtools). | 4339 // (devtools). |
| 4367 // | 4340 // |
| 4368 // TODO(clamy): Apply devtools override. | 4341 // TODO(clamy): Apply devtools override. |
| 4369 // TODO(clamy): Make sure that navigation requests are not modified somewhere | 4342 // TODO(clamy): Make sure that navigation requests are not modified somewhere |
| 4370 // else in blink. | 4343 // else in blink. |
| 4371 willSendRequest(frame_, 0, *request, blink::WebURLResponse()); | 4344 willSendRequest(frame_, 0, *request, blink::WebURLResponse()); |
| 4372 | 4345 |
| 4373 // TODO(clamy): Same-document navigations should not be sent back to the | 4346 // TODO(clamy): Same-document navigations should not be sent back to the |
| 4374 // browser. | 4347 // browser. |
| 4375 // TODO(clamy): Data urls should not be sent back to the browser either. | 4348 // TODO(clamy): Data urls should not be sent back to the browser either. |
| 4376 Send(new FrameHostMsg_BeginNavigation(routing_id_, | 4349 Send(new FrameHostMsg_BeginNavigation( |
| 4377 MakeBeginNavigationParams(request), | 4350 routing_id_, MakeCommonNavigationParams(request), |
| 4378 MakeCommonNavigationParams(request))); | 4351 BeginNavigationParams(request->httpMethod().latin1(), |
| 4352 GetWebURLRequestHeaders(*request), |
| 4353 GetLoadFlagsForWebURLRequest(*request), |
| 4354 request->hasUserGesture()), |
| 4355 GetRequestBodyForWebURLRequest(*request))); |
| 4379 } | 4356 } |
| 4380 | 4357 |
| 4381 GURL RenderFrameImpl::GetLoadingUrl() const { | 4358 GURL RenderFrameImpl::GetLoadingUrl() const { |
| 4382 WebDataSource* ds = frame_->dataSource(); | 4359 WebDataSource* ds = frame_->dataSource(); |
| 4383 if (ds->hasUnreachableURL()) | 4360 if (ds->hasUnreachableURL()) |
| 4384 return ds->unreachableURL(); | 4361 return ds->unreachableURL(); |
| 4385 | 4362 |
| 4386 const WebURLRequest& request = ds->request(); | 4363 const WebURLRequest& request = ds->request(); |
| 4387 return request.url(); | 4364 return request.url(); |
| 4388 } | 4365 } |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4440 | 4417 |
| 4441 #if defined(ENABLE_BROWSER_CDMS) | 4418 #if defined(ENABLE_BROWSER_CDMS) |
| 4442 RendererCdmManager* RenderFrameImpl::GetCdmManager() { | 4419 RendererCdmManager* RenderFrameImpl::GetCdmManager() { |
| 4443 if (!cdm_manager_) | 4420 if (!cdm_manager_) |
| 4444 cdm_manager_ = new RendererCdmManager(this); | 4421 cdm_manager_ = new RendererCdmManager(this); |
| 4445 return cdm_manager_; | 4422 return cdm_manager_; |
| 4446 } | 4423 } |
| 4447 #endif // defined(ENABLE_BROWSER_CDMS) | 4424 #endif // defined(ENABLE_BROWSER_CDMS) |
| 4448 | 4425 |
| 4449 } // namespace content | 4426 } // namespace content |
| OLD | NEW |