| 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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 #include "media/base/media_switches.h" | 138 #include "media/base/media_switches.h" |
| 139 #include "media/blink/url_index.h" | 139 #include "media/blink/url_index.h" |
| 140 #include "media/blink/webencryptedmediaclient_impl.h" | 140 #include "media/blink/webencryptedmediaclient_impl.h" |
| 141 #include "media/blink/webmediaplayer_impl.h" | 141 #include "media/blink/webmediaplayer_impl.h" |
| 142 #include "media/renderers/gpu_video_accelerator_factories.h" | 142 #include "media/renderers/gpu_video_accelerator_factories.h" |
| 143 #include "mojo/common/url_type_converters.h" | 143 #include "mojo/common/url_type_converters.h" |
| 144 #include "net/base/data_url.h" | 144 #include "net/base/data_url.h" |
| 145 #include "net/base/net_errors.h" | 145 #include "net/base/net_errors.h" |
| 146 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" | 146 #include "net/base/registry_controlled_domains/registry_controlled_domain.h" |
| 147 #include "net/http/http_util.h" | 147 #include "net/http/http_util.h" |
| 148 #include "third_party/WebKit/public/platform/URLConversion.h" |
| 148 #include "third_party/WebKit/public/platform/WebData.h" | 149 #include "third_party/WebKit/public/platform/WebData.h" |
| 149 #include "third_party/WebKit/public/platform/WebStorageQuotaCallbacks.h" | 150 #include "third_party/WebKit/public/platform/WebStorageQuotaCallbacks.h" |
| 150 #include "third_party/WebKit/public/platform/WebString.h" | 151 #include "third_party/WebKit/public/platform/WebString.h" |
| 151 #include "third_party/WebKit/public/platform/WebURL.h" | 152 #include "third_party/WebKit/public/platform/WebURL.h" |
| 152 #include "third_party/WebKit/public/platform/WebURLError.h" | 153 #include "third_party/WebKit/public/platform/WebURLError.h" |
| 153 #include "third_party/WebKit/public/platform/WebURLResponse.h" | 154 #include "third_party/WebKit/public/platform/WebURLResponse.h" |
| 154 #include "third_party/WebKit/public/platform/WebVector.h" | 155 #include "third_party/WebKit/public/platform/WebVector.h" |
| 155 #include "third_party/WebKit/public/platform/modules/webusb/WebUSBClient.h" | 156 #include "third_party/WebKit/public/platform/modules/webusb/WebUSBClient.h" |
| 156 #include "third_party/WebKit/public/web/WebColorSuggestion.h" | 157 #include "third_party/WebKit/public/web/WebColorSuggestion.h" |
| 157 #include "third_party/WebKit/public/web/WebDocument.h" | 158 #include "third_party/WebKit/public/web/WebDocument.h" |
| (...skipping 2142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2300 ->CreateBrowserPluginDelegate(this, kBrowserPluginMimeType, | 2301 ->CreateBrowserPluginDelegate(this, kBrowserPluginMimeType, |
| 2301 GURL(params.url)) | 2302 GURL(params.url)) |
| 2302 ->GetWeakPtr()); | 2303 ->GetWeakPtr()); |
| 2303 } | 2304 } |
| 2304 | 2305 |
| 2305 #if defined(ENABLE_PLUGINS) | 2306 #if defined(ENABLE_PLUGINS) |
| 2306 WebPluginInfo info; | 2307 WebPluginInfo info; |
| 2307 std::string mime_type; | 2308 std::string mime_type; |
| 2308 bool found = false; | 2309 bool found = false; |
| 2309 WebString top_origin = frame->top()->securityOrigin().toString(); | 2310 WebString top_origin = frame->top()->securityOrigin().toString(); |
| 2310 Send(new FrameHostMsg_GetPluginInfo(routing_id_, params.url, GURL(top_origin), | 2311 Send(new FrameHostMsg_GetPluginInfo(routing_id_, params.url, |
| 2312 blink::WebStringToGURL(top_origin), |
| 2311 params.mimeType.utf8(), &found, &info, | 2313 params.mimeType.utf8(), &found, &info, |
| 2312 &mime_type)); | 2314 &mime_type)); |
| 2313 if (!found) | 2315 if (!found) |
| 2314 return NULL; | 2316 return NULL; |
| 2315 | 2317 |
| 2316 WebPluginParams params_to_use = params; | 2318 WebPluginParams params_to_use = params; |
| 2317 params_to_use.mimeType = WebString::fromUTF8(mime_type); | 2319 params_to_use.mimeType = WebString::fromUTF8(mime_type); |
| 2318 return CreatePlugin(frame, info, params_to_use, nullptr /* throttler */); | 2320 return CreatePlugin(frame, info, params_to_use, nullptr /* throttler */); |
| 2319 #else | 2321 #else |
| 2320 return NULL; | 2322 return NULL; |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2826 // DocumentState::referred_by_prefetcher_ is true if we are | 2828 // DocumentState::referred_by_prefetcher_ is true if we are |
| 2827 // navigating from a page that used prefetching using a link on that | 2829 // navigating from a page that used prefetching using a link on that |
| 2828 // page. We are early enough in the request process here that we | 2830 // page. We are early enough in the request process here that we |
| 2829 // can still see the DocumentState of the previous page and set | 2831 // can still see the DocumentState of the previous page and set |
| 2830 // this value appropriately. | 2832 // this value appropriately. |
| 2831 // TODO(gavinp): catch the important case of navigation in a new | 2833 // TODO(gavinp): catch the important case of navigation in a new |
| 2832 // renderer process. | 2834 // renderer process. |
| 2833 if (webview) { | 2835 if (webview) { |
| 2834 if (WebFrame* old_frame = webview->mainFrame()) { | 2836 if (WebFrame* old_frame = webview->mainFrame()) { |
| 2835 const WebURLRequest& original_request = datasource->originalRequest(); | 2837 const WebURLRequest& original_request = datasource->originalRequest(); |
| 2836 const GURL referrer( | 2838 const GURL referrer(blink::WebStringToGURL( |
| 2837 original_request.httpHeaderField(WebString::fromUTF8("Referer"))); | 2839 original_request.httpHeaderField(WebString::fromUTF8("Referer")))); |
| 2838 if (!referrer.is_empty() && old_frame->isWebLocalFrame() && | 2840 if (!referrer.is_empty() && old_frame->isWebLocalFrame() && |
| 2839 DocumentState::FromDataSource(old_frame->dataSource()) | 2841 DocumentState::FromDataSource(old_frame->dataSource()) |
| 2840 ->was_prefetcher()) { | 2842 ->was_prefetcher()) { |
| 2841 for (; old_frame; old_frame = old_frame->traverseNext(false)) { | 2843 for (; old_frame; old_frame = old_frame->traverseNext(false)) { |
| 2842 WebDataSource* old_frame_datasource = old_frame->dataSource(); | 2844 WebDataSource* old_frame_datasource = old_frame->dataSource(); |
| 2843 if (old_frame_datasource && | 2845 if (old_frame_datasource && |
| 2844 referrer == GURL(old_frame_datasource->request().url())) { | 2846 referrer == GURL(old_frame_datasource->request().url())) { |
| 2845 document_state->set_was_referred_by_prefetcher(true); | 2847 document_state->set_was_referred_by_prefetcher(true); |
| 2846 break; | 2848 break; |
| 2847 } | 2849 } |
| (...skipping 847 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3695 WebFrame* parent = frame->parent(); | 3697 WebFrame* parent = frame->parent(); |
| 3696 int parent_routing_id = parent ? GetRoutingIdForFrameOrProxy(parent) : -1; | 3698 int parent_routing_id = parent ? GetRoutingIdForFrameOrProxy(parent) : -1; |
| 3697 | 3699 |
| 3698 RequestExtraData* extra_data = new RequestExtraData(); | 3700 RequestExtraData* extra_data = new RequestExtraData(); |
| 3699 extra_data->set_visibility_state(render_view_->visibilityState()); | 3701 extra_data->set_visibility_state(render_view_->visibilityState()); |
| 3700 extra_data->set_custom_user_agent(custom_user_agent); | 3702 extra_data->set_custom_user_agent(custom_user_agent); |
| 3701 extra_data->set_requested_with(requested_with); | 3703 extra_data->set_requested_with(requested_with); |
| 3702 extra_data->set_render_frame_id(routing_id_); | 3704 extra_data->set_render_frame_id(routing_id_); |
| 3703 extra_data->set_is_main_frame(!parent); | 3705 extra_data->set_is_main_frame(!parent); |
| 3704 extra_data->set_frame_origin( | 3706 extra_data->set_frame_origin( |
| 3705 GURL(frame->document().securityOrigin().toString())); | 3707 blink::WebStringToGURL(frame->document().securityOrigin().toString())); |
| 3706 extra_data->set_parent_is_main_frame(parent && !parent->parent()); | 3708 extra_data->set_parent_is_main_frame(parent && !parent->parent()); |
| 3707 extra_data->set_parent_render_frame_id(parent_routing_id); | 3709 extra_data->set_parent_render_frame_id(parent_routing_id); |
| 3708 extra_data->set_allow_download( | 3710 extra_data->set_allow_download( |
| 3709 navigation_state->common_params().allow_download); | 3711 navigation_state->common_params().allow_download); |
| 3710 extra_data->set_transition_type(transition_type); | 3712 extra_data->set_transition_type(transition_type); |
| 3711 extra_data->set_should_replace_current_entry(should_replace_current_entry); | 3713 extra_data->set_should_replace_current_entry(should_replace_current_entry); |
| 3712 extra_data->set_transferred_request_child_id( | 3714 extra_data->set_transferred_request_child_id( |
| 3713 navigation_state->start_params().transferred_request_child_id); | 3715 navigation_state->start_params().transferred_request_child_id); |
| 3714 extra_data->set_transferred_request_request_id( | 3716 extra_data->set_transferred_request_request_id( |
| 3715 navigation_state->start_params().transferred_request_request_id); | 3717 navigation_state->start_params().transferred_request_request_id); |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3938 blink::WebStorageQuotaCallbacks callbacks) { | 3940 blink::WebStorageQuotaCallbacks callbacks) { |
| 3939 DCHECK(!frame_ || frame_ == frame); | 3941 DCHECK(!frame_ || frame_ == frame); |
| 3940 WebSecurityOrigin origin = frame->document().securityOrigin(); | 3942 WebSecurityOrigin origin = frame->document().securityOrigin(); |
| 3941 if (origin.isUnique()) { | 3943 if (origin.isUnique()) { |
| 3942 // Unique origins cannot store persistent state. | 3944 // Unique origins cannot store persistent state. |
| 3943 callbacks.didFail(blink::WebStorageQuotaErrorAbort); | 3945 callbacks.didFail(blink::WebStorageQuotaErrorAbort); |
| 3944 return; | 3946 return; |
| 3945 } | 3947 } |
| 3946 ChildThreadImpl::current()->quota_dispatcher()->RequestStorageQuota( | 3948 ChildThreadImpl::current()->quota_dispatcher()->RequestStorageQuota( |
| 3947 render_view_->GetRoutingID(), | 3949 render_view_->GetRoutingID(), |
| 3948 GURL(origin.toString()), | 3950 blink::WebStringToGURL(origin.toString()), |
| 3949 static_cast<storage::StorageType>(type), | 3951 static_cast<storage::StorageType>(type), |
| 3950 requested_size, | 3952 requested_size, |
| 3951 QuotaDispatcher::CreateWebStorageQuotaCallbacksWrapper(callbacks)); | 3953 QuotaDispatcher::CreateWebStorageQuotaCallbacksWrapper(callbacks)); |
| 3952 } | 3954 } |
| 3953 | 3955 |
| 3954 void RenderFrameImpl::willOpenWebSocket(blink::WebSocketHandle* handle) { | 3956 void RenderFrameImpl::willOpenWebSocket(blink::WebSocketHandle* handle) { |
| 3955 WebSocketBridge* impl = static_cast<WebSocketBridge*>(handle); | 3957 WebSocketBridge* impl = static_cast<WebSocketBridge*>(handle); |
| 3956 impl->set_render_frame_id(routing_id_); | 3958 impl->set_render_frame_id(routing_id_); |
| 3957 } | 3959 } |
| 3958 | 3960 |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4092 | 4094 |
| 4093 bool RenderFrameImpl::allowWebGL(blink::WebLocalFrame* frame, | 4095 bool RenderFrameImpl::allowWebGL(blink::WebLocalFrame* frame, |
| 4094 bool default_value) { | 4096 bool default_value) { |
| 4095 DCHECK(!frame_ || frame_ == frame); | 4097 DCHECK(!frame_ || frame_ == frame); |
| 4096 if (!default_value) | 4098 if (!default_value) |
| 4097 return false; | 4099 return false; |
| 4098 | 4100 |
| 4099 bool blocked = true; | 4101 bool blocked = true; |
| 4100 Send(new FrameHostMsg_Are3DAPIsBlocked( | 4102 Send(new FrameHostMsg_Are3DAPIsBlocked( |
| 4101 routing_id_, | 4103 routing_id_, |
| 4102 GURL(frame->top()->securityOrigin().toString()), | 4104 blink::WebStringToGURL(frame->top()->securityOrigin().toString()), |
| 4103 THREE_D_API_TYPE_WEBGL, | 4105 THREE_D_API_TYPE_WEBGL, |
| 4104 &blocked)); | 4106 &blocked)); |
| 4105 return !blocked; | 4107 return !blocked; |
| 4106 } | 4108 } |
| 4107 | 4109 |
| 4108 void RenderFrameImpl::didLoseWebGLContext(blink::WebLocalFrame* frame, | 4110 void RenderFrameImpl::didLoseWebGLContext(blink::WebLocalFrame* frame, |
| 4109 int arb_robustness_status_code) { | 4111 int arb_robustness_status_code) { |
| 4110 DCHECK(!frame_ || frame_ == frame); | 4112 DCHECK(!frame_ || frame_ == frame); |
| 4111 Send(new FrameHostMsg_DidLose3DContext( | 4113 Send(new FrameHostMsg_DidLose3DContext( |
| 4112 GURL(frame->top()->securityOrigin().toString()), | 4114 blink::WebStringToGURL(frame->top()->securityOrigin().toString()), |
| 4113 THREE_D_API_TYPE_WEBGL, | 4115 THREE_D_API_TYPE_WEBGL, |
| 4114 arb_robustness_status_code)); | 4116 arb_robustness_status_code)); |
| 4115 } | 4117 } |
| 4116 | 4118 |
| 4117 blink::WebScreenOrientationClient* | 4119 blink::WebScreenOrientationClient* |
| 4118 RenderFrameImpl::webScreenOrientationClient() { | 4120 RenderFrameImpl::webScreenOrientationClient() { |
| 4119 if (!screen_orientation_dispatcher_) | 4121 if (!screen_orientation_dispatcher_) |
| 4120 screen_orientation_dispatcher_ = new ScreenOrientationDispatcher(this); | 4122 screen_orientation_dispatcher_ = new ScreenOrientationDispatcher(this); |
| 4121 return screen_orientation_dispatcher_; | 4123 return screen_orientation_dispatcher_; |
| 4122 } | 4124 } |
| (...skipping 1595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5718 media::ConvertToSwitchOutputDeviceCB(web_callbacks); | 5720 media::ConvertToSwitchOutputDeviceCB(web_callbacks); |
| 5719 scoped_refptr<media::AudioOutputDevice> device = | 5721 scoped_refptr<media::AudioOutputDevice> device = |
| 5720 AudioDeviceFactory::NewOutputDevice(routing_id_, 0, sink_id.utf8(), | 5722 AudioDeviceFactory::NewOutputDevice(routing_id_, 0, sink_id.utf8(), |
| 5721 security_origin); | 5723 security_origin); |
| 5722 media::OutputDeviceStatus status = device->GetDeviceStatus(); | 5724 media::OutputDeviceStatus status = device->GetDeviceStatus(); |
| 5723 device->Stop(); | 5725 device->Stop(); |
| 5724 callback.Run(status); | 5726 callback.Run(status); |
| 5725 } | 5727 } |
| 5726 | 5728 |
| 5727 } // namespace content | 5729 } // namespace content |
| OLD | NEW |