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 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 #include "content/common/frame_messages.h" | 50 #include "content/common/frame_messages.h" |
51 #include "content/common/frame_replication_state.h" | 51 #include "content/common/frame_replication_state.h" |
52 #include "content/common/input_messages.h" | 52 #include "content/common/input_messages.h" |
53 #include "content/common/navigation_params.h" | 53 #include "content/common/navigation_params.h" |
54 #include "content/common/savable_subframe.h" | 54 #include "content/common/savable_subframe.h" |
55 #include "content/common/service_worker/service_worker_types.h" | 55 #include "content/common/service_worker/service_worker_types.h" |
56 #include "content/common/site_isolation_policy.h" | 56 #include "content/common/site_isolation_policy.h" |
57 #include "content/common/ssl_status_serialization.h" | 57 #include "content/common/ssl_status_serialization.h" |
58 #include "content/common/swapped_out_messages.h" | 58 #include "content/common/swapped_out_messages.h" |
59 #include "content/common/view_messages.h" | 59 #include "content/common/view_messages.h" |
| 60 #include "content/public/child/url_conversion.h" |
60 #include "content/public/common/bindings_policy.h" | 61 #include "content/public/common/bindings_policy.h" |
61 #include "content/public/common/browser_side_navigation_policy.h" | 62 #include "content/public/common/browser_side_navigation_policy.h" |
62 #include "content/public/common/content_constants.h" | 63 #include "content/public/common/content_constants.h" |
63 #include "content/public/common/content_switches.h" | 64 #include "content/public/common/content_switches.h" |
64 #include "content/public/common/context_menu_params.h" | 65 #include "content/public/common/context_menu_params.h" |
65 #include "content/public/common/isolated_world_ids.h" | 66 #include "content/public/common/isolated_world_ids.h" |
66 #include "content/public/common/page_state.h" | 67 #include "content/public/common/page_state.h" |
67 #include "content/public/common/resource_response.h" | 68 #include "content/public/common/resource_response.h" |
68 #include "content/public/common/url_constants.h" | 69 #include "content/public/common/url_constants.h" |
69 #include "content/public/common/url_utils.h" | 70 #include "content/public/common/url_utils.h" |
(...skipping 2229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2299 ->CreateBrowserPluginDelegate(this, kBrowserPluginMimeType, | 2300 ->CreateBrowserPluginDelegate(this, kBrowserPluginMimeType, |
2300 GURL(params.url)) | 2301 GURL(params.url)) |
2301 ->GetWeakPtr()); | 2302 ->GetWeakPtr()); |
2302 } | 2303 } |
2303 | 2304 |
2304 #if defined(ENABLE_PLUGINS) | 2305 #if defined(ENABLE_PLUGINS) |
2305 WebPluginInfo info; | 2306 WebPluginInfo info; |
2306 std::string mime_type; | 2307 std::string mime_type; |
2307 bool found = false; | 2308 bool found = false; |
2308 WebString top_origin = frame->top()->securityOrigin().toString(); | 2309 WebString top_origin = frame->top()->securityOrigin().toString(); |
2309 Send(new FrameHostMsg_GetPluginInfo(routing_id_, params.url, GURL(top_origin), | 2310 Send(new FrameHostMsg_GetPluginInfo(routing_id_, params.url, |
| 2311 WebStringToGURL(top_origin), |
2310 params.mimeType.utf8(), &found, &info, | 2312 params.mimeType.utf8(), &found, &info, |
2311 &mime_type)); | 2313 &mime_type)); |
2312 if (!found) | 2314 if (!found) |
2313 return NULL; | 2315 return NULL; |
2314 | 2316 |
2315 WebPluginParams params_to_use = params; | 2317 WebPluginParams params_to_use = params; |
2316 params_to_use.mimeType = WebString::fromUTF8(mime_type); | 2318 params_to_use.mimeType = WebString::fromUTF8(mime_type); |
2317 return CreatePlugin(frame, info, params_to_use, nullptr /* throttler */); | 2319 return CreatePlugin(frame, info, params_to_use, nullptr /* throttler */); |
2318 #else | 2320 #else |
2319 return NULL; | 2321 return NULL; |
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2809 // DocumentState::referred_by_prefetcher_ is true if we are | 2811 // DocumentState::referred_by_prefetcher_ is true if we are |
2810 // navigating from a page that used prefetching using a link on that | 2812 // navigating from a page that used prefetching using a link on that |
2811 // page. We are early enough in the request process here that we | 2813 // page. We are early enough in the request process here that we |
2812 // can still see the DocumentState of the previous page and set | 2814 // can still see the DocumentState of the previous page and set |
2813 // this value appropriately. | 2815 // this value appropriately. |
2814 // TODO(gavinp): catch the important case of navigation in a new | 2816 // TODO(gavinp): catch the important case of navigation in a new |
2815 // renderer process. | 2817 // renderer process. |
2816 if (webview) { | 2818 if (webview) { |
2817 if (WebFrame* old_frame = webview->mainFrame()) { | 2819 if (WebFrame* old_frame = webview->mainFrame()) { |
2818 const WebURLRequest& original_request = datasource->originalRequest(); | 2820 const WebURLRequest& original_request = datasource->originalRequest(); |
2819 const GURL referrer( | 2821 const GURL referrer(WebStringToGURL( |
2820 original_request.httpHeaderField(WebString::fromUTF8("Referer"))); | 2822 original_request.httpHeaderField(WebString::fromUTF8("Referer")))); |
2821 if (!referrer.is_empty() && old_frame->isWebLocalFrame() && | 2823 if (!referrer.is_empty() && old_frame->isWebLocalFrame() && |
2822 DocumentState::FromDataSource(old_frame->dataSource()) | 2824 DocumentState::FromDataSource(old_frame->dataSource()) |
2823 ->was_prefetcher()) { | 2825 ->was_prefetcher()) { |
2824 for (; old_frame; old_frame = old_frame->traverseNext(false)) { | 2826 for (; old_frame; old_frame = old_frame->traverseNext(false)) { |
2825 WebDataSource* old_frame_datasource = old_frame->dataSource(); | 2827 WebDataSource* old_frame_datasource = old_frame->dataSource(); |
2826 if (old_frame_datasource && | 2828 if (old_frame_datasource && |
2827 referrer == GURL(old_frame_datasource->request().url())) { | 2829 referrer == GURL(old_frame_datasource->request().url())) { |
2828 document_state->set_was_referred_by_prefetcher(true); | 2830 document_state->set_was_referred_by_prefetcher(true); |
2829 break; | 2831 break; |
2830 } | 2832 } |
(...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3678 WebFrame* parent = frame->parent(); | 3680 WebFrame* parent = frame->parent(); |
3679 int parent_routing_id = parent ? GetRoutingIdForFrameOrProxy(parent) : -1; | 3681 int parent_routing_id = parent ? GetRoutingIdForFrameOrProxy(parent) : -1; |
3680 | 3682 |
3681 RequestExtraData* extra_data = new RequestExtraData(); | 3683 RequestExtraData* extra_data = new RequestExtraData(); |
3682 extra_data->set_visibility_state(render_view_->visibilityState()); | 3684 extra_data->set_visibility_state(render_view_->visibilityState()); |
3683 extra_data->set_custom_user_agent(custom_user_agent); | 3685 extra_data->set_custom_user_agent(custom_user_agent); |
3684 extra_data->set_requested_with(requested_with); | 3686 extra_data->set_requested_with(requested_with); |
3685 extra_data->set_render_frame_id(routing_id_); | 3687 extra_data->set_render_frame_id(routing_id_); |
3686 extra_data->set_is_main_frame(!parent); | 3688 extra_data->set_is_main_frame(!parent); |
3687 extra_data->set_frame_origin( | 3689 extra_data->set_frame_origin( |
3688 GURL(frame->document().securityOrigin().toString())); | 3690 WebStringToGURL(frame->document().securityOrigin().toString())); |
3689 extra_data->set_parent_is_main_frame(parent && !parent->parent()); | 3691 extra_data->set_parent_is_main_frame(parent && !parent->parent()); |
3690 extra_data->set_parent_render_frame_id(parent_routing_id); | 3692 extra_data->set_parent_render_frame_id(parent_routing_id); |
3691 extra_data->set_allow_download( | 3693 extra_data->set_allow_download( |
3692 navigation_state->common_params().allow_download); | 3694 navigation_state->common_params().allow_download); |
3693 extra_data->set_transition_type(transition_type); | 3695 extra_data->set_transition_type(transition_type); |
3694 extra_data->set_should_replace_current_entry(should_replace_current_entry); | 3696 extra_data->set_should_replace_current_entry(should_replace_current_entry); |
3695 extra_data->set_transferred_request_child_id( | 3697 extra_data->set_transferred_request_child_id( |
3696 navigation_state->start_params().transferred_request_child_id); | 3698 navigation_state->start_params().transferred_request_child_id); |
3697 extra_data->set_transferred_request_request_id( | 3699 extra_data->set_transferred_request_request_id( |
3698 navigation_state->start_params().transferred_request_request_id); | 3700 navigation_state->start_params().transferred_request_request_id); |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3921 blink::WebStorageQuotaCallbacks callbacks) { | 3923 blink::WebStorageQuotaCallbacks callbacks) { |
3922 DCHECK(!frame_ || frame_ == frame); | 3924 DCHECK(!frame_ || frame_ == frame); |
3923 WebSecurityOrigin origin = frame->document().securityOrigin(); | 3925 WebSecurityOrigin origin = frame->document().securityOrigin(); |
3924 if (origin.isUnique()) { | 3926 if (origin.isUnique()) { |
3925 // Unique origins cannot store persistent state. | 3927 // Unique origins cannot store persistent state. |
3926 callbacks.didFail(blink::WebStorageQuotaErrorAbort); | 3928 callbacks.didFail(blink::WebStorageQuotaErrorAbort); |
3927 return; | 3929 return; |
3928 } | 3930 } |
3929 ChildThreadImpl::current()->quota_dispatcher()->RequestStorageQuota( | 3931 ChildThreadImpl::current()->quota_dispatcher()->RequestStorageQuota( |
3930 render_view_->GetRoutingID(), | 3932 render_view_->GetRoutingID(), |
3931 GURL(origin.toString()), | 3933 WebStringToGURL(origin.toString()), |
3932 static_cast<storage::StorageType>(type), | 3934 static_cast<storage::StorageType>(type), |
3933 requested_size, | 3935 requested_size, |
3934 QuotaDispatcher::CreateWebStorageQuotaCallbacksWrapper(callbacks)); | 3936 QuotaDispatcher::CreateWebStorageQuotaCallbacksWrapper(callbacks)); |
3935 } | 3937 } |
3936 | 3938 |
3937 void RenderFrameImpl::willOpenWebSocket(blink::WebSocketHandle* handle) { | 3939 void RenderFrameImpl::willOpenWebSocket(blink::WebSocketHandle* handle) { |
3938 WebSocketBridge* impl = static_cast<WebSocketBridge*>(handle); | 3940 WebSocketBridge* impl = static_cast<WebSocketBridge*>(handle); |
3939 impl->set_render_frame_id(routing_id_); | 3941 impl->set_render_frame_id(routing_id_); |
3940 } | 3942 } |
3941 | 3943 |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4075 | 4077 |
4076 bool RenderFrameImpl::allowWebGL(blink::WebLocalFrame* frame, | 4078 bool RenderFrameImpl::allowWebGL(blink::WebLocalFrame* frame, |
4077 bool default_value) { | 4079 bool default_value) { |
4078 DCHECK(!frame_ || frame_ == frame); | 4080 DCHECK(!frame_ || frame_ == frame); |
4079 if (!default_value) | 4081 if (!default_value) |
4080 return false; | 4082 return false; |
4081 | 4083 |
4082 bool blocked = true; | 4084 bool blocked = true; |
4083 Send(new FrameHostMsg_Are3DAPIsBlocked( | 4085 Send(new FrameHostMsg_Are3DAPIsBlocked( |
4084 routing_id_, | 4086 routing_id_, |
4085 GURL(frame->top()->securityOrigin().toString()), | 4087 WebStringToGURL(frame->top()->securityOrigin().toString()), |
4086 THREE_D_API_TYPE_WEBGL, | 4088 THREE_D_API_TYPE_WEBGL, |
4087 &blocked)); | 4089 &blocked)); |
4088 return !blocked; | 4090 return !blocked; |
4089 } | 4091 } |
4090 | 4092 |
4091 void RenderFrameImpl::didLoseWebGLContext(blink::WebLocalFrame* frame, | 4093 void RenderFrameImpl::didLoseWebGLContext(blink::WebLocalFrame* frame, |
4092 int arb_robustness_status_code) { | 4094 int arb_robustness_status_code) { |
4093 DCHECK(!frame_ || frame_ == frame); | 4095 DCHECK(!frame_ || frame_ == frame); |
4094 Send(new FrameHostMsg_DidLose3DContext( | 4096 Send(new FrameHostMsg_DidLose3DContext( |
4095 GURL(frame->top()->securityOrigin().toString()), | 4097 WebStringToGURL(frame->top()->securityOrigin().toString()), |
4096 THREE_D_API_TYPE_WEBGL, | 4098 THREE_D_API_TYPE_WEBGL, |
4097 arb_robustness_status_code)); | 4099 arb_robustness_status_code)); |
4098 } | 4100 } |
4099 | 4101 |
4100 blink::WebScreenOrientationClient* | 4102 blink::WebScreenOrientationClient* |
4101 RenderFrameImpl::webScreenOrientationClient() { | 4103 RenderFrameImpl::webScreenOrientationClient() { |
4102 if (!screen_orientation_dispatcher_) | 4104 if (!screen_orientation_dispatcher_) |
4103 screen_orientation_dispatcher_ = new ScreenOrientationDispatcher(this); | 4105 screen_orientation_dispatcher_ = new ScreenOrientationDispatcher(this); |
4104 return screen_orientation_dispatcher_; | 4106 return screen_orientation_dispatcher_; |
4105 } | 4107 } |
(...skipping 1583 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5689 media::ConvertToSwitchOutputDeviceCB(web_callbacks); | 5691 media::ConvertToSwitchOutputDeviceCB(web_callbacks); |
5690 scoped_refptr<media::AudioOutputDevice> device = | 5692 scoped_refptr<media::AudioOutputDevice> device = |
5691 AudioDeviceFactory::NewOutputDevice(routing_id_, 0, sink_id.utf8(), | 5693 AudioDeviceFactory::NewOutputDevice(routing_id_, 0, sink_id.utf8(), |
5692 security_origin); | 5694 security_origin); |
5693 media::OutputDeviceStatus status = device->GetDeviceStatus(); | 5695 media::OutputDeviceStatus status = device->GetDeviceStatus(); |
5694 device->Stop(); | 5696 device->Stop(); |
5695 callback.Run(status); | 5697 callback.Run(status); |
5696 } | 5698 } |
5697 | 5699 |
5698 } // namespace content | 5700 } // namespace content |
OLD | NEW |