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 2427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2438 ->renderer() | 2438 ->renderer() |
2439 ->CreateBrowserPluginDelegate(this, kBrowserPluginMimeType, | 2439 ->CreateBrowserPluginDelegate(this, kBrowserPluginMimeType, |
2440 GURL(params.url)) | 2440 GURL(params.url)) |
2441 ->GetWeakPtr()); | 2441 ->GetWeakPtr()); |
2442 } | 2442 } |
2443 | 2443 |
2444 #if defined(ENABLE_PLUGINS) | 2444 #if defined(ENABLE_PLUGINS) |
2445 WebPluginInfo info; | 2445 WebPluginInfo info; |
2446 std::string mime_type; | 2446 std::string mime_type; |
2447 bool found = false; | 2447 bool found = false; |
2448 WebString top_origin = frame->top()->securityOrigin().toString(); | 2448 WebString top_origin = frame->top()->getSecurityOrigin().toString(); |
2449 Send(new FrameHostMsg_GetPluginInfo(routing_id_, params.url, | 2449 Send(new FrameHostMsg_GetPluginInfo(routing_id_, params.url, |
2450 blink::WebStringToGURL(top_origin), | 2450 blink::WebStringToGURL(top_origin), |
2451 params.mimeType.utf8(), &found, &info, | 2451 params.mimeType.utf8(), &found, &info, |
2452 &mime_type)); | 2452 &mime_type)); |
2453 if (!found) | 2453 if (!found) |
2454 return NULL; | 2454 return NULL; |
2455 | 2455 |
2456 WebPluginParams params_to_use = params; | 2456 WebPluginParams params_to_use = params; |
2457 params_to_use.mimeType = WebString::fromUTF8(mime_type); | 2457 params_to_use.mimeType = WebString::fromUTF8(mime_type); |
2458 return CreatePlugin(frame, info, params_to_use, nullptr /* throttler */); | 2458 return CreatePlugin(frame, info, params_to_use, nullptr /* throttler */); |
(...skipping 14 matching lines...) Expand all Loading... |
2473 if (!contains_media_player_) { | 2473 if (!contains_media_player_) { |
2474 render_view_->RegisterVideoHoleFrame(this); | 2474 render_view_->RegisterVideoHoleFrame(this); |
2475 contains_media_player_ = true; | 2475 contains_media_player_ = true; |
2476 } | 2476 } |
2477 #endif // defined(VIDEO_HOLE) | 2477 #endif // defined(VIDEO_HOLE) |
2478 | 2478 |
2479 blink::WebMediaStream web_stream( | 2479 blink::WebMediaStream web_stream( |
2480 blink::WebMediaStreamRegistry::lookupMediaStreamDescriptor(url)); | 2480 blink::WebMediaStreamRegistry::lookupMediaStreamDescriptor(url)); |
2481 if (!web_stream.isNull()) | 2481 if (!web_stream.isNull()) |
2482 return CreateWebMediaPlayerForMediaStream(client, sink_id, | 2482 return CreateWebMediaPlayerForMediaStream(client, sink_id, |
2483 frame_->securityOrigin()); | 2483 frame_->getSecurityOrigin()); |
2484 | 2484 |
2485 RenderThreadImpl* render_thread = RenderThreadImpl::current(); | 2485 RenderThreadImpl* render_thread = RenderThreadImpl::current(); |
2486 | 2486 |
2487 scoped_refptr<media::RestartableAudioRendererSink> audio_renderer_sink = | 2487 scoped_refptr<media::RestartableAudioRendererSink> audio_renderer_sink = |
2488 AudioDeviceFactory::NewRestartableAudioRendererSink( | 2488 AudioDeviceFactory::NewRestartableAudioRendererSink( |
2489 AudioDeviceFactory::kSourceMediaElement, routing_id_, 0, | 2489 AudioDeviceFactory::kSourceMediaElement, routing_id_, 0, |
2490 sink_id.utf8(), frame_->securityOrigin()); | 2490 sink_id.utf8(), frame_->getSecurityOrigin()); |
2491 media::WebMediaPlayerParams::Context3DCB context_3d_cb = | 2491 media::WebMediaPlayerParams::Context3DCB context_3d_cb = |
2492 base::Bind(&GetSharedMainThreadContext3D); | 2492 base::Bind(&GetSharedMainThreadContext3D); |
2493 | 2493 |
2494 scoped_refptr<media::MediaLog> media_log(new RenderMediaLog()); | 2494 scoped_refptr<media::MediaLog> media_log(new RenderMediaLog()); |
2495 #if defined(OS_ANDROID) | 2495 #if defined(OS_ANDROID) |
2496 if (!media_surface_manager_) | 2496 if (!media_surface_manager_) |
2497 media_surface_manager_ = new RendererSurfaceViewManager(this); | 2497 media_surface_manager_ = new RendererSurfaceViewManager(this); |
2498 #endif | 2498 #endif |
2499 media::WebMediaPlayerParams params( | 2499 media::WebMediaPlayerParams params( |
2500 base::Bind(&ContentRendererClient::DeferMediaLoad, | 2500 base::Bind(&ContentRendererClient::DeferMediaLoad, |
(...skipping 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3711 // This is broken and should be fixed to propagate the first party. | 3711 // This is broken and should be fixed to propagate the first party. |
3712 WebFrame* top = frame->top(); | 3712 WebFrame* top = frame->top(); |
3713 if (top->isWebLocalFrame()) { | 3713 if (top->isWebLocalFrame()) { |
3714 request.setFirstPartyForCookies( | 3714 request.setFirstPartyForCookies( |
3715 frame->top()->document().firstPartyForCookies()); | 3715 frame->top()->document().firstPartyForCookies()); |
3716 } | 3716 } |
3717 } | 3717 } |
3718 | 3718 |
3719 // If we need to set the first party, then we need to set the request's | 3719 // If we need to set the first party, then we need to set the request's |
3720 // initiator as well; it will not be updated during redirects. | 3720 // initiator as well; it will not be updated during redirects. |
3721 request.setRequestorOrigin(frame->document().securityOrigin()); | 3721 request.setRequestorOrigin(frame->document().getSecurityOrigin()); |
3722 } | 3722 } |
3723 | 3723 |
3724 WebDataSource* provisional_data_source = frame->provisionalDataSource(); | 3724 WebDataSource* provisional_data_source = frame->provisionalDataSource(); |
3725 WebDataSource* data_source = | 3725 WebDataSource* data_source = |
3726 provisional_data_source ? provisional_data_source : frame->dataSource(); | 3726 provisional_data_source ? provisional_data_source : frame->dataSource(); |
3727 | 3727 |
3728 DocumentState* document_state = DocumentState::FromDataSource(data_source); | 3728 DocumentState* document_state = DocumentState::FromDataSource(data_source); |
3729 DCHECK(document_state); | 3729 DCHECK(document_state); |
3730 InternalDocumentStateData* internal_data = | 3730 InternalDocumentStateData* internal_data = |
3731 InternalDocumentStateData::FromDocumentState(document_state); | 3731 InternalDocumentStateData::FromDocumentState(document_state); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3838 WebFrame* parent = frame->parent(); | 3838 WebFrame* parent = frame->parent(); |
3839 int parent_routing_id = parent ? GetRoutingIdForFrameOrProxy(parent) : -1; | 3839 int parent_routing_id = parent ? GetRoutingIdForFrameOrProxy(parent) : -1; |
3840 | 3840 |
3841 RequestExtraData* extra_data = new RequestExtraData(); | 3841 RequestExtraData* extra_data = new RequestExtraData(); |
3842 extra_data->set_visibility_state(render_view_->visibilityState()); | 3842 extra_data->set_visibility_state(render_view_->visibilityState()); |
3843 extra_data->set_custom_user_agent(custom_user_agent); | 3843 extra_data->set_custom_user_agent(custom_user_agent); |
3844 extra_data->set_requested_with(requested_with); | 3844 extra_data->set_requested_with(requested_with); |
3845 extra_data->set_render_frame_id(routing_id_); | 3845 extra_data->set_render_frame_id(routing_id_); |
3846 extra_data->set_is_main_frame(!parent); | 3846 extra_data->set_is_main_frame(!parent); |
3847 extra_data->set_frame_origin( | 3847 extra_data->set_frame_origin( |
3848 blink::WebStringToGURL(frame->document().securityOrigin().toString())); | 3848 blink::WebStringToGURL(frame->document().getSecurityOrigin().toString())); |
3849 extra_data->set_parent_is_main_frame(parent && !parent->parent()); | 3849 extra_data->set_parent_is_main_frame(parent && !parent->parent()); |
3850 extra_data->set_parent_render_frame_id(parent_routing_id); | 3850 extra_data->set_parent_render_frame_id(parent_routing_id); |
3851 extra_data->set_allow_download( | 3851 extra_data->set_allow_download( |
3852 navigation_state->common_params().allow_download); | 3852 navigation_state->common_params().allow_download); |
3853 extra_data->set_transition_type(transition_type); | 3853 extra_data->set_transition_type(transition_type); |
3854 extra_data->set_should_replace_current_entry(should_replace_current_entry); | 3854 extra_data->set_should_replace_current_entry(should_replace_current_entry); |
3855 extra_data->set_transferred_request_child_id( | 3855 extra_data->set_transferred_request_child_id( |
3856 navigation_state->start_params().transferred_request_child_id); | 3856 navigation_state->start_params().transferred_request_child_id); |
3857 extra_data->set_transferred_request_request_id( | 3857 extra_data->set_transferred_request_request_id( |
3858 navigation_state->start_params().transferred_request_request_id); | 3858 navigation_state->start_params().transferred_request_request_id); |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4065 int active_match_ordinal, | 4065 int active_match_ordinal, |
4066 const blink::WebRect& selection_rect) { | 4066 const blink::WebRect& selection_rect) { |
4067 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, -1, selection_rect, | 4067 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, -1, selection_rect, |
4068 active_match_ordinal, false)); | 4068 active_match_ordinal, false)); |
4069 } | 4069 } |
4070 | 4070 |
4071 void RenderFrameImpl::requestStorageQuota( | 4071 void RenderFrameImpl::requestStorageQuota( |
4072 blink::WebStorageQuotaType type, | 4072 blink::WebStorageQuotaType type, |
4073 unsigned long long requested_size, | 4073 unsigned long long requested_size, |
4074 blink::WebStorageQuotaCallbacks callbacks) { | 4074 blink::WebStorageQuotaCallbacks callbacks) { |
4075 WebSecurityOrigin origin = frame_->document().securityOrigin(); | 4075 WebSecurityOrigin origin = frame_->document().getSecurityOrigin(); |
4076 if (origin.isUnique()) { | 4076 if (origin.isUnique()) { |
4077 // Unique origins cannot store persistent state. | 4077 // Unique origins cannot store persistent state. |
4078 callbacks.didFail(blink::WebStorageQuotaErrorAbort); | 4078 callbacks.didFail(blink::WebStorageQuotaErrorAbort); |
4079 return; | 4079 return; |
4080 } | 4080 } |
4081 ChildThreadImpl::current()->quota_dispatcher()->RequestStorageQuota( | 4081 ChildThreadImpl::current()->quota_dispatcher()->RequestStorageQuota( |
4082 render_view_->GetRoutingID(), | 4082 render_view_->GetRoutingID(), |
4083 blink::WebStringToGURL(origin.toString()), | 4083 blink::WebStringToGURL(origin.toString()), |
4084 static_cast<storage::StorageType>(type), | 4084 static_cast<storage::StorageType>(type), |
4085 requested_size, | 4085 requested_size, |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4220 return WebString(); | 4220 return WebString(); |
4221 } | 4221 } |
4222 | 4222 |
4223 bool RenderFrameImpl::allowWebGL(bool default_value) { | 4223 bool RenderFrameImpl::allowWebGL(bool default_value) { |
4224 if (!default_value) | 4224 if (!default_value) |
4225 return false; | 4225 return false; |
4226 | 4226 |
4227 bool blocked = true; | 4227 bool blocked = true; |
4228 Send(new FrameHostMsg_Are3DAPIsBlocked( | 4228 Send(new FrameHostMsg_Are3DAPIsBlocked( |
4229 routing_id_, | 4229 routing_id_, |
4230 blink::WebStringToGURL(frame_->top()->securityOrigin().toString()), | 4230 blink::WebStringToGURL(frame_->top()->getSecurityOrigin().toString()), |
4231 THREE_D_API_TYPE_WEBGL, | 4231 THREE_D_API_TYPE_WEBGL, &blocked)); |
4232 &blocked)); | |
4233 return !blocked; | 4232 return !blocked; |
4234 } | 4233 } |
4235 | 4234 |
4236 void RenderFrameImpl::didLoseWebGLContext(int arb_robustness_status_code) { | 4235 void RenderFrameImpl::didLoseWebGLContext(int arb_robustness_status_code) { |
4237 Send(new FrameHostMsg_DidLose3DContext( | 4236 Send(new FrameHostMsg_DidLose3DContext( |
4238 blink::WebStringToGURL(frame_->top()->securityOrigin().toString()), | 4237 blink::WebStringToGURL(frame_->top()->getSecurityOrigin().toString()), |
4239 THREE_D_API_TYPE_WEBGL, | 4238 THREE_D_API_TYPE_WEBGL, arb_robustness_status_code)); |
4240 arb_robustness_status_code)); | |
4241 } | 4239 } |
4242 | 4240 |
4243 blink::WebScreenOrientationClient* | 4241 blink::WebScreenOrientationClient* |
4244 RenderFrameImpl::webScreenOrientationClient() { | 4242 RenderFrameImpl::webScreenOrientationClient() { |
4245 if (!screen_orientation_dispatcher_) | 4243 if (!screen_orientation_dispatcher_) |
4246 screen_orientation_dispatcher_ = new ScreenOrientationDispatcher(this); | 4244 screen_orientation_dispatcher_ = new ScreenOrientationDispatcher(this); |
4247 return screen_orientation_dispatcher_; | 4245 return screen_orientation_dispatcher_; |
4248 } | 4246 } |
4249 | 4247 |
4250 bool RenderFrameImpl::isControlledByServiceWorker(WebDataSource& data_source) { | 4248 bool RenderFrameImpl::isControlledByServiceWorker(WebDataSource& data_source) { |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4467 if (extra_data) | 4465 if (extra_data) |
4468 params.was_fetched_via_proxy = extra_data->was_fetched_via_proxy(); | 4466 params.was_fetched_via_proxy = extra_data->was_fetched_via_proxy(); |
4469 params.was_within_same_page = navigation_state->WasWithinSamePage(); | 4467 params.was_within_same_page = navigation_state->WasWithinSamePage(); |
4470 params.security_info = response.securityInfo(); | 4468 params.security_info = response.securityInfo(); |
4471 | 4469 |
4472 // Set the origin of the frame. This will be replicated to the corresponding | 4470 // Set the origin of the frame. This will be replicated to the corresponding |
4473 // RenderFrameProxies in other processes. | 4471 // RenderFrameProxies in other processes. |
4474 // TODO(alexmos): Origins for URLs with non-standard schemes are excluded due | 4472 // TODO(alexmos): Origins for URLs with non-standard schemes are excluded due |
4475 // to https://crbug.com/439608 and will be replicated as unique origins. | 4473 // to https://crbug.com/439608 and will be replicated as unique origins. |
4476 if (!is_swapped_out_) { | 4474 if (!is_swapped_out_) { |
4477 std::string scheme = frame->document().securityOrigin().protocol().utf8(); | 4475 std::string scheme = |
| 4476 frame->document().getSecurityOrigin().protocol().utf8(); |
4478 if (url::IsStandard(scheme.c_str(), | 4477 if (url::IsStandard(scheme.c_str(), |
4479 url::Component(0, static_cast<int>(scheme.length())))) { | 4478 url::Component(0, static_cast<int>(scheme.length())))) { |
4480 params.origin = frame->document().securityOrigin(); | 4479 params.origin = frame->document().getSecurityOrigin(); |
4481 } | 4480 } |
4482 } | 4481 } |
4483 | 4482 |
4484 params.should_enforce_strict_mixed_content_checking = | 4483 params.should_enforce_strict_mixed_content_checking = |
4485 frame->shouldEnforceStrictMixedContentChecking(); | 4484 frame->shouldEnforceStrictMixedContentChecking(); |
4486 | 4485 |
4487 // Set the URL to be displayed in the browser UI to the user. | 4486 // Set the URL to be displayed in the browser UI to the user. |
4488 params.url = GetLoadingUrl(); | 4487 params.url = GetLoadingUrl(); |
4489 DCHECK(!is_swapped_out_ || params.url == GURL(kSwappedOutURL)); | 4488 DCHECK(!is_swapped_out_ || params.url == GURL(kSwappedOutURL)); |
4490 | 4489 |
(...skipping 1642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6133 int match_count, | 6132 int match_count, |
6134 int ordinal, | 6133 int ordinal, |
6135 const WebRect& selection_rect, | 6134 const WebRect& selection_rect, |
6136 bool final_status_update) { | 6135 bool final_status_update) { |
6137 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, | 6136 Send(new FrameHostMsg_Find_Reply(routing_id_, request_id, match_count, |
6138 selection_rect, ordinal, | 6137 selection_rect, ordinal, |
6139 final_status_update)); | 6138 final_status_update)); |
6140 } | 6139 } |
6141 | 6140 |
6142 } // namespace content | 6141 } // namespace content |
OLD | NEW |