| 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 23 matching lines...) Expand all Loading... |
| 34 #include "content/child/web_url_request_util.h" | 34 #include "content/child/web_url_request_util.h" |
| 35 #include "content/child/webmessageportchannel_impl.h" | 35 #include "content/child/webmessageportchannel_impl.h" |
| 36 #include "content/child/websocket_bridge.h" | 36 #include "content/child/websocket_bridge.h" |
| 37 #include "content/child/weburlresponse_extradata_impl.h" | 37 #include "content/child/weburlresponse_extradata_impl.h" |
| 38 #include "content/common/accessibility_messages.h" | 38 #include "content/common/accessibility_messages.h" |
| 39 #include "content/common/clipboard_messages.h" | 39 #include "content/common/clipboard_messages.h" |
| 40 #include "content/common/frame_messages.h" | 40 #include "content/common/frame_messages.h" |
| 41 #include "content/common/frame_replication_state.h" | 41 #include "content/common/frame_replication_state.h" |
| 42 #include "content/common/input_messages.h" | 42 #include "content/common/input_messages.h" |
| 43 #include "content/common/navigation_params.h" | 43 #include "content/common/navigation_params.h" |
| 44 #include "content/common/savable_subframe.h" |
| 44 #include "content/common/service_worker/service_worker_types.h" | 45 #include "content/common/service_worker/service_worker_types.h" |
| 45 #include "content/common/site_isolation_policy.h" | 46 #include "content/common/site_isolation_policy.h" |
| 46 #include "content/common/swapped_out_messages.h" | 47 #include "content/common/swapped_out_messages.h" |
| 47 #include "content/common/view_messages.h" | 48 #include "content/common/view_messages.h" |
| 48 #include "content/public/common/bindings_policy.h" | 49 #include "content/public/common/bindings_policy.h" |
| 49 #include "content/public/common/content_constants.h" | 50 #include "content/public/common/content_constants.h" |
| 50 #include "content/public/common/content_switches.h" | 51 #include "content/public/common/content_switches.h" |
| 51 #include "content/public/common/context_menu_params.h" | 52 #include "content/public/common/context_menu_params.h" |
| 52 #include "content/public/common/isolated_world_ids.h" | 53 #include "content/public/common/isolated_world_ids.h" |
| 53 #include "content/public/common/page_state.h" | 54 #include "content/public/common/page_state.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 #include "content/renderer/render_view_impl.h" | 103 #include "content/renderer/render_view_impl.h" |
| 103 #include "content/renderer/render_widget_fullscreen_pepper.h" | 104 #include "content/renderer/render_widget_fullscreen_pepper.h" |
| 104 #include "content/renderer/renderer_webapplicationcachehost_impl.h" | 105 #include "content/renderer/renderer_webapplicationcachehost_impl.h" |
| 105 #include "content/renderer/renderer_webcolorchooser_impl.h" | 106 #include "content/renderer/renderer_webcolorchooser_impl.h" |
| 106 #include "content/renderer/savable_resources.h" | 107 #include "content/renderer/savable_resources.h" |
| 107 #include "content/renderer/screen_orientation/screen_orientation_dispatcher.h" | 108 #include "content/renderer/screen_orientation/screen_orientation_dispatcher.h" |
| 108 #include "content/renderer/shared_worker_repository.h" | 109 #include "content/renderer/shared_worker_repository.h" |
| 109 #include "content/renderer/skia_benchmarking_extension.h" | 110 #include "content/renderer/skia_benchmarking_extension.h" |
| 110 #include "content/renderer/stats_collection_controller.h" | 111 #include "content/renderer/stats_collection_controller.h" |
| 111 #include "content/renderer/wake_lock/wake_lock_dispatcher.h" | 112 #include "content/renderer/wake_lock/wake_lock_dispatcher.h" |
| 113 #include "content/renderer/web_frame_utils.h" |
| 112 #include "content/renderer/web_ui_extension.h" | 114 #include "content/renderer/web_ui_extension.h" |
| 113 #include "content/renderer/websharedworker_proxy.h" | 115 #include "content/renderer/websharedworker_proxy.h" |
| 114 #include "gin/modules/module_registry.h" | 116 #include "gin/modules/module_registry.h" |
| 115 #include "media/base/audio_renderer_mixer_input.h" | 117 #include "media/base/audio_renderer_mixer_input.h" |
| 116 #include "media/base/media_log.h" | 118 #include "media/base/media_log.h" |
| 117 #include "media/blink/webencryptedmediaclient_impl.h" | 119 #include "media/blink/webencryptedmediaclient_impl.h" |
| 118 #include "media/blink/webmediaplayer_impl.h" | 120 #include "media/blink/webmediaplayer_impl.h" |
| 119 #include "media/renderers/gpu_video_accelerator_factories.h" | 121 #include "media/renderers/gpu_video_accelerator_factories.h" |
| 120 #include "mojo/common/url_type_converters.h" | 122 #include "mojo/common/url_type_converters.h" |
| 121 #include "net/base/data_url.h" | 123 #include "net/base/data_url.h" |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 return media::Context3D(provider->ContextGL(), provider->GrContext()); | 522 return media::Context3D(provider->ContextGL(), provider->GrContext()); |
| 521 } | 523 } |
| 522 #endif | 524 #endif |
| 523 | 525 |
| 524 bool IsReload(FrameMsg_Navigate_Type::Value navigation_type) { | 526 bool IsReload(FrameMsg_Navigate_Type::Value navigation_type) { |
| 525 return navigation_type == FrameMsg_Navigate_Type::RELOAD || | 527 return navigation_type == FrameMsg_Navigate_Type::RELOAD || |
| 526 navigation_type == FrameMsg_Navigate_Type::RELOAD_IGNORING_CACHE || | 528 navigation_type == FrameMsg_Navigate_Type::RELOAD_IGNORING_CACHE || |
| 527 navigation_type == FrameMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL; | 529 navigation_type == FrameMsg_Navigate_Type::RELOAD_ORIGINAL_REQUEST_URL; |
| 528 } | 530 } |
| 529 | 531 |
| 530 // Returns the routing ID of the RenderFrameImpl or RenderFrameProxy | |
| 531 // associated with |web_frame|. | |
| 532 int GetRoutingIdForFrameOrProxy(WebFrame* web_frame) { | |
| 533 if (!web_frame) | |
| 534 return MSG_ROUTING_NONE; | |
| 535 if (web_frame->isWebRemoteFrame()) | |
| 536 return RenderFrameProxy::FromWebFrame(web_frame)->routing_id(); | |
| 537 return RenderFrameImpl::FromWebFrame(web_frame)->GetRoutingID(); | |
| 538 } | |
| 539 | |
| 540 RenderFrameImpl::CreateRenderFrameImplFunction g_create_render_frame_impl = | 532 RenderFrameImpl::CreateRenderFrameImplFunction g_create_render_frame_impl = |
| 541 nullptr; | 533 nullptr; |
| 542 | 534 |
| 543 void OnGotContentHandlerID(uint32_t content_handler_id) {} | 535 void OnGotContentHandlerID(uint32_t content_handler_id) {} |
| 544 | 536 |
| 545 } // namespace | 537 } // namespace |
| 546 | 538 |
| 547 // static | 539 // static |
| 548 RenderFrameImpl* RenderFrameImpl::Create(RenderViewImpl* render_view, | 540 RenderFrameImpl* RenderFrameImpl::Create(RenderViewImpl* render_view, |
| 549 int32 routing_id) { | 541 int32 routing_id) { |
| (...skipping 4008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4558 ShouldMakeNetworkRequestForURL(url)) { | 4550 ShouldMakeNetworkRequestForURL(url)) { |
| 4559 BeginNavigation(&info.urlRequest); | 4551 BeginNavigation(&info.urlRequest); |
| 4560 return blink::WebNavigationPolicyIgnore; | 4552 return blink::WebNavigationPolicyIgnore; |
| 4561 } | 4553 } |
| 4562 | 4554 |
| 4563 return info.defaultPolicy; | 4555 return info.defaultPolicy; |
| 4564 } | 4556 } |
| 4565 | 4557 |
| 4566 void RenderFrameImpl::OnGetSavableResourceLinks() { | 4558 void RenderFrameImpl::OnGetSavableResourceLinks() { |
| 4567 std::vector<GURL> resources_list; | 4559 std::vector<GURL> resources_list; |
| 4568 std::vector<GURL> subframe_original_urls; | 4560 std::vector<SavableSubframe> subframes; |
| 4569 std::vector<blink::WebFrame*> subframes; | 4561 SavableResourcesResult result(&resources_list, &subframes); |
| 4570 SavableResourcesResult result(&resources_list, | |
| 4571 &subframe_original_urls, &subframes); | |
| 4572 | 4562 |
| 4573 if (!GetSavableResourceLinksForFrame( | 4563 if (!GetSavableResourceLinksForFrame( |
| 4574 frame_, &result, const_cast<const char**>(GetSavableSchemes()))) { | 4564 frame_, &result, const_cast<const char**>(GetSavableSchemes()))) { |
| 4575 Send(new FrameHostMsg_SavableResourceLinksError(routing_id_)); | 4565 Send(new FrameHostMsg_SavableResourceLinksError(routing_id_)); |
| 4576 return; | 4566 return; |
| 4577 } | 4567 } |
| 4578 | 4568 |
| 4579 Referrer referrer = | 4569 Referrer referrer = |
| 4580 Referrer(frame_->document().url(), frame_->document().referrerPolicy()); | 4570 Referrer(frame_->document().url(), frame_->document().referrerPolicy()); |
| 4581 | 4571 |
| 4582 std::vector<int> subframe_routing_ids; | |
| 4583 for (WebFrame* subframe : subframes) { | |
| 4584 subframe_routing_ids.push_back(GetRoutingIdForFrameOrProxy(subframe)); | |
| 4585 } | |
| 4586 | |
| 4587 DCHECK_EQ(subframe_original_urls.size(), subframe_routing_ids.size()); | |
| 4588 Send(new FrameHostMsg_SavableResourceLinksResponse( | 4572 Send(new FrameHostMsg_SavableResourceLinksResponse( |
| 4589 routing_id_, resources_list, referrer, | 4573 routing_id_, resources_list, referrer, subframes)); |
| 4590 subframe_original_urls, subframe_routing_ids)); | |
| 4591 } | 4574 } |
| 4592 | 4575 |
| 4593 void RenderFrameImpl::OnGetSerializedHtmlWithLocalLinks( | 4576 void RenderFrameImpl::OnGetSerializedHtmlWithLocalLinks( |
| 4594 std::vector<GURL> original_urls, | 4577 std::vector<GURL> original_urls, |
| 4595 std::vector<base::FilePath> equivalent_local_paths, | 4578 std::vector<base::FilePath> equivalent_local_paths, |
| 4596 base::FilePath local_directory_path) { | 4579 base::FilePath local_directory_path) { |
| 4597 // Only DCHECK, since the message comes from the trusted browser process. | 4580 // Only DCHECK, since the message comes from the trusted browser process. |
| 4598 DCHECK(original_urls.size() == equivalent_local_paths.size()); | 4581 DCHECK(original_urls.size() == equivalent_local_paths.size()); |
| 4599 | 4582 |
| 4600 // Convert std::vector of GURLs to WebVector<WebURL> | 4583 // Convert std::vector of GURLs to WebVector<WebURL> |
| (...skipping 720 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5321 mojo::ServiceProviderPtr service_provider; | 5304 mojo::ServiceProviderPtr service_provider; |
| 5322 mojo::URLRequestPtr request(mojo::URLRequest::New()); | 5305 mojo::URLRequestPtr request(mojo::URLRequest::New()); |
| 5323 request->url = mojo::String::From(url); | 5306 request->url = mojo::String::From(url); |
| 5324 mojo_shell_->ConnectToApplication(request.Pass(), GetProxy(&service_provider), | 5307 mojo_shell_->ConnectToApplication(request.Pass(), GetProxy(&service_provider), |
| 5325 nullptr, nullptr, | 5308 nullptr, nullptr, |
| 5326 base::Bind(&OnGotContentHandlerID)); | 5309 base::Bind(&OnGotContentHandlerID)); |
| 5327 return service_provider.Pass(); | 5310 return service_provider.Pass(); |
| 5328 } | 5311 } |
| 5329 | 5312 |
| 5330 } // namespace content | 5313 } // namespace content |
| OLD | NEW |