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 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 #include "content/renderer/pepper/plugin_module.h" | 227 #include "content/renderer/pepper/plugin_module.h" |
228 #endif | 228 #endif |
229 | 229 |
230 #if BUILDFLAG(ENABLE_WEBRTC) | 230 #if BUILDFLAG(ENABLE_WEBRTC) |
231 #include "content/renderer/media/rtc_peer_connection_handler.h" | 231 #include "content/renderer/media/rtc_peer_connection_handler.h" |
232 #endif | 232 #endif |
233 | 233 |
234 #if defined(OS_ANDROID) | 234 #if defined(OS_ANDROID) |
235 #include <cpu-features.h> | 235 #include <cpu-features.h> |
236 | 236 |
237 #include "content/renderer/android/app_web_message_port_client.h" | |
238 #include "content/renderer/java/gin_java_bridge_dispatcher.h" | 237 #include "content/renderer/java/gin_java_bridge_dispatcher.h" |
239 #include "content/renderer/media/android/media_player_renderer_client_factory.h" | 238 #include "content/renderer/media/android/media_player_renderer_client_factory.h" |
240 #include "content/renderer/media/android/renderer_media_player_manager.h" | 239 #include "content/renderer/media/android/renderer_media_player_manager.h" |
241 #include "content/renderer/media/android/renderer_surface_view_manager.h" | 240 #include "content/renderer/media/android/renderer_surface_view_manager.h" |
242 #include "content/renderer/media/android/stream_texture_factory.h" | 241 #include "content/renderer/media/android/stream_texture_factory.h" |
243 #include "content/renderer/media/android/stream_texture_wrapper_impl.h" | 242 #include "content/renderer/media/android/stream_texture_wrapper_impl.h" |
244 #include "media/base/android/media_codec_util.h" | 243 #include "media/base/android/media_codec_util.h" |
245 #include "third_party/WebKit/public/platform/WebFloatPoint.h" | 244 #include "third_party/WebKit/public/platform/WebFloatPoint.h" |
246 #endif | 245 #endif |
247 | 246 |
(...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1231 // when |this| is deleted. | 1230 // when |this| is deleted. |
1232 devtools_agent_ = new DevToolsAgent(this); | 1231 devtools_agent_ = new DevToolsAgent(this); |
1233 } | 1232 } |
1234 | 1233 |
1235 RegisterMojoInterfaces(); | 1234 RegisterMojoInterfaces(); |
1236 | 1235 |
1237 // We delay calling this until we have the WebFrame so that any observer or | 1236 // We delay calling this until we have the WebFrame so that any observer or |
1238 // embedder can call GetWebFrame on any RenderFrame. | 1237 // embedder can call GetWebFrame on any RenderFrame. |
1239 GetContentClient()->renderer()->RenderFrameCreated(this); | 1238 GetContentClient()->renderer()->RenderFrameCreated(this); |
1240 | 1239 |
1241 #if defined(OS_ANDROID) | |
1242 new AppWebMessagePortClient(this); | |
1243 #endif | |
1244 | |
1245 RenderThreadImpl* render_thread = RenderThreadImpl::current(); | 1240 RenderThreadImpl* render_thread = RenderThreadImpl::current(); |
1246 // render_thread may be NULL in tests. | 1241 // render_thread may be NULL in tests. |
1247 InputHandlerManager* input_handler_manager = | 1242 InputHandlerManager* input_handler_manager = |
1248 render_thread ? render_thread->input_handler_manager() : nullptr; | 1243 render_thread ? render_thread->input_handler_manager() : nullptr; |
1249 if (input_handler_manager) { | 1244 if (input_handler_manager) { |
1250 DCHECK(render_view_->HasAddedInputHandler()); | 1245 DCHECK(render_view_->HasAddedInputHandler()); |
1251 input_handler_manager->RegisterRoutingID(GetRoutingID()); | 1246 input_handler_manager->RegisterRoutingID(GetRoutingID()); |
1252 } | 1247 } |
1253 | 1248 |
1254 const base::CommandLine& command_line = | 1249 const base::CommandLine& command_line = |
(...skipping 944 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2199 WebFrame* source_frame = NULL; | 2194 WebFrame* source_frame = NULL; |
2200 if (params.source_routing_id != MSG_ROUTING_NONE) { | 2195 if (params.source_routing_id != MSG_ROUTING_NONE) { |
2201 RenderFrameProxy* source_proxy = | 2196 RenderFrameProxy* source_proxy = |
2202 RenderFrameProxy::FromRoutingID(params.source_routing_id); | 2197 RenderFrameProxy::FromRoutingID(params.source_routing_id); |
2203 if (source_proxy) | 2198 if (source_proxy) |
2204 source_frame = source_proxy->web_frame(); | 2199 source_frame = source_proxy->web_frame(); |
2205 } | 2200 } |
2206 | 2201 |
2207 // If the message contained MessagePorts, create the corresponding endpoints. | 2202 // If the message contained MessagePorts, create the corresponding endpoints. |
2208 blink::WebMessagePortChannelArray channels = | 2203 blink::WebMessagePortChannelArray channels = |
2209 WebMessagePortChannelImpl::CreatePorts( | 2204 WebMessagePortChannelImpl::CreateFromMessagePorts(params.message_ports); |
2210 params.message_ports, params.new_routing_ids, | |
2211 base::ThreadTaskRunnerHandle::Get().get()); | |
2212 | 2205 |
2213 WebSerializedScriptValue serialized_script_value; | 2206 WebSerializedScriptValue serialized_script_value; |
2214 if (params.is_data_raw_string) { | 2207 if (params.is_data_raw_string) { |
2215 v8::HandleScope handle_scope(blink::mainThreadIsolate()); | 2208 v8::HandleScope handle_scope(blink::mainThreadIsolate()); |
2216 v8::Local<v8::Context> context = frame_->mainWorldScriptContext(); | 2209 v8::Local<v8::Context> context = frame_->mainWorldScriptContext(); |
2217 v8::Context::Scope context_scope(context); | 2210 v8::Context::Scope context_scope(context); |
2218 V8ValueConverterImpl converter; | 2211 V8ValueConverterImpl converter; |
2219 converter.SetDateAllowed(true); | 2212 converter.SetDateAllowed(true); |
2220 converter.SetRegExpAllowed(true); | 2213 converter.SetRegExpAllowed(true); |
2221 std::unique_ptr<base::Value> value(new base::StringValue(params.data)); | 2214 std::unique_ptr<base::Value> value(new base::StringValue(params.data)); |
2222 v8::Local<v8::Value> result_value = converter.ToV8Value(value.get(), | 2215 v8::Local<v8::Value> result_value = converter.ToV8Value(value.get(), |
2223 context); | 2216 context); |
2224 serialized_script_value = WebSerializedScriptValue::serialize(result_value); | 2217 serialized_script_value = WebSerializedScriptValue::serialize(result_value); |
2225 } else { | 2218 } else { |
2226 serialized_script_value = | 2219 serialized_script_value = |
2227 WebSerializedScriptValue::fromString(WebString::fromUTF16(params.data)); | 2220 WebSerializedScriptValue::fromString(WebString::fromUTF16(params.data)); |
2228 } | 2221 } |
2229 | 2222 |
2230 // We must pass in the target_origin to do the security check on this side, | 2223 // We must pass in the target_origin to do the security check on this side, |
2231 // since it may have changed since the original postMessage call was made. | 2224 // since it may have changed since the original postMessage call was made. |
2232 WebSecurityOrigin target_origin; | 2225 WebSecurityOrigin target_origin; |
2233 if (!params.target_origin.empty()) { | 2226 if (!params.target_origin.empty()) { |
2234 target_origin = WebSecurityOrigin::createFromString( | 2227 target_origin = WebSecurityOrigin::createFromString( |
2235 WebString::fromUTF16(params.target_origin)); | 2228 WebString::fromUTF16(params.target_origin)); |
2236 } | 2229 } |
2237 | 2230 |
2238 WebDOMMessageEvent msg_event(serialized_script_value, | 2231 WebDOMMessageEvent msg_event(serialized_script_value, |
2239 WebString::fromUTF16(params.source_origin), | 2232 WebString::fromUTF16(params.source_origin), |
2240 source_frame, frame_->document(), channels); | 2233 source_frame, |
| 2234 frame_->document(), |
| 2235 std::move(channels)); |
2241 frame_->dispatchMessageEventWithOriginCheck(target_origin, msg_event); | 2236 frame_->dispatchMessageEventWithOriginCheck(target_origin, msg_event); |
2242 } | 2237 } |
2243 | 2238 |
2244 void RenderFrameImpl::OnReload(bool bypass_cache) { | 2239 void RenderFrameImpl::OnReload(bool bypass_cache) { |
2245 frame_->reload(bypass_cache ? WebFrameLoadType::ReloadBypassingCache | 2240 frame_->reload(bypass_cache ? WebFrameLoadType::ReloadBypassingCache |
2246 : WebFrameLoadType::ReloadMainResource); | 2241 : WebFrameLoadType::ReloadMainResource); |
2247 } | 2242 } |
2248 | 2243 |
2249 void RenderFrameImpl::OnReloadLoFiImages() { | 2244 void RenderFrameImpl::OnReloadLoFiImages() { |
2250 previews_state_ = PREVIEWS_NO_TRANSFORM; | 2245 previews_state_ = PREVIEWS_NO_TRANSFORM; |
(...skipping 4582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6833 // event target. Potentially a Pepper plugin will receive the event. | 6828 // event target. Potentially a Pepper plugin will receive the event. |
6834 // In order to tell whether a plugin gets the last mouse event and which it | 6829 // In order to tell whether a plugin gets the last mouse event and which it |
6835 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6830 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
6836 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6831 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
6837 // |pepper_last_mouse_event_target_|. | 6832 // |pepper_last_mouse_event_target_|. |
6838 pepper_last_mouse_event_target_ = nullptr; | 6833 pepper_last_mouse_event_target_ = nullptr; |
6839 #endif | 6834 #endif |
6840 } | 6835 } |
6841 | 6836 |
6842 } // namespace content | 6837 } // namespace content |
OLD | NEW |