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 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1069 media_player_delegate_(NULL), | 1069 media_player_delegate_(NULL), |
1070 is_using_lofi_(false), | 1070 is_using_lofi_(false), |
1071 effective_connection_type_( | 1071 effective_connection_type_( |
1072 blink::WebEffectiveConnectionType::TypeUnknown), | 1072 blink::WebEffectiveConnectionType::TypeUnknown), |
1073 is_pasting_(false), | 1073 is_pasting_(false), |
1074 suppress_further_dialogs_(false), | 1074 suppress_further_dialogs_(false), |
1075 blame_context_(nullptr), | 1075 blame_context_(nullptr), |
1076 #if defined(ENABLE_PLUGINS) | 1076 #if defined(ENABLE_PLUGINS) |
1077 focused_pepper_plugin_(nullptr), | 1077 focused_pepper_plugin_(nullptr), |
1078 pepper_last_mouse_event_target_(nullptr), | 1078 pepper_last_mouse_event_target_(nullptr), |
1079 is_plugin_initializing_(false), | |
1080 #endif | 1079 #endif |
1081 frame_binding_(this), | 1080 frame_binding_(this), |
1082 has_accessed_initial_document_(false), | 1081 has_accessed_initial_document_(false), |
1083 weak_factory_(this) { | 1082 weak_factory_(this) { |
1084 // We don't have a shell::Connection at this point, so use nullptr. | 1083 // We don't have a shell::Connection at this point, so use nullptr. |
1085 // TODO(beng): We should fix this, so we can apply policy about which | 1084 // TODO(beng): We should fix this, so we can apply policy about which |
1086 // interfaces get exposed. | 1085 // interfaces get exposed. |
1087 interface_registry_.reset(new shell::InterfaceRegistry); | 1086 interface_registry_.reset(new shell::InterfaceRegistry); |
1088 shell::mojom::InterfaceProviderPtr remote_interfaces; | 1087 shell::mojom::InterfaceProviderPtr remote_interfaces; |
1089 pending_remote_interface_provider_request_ = GetProxy(&remote_interfaces); | 1088 pending_remote_interface_provider_request_ = GetProxy(&remote_interfaces); |
(...skipping 18 matching lines...) Expand all Loading... |
1108 | 1107 |
1109 #if defined(ENABLE_PLUGINS) | 1108 #if defined(ENABLE_PLUGINS) |
1110 // Manages its own lifetime. | 1109 // Manages its own lifetime. |
1111 plugin_power_saver_helper_ = new PluginPowerSaverHelper(this); | 1110 plugin_power_saver_helper_ = new PluginPowerSaverHelper(this); |
1112 #endif | 1111 #endif |
1113 | 1112 |
1114 manifest_manager_ = new ManifestManager(this); | 1113 manifest_manager_ = new ManifestManager(this); |
1115 } | 1114 } |
1116 | 1115 |
1117 RenderFrameImpl::~RenderFrameImpl() { | 1116 RenderFrameImpl::~RenderFrameImpl() { |
1118 #if defined(ENABLE_PLUGINS) | |
1119 if (is_plugin_initializing_) | |
1120 base::debug::DumpWithoutCrashing(); | |
1121 #endif | |
1122 | |
1123 // If file chooser is still waiting for answer, dispatch empty answer. | 1117 // If file chooser is still waiting for answer, dispatch empty answer. |
1124 while (!file_chooser_completions_.empty()) { | 1118 while (!file_chooser_completions_.empty()) { |
1125 if (file_chooser_completions_.front()->completion) { | 1119 if (file_chooser_completions_.front()->completion) { |
1126 file_chooser_completions_.front()->completion->didChooseFile( | 1120 file_chooser_completions_.front()->completion->didChooseFile( |
1127 WebVector<WebString>()); | 1121 WebVector<WebString>()); |
1128 } | 1122 } |
1129 file_chooser_completions_.pop_front(); | 1123 file_chooser_completions_.pop_front(); |
1130 } | 1124 } |
1131 | 1125 |
1132 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, RenderFrameGone()); | 1126 FOR_EACH_OBSERVER(RenderFrameObserver, observers_, RenderFrameGone()); |
(...skipping 1215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2348 void RenderFrameImpl::CancelContextMenu(int request_id) { | 2342 void RenderFrameImpl::CancelContextMenu(int request_id) { |
2349 DCHECK(pending_context_menus_.Lookup(request_id)); | 2343 DCHECK(pending_context_menus_.Lookup(request_id)); |
2350 pending_context_menus_.Remove(request_id); | 2344 pending_context_menus_.Remove(request_id); |
2351 } | 2345 } |
2352 | 2346 |
2353 blink::WebPlugin* RenderFrameImpl::CreatePlugin( | 2347 blink::WebPlugin* RenderFrameImpl::CreatePlugin( |
2354 blink::WebFrame* frame, | 2348 blink::WebFrame* frame, |
2355 const WebPluginInfo& info, | 2349 const WebPluginInfo& info, |
2356 const blink::WebPluginParams& params, | 2350 const blink::WebPluginParams& params, |
2357 std::unique_ptr<content::PluginInstanceThrottler> throttler) { | 2351 std::unique_ptr<content::PluginInstanceThrottler> throttler) { |
2358 CHECK_EQ(frame_, frame); | 2352 DCHECK_EQ(frame_, frame); |
2359 #if defined(ENABLE_PLUGINS) | 2353 #if defined(ENABLE_PLUGINS) |
2360 if (info.type == WebPluginInfo::PLUGIN_TYPE_BROWSER_PLUGIN) { | 2354 if (info.type == WebPluginInfo::PLUGIN_TYPE_BROWSER_PLUGIN) { |
2361 return BrowserPluginManager::Get()->CreateBrowserPlugin( | 2355 return BrowserPluginManager::Get()->CreateBrowserPlugin( |
2362 this, GetContentClient() | 2356 this, GetContentClient() |
2363 ->renderer() | 2357 ->renderer() |
2364 ->CreateBrowserPluginDelegate(this, params.mimeType.utf8(), | 2358 ->CreateBrowserPluginDelegate(this, params.mimeType.utf8(), |
2365 GURL(params.url)) | 2359 GURL(params.url)) |
2366 ->GetWeakPtr()); | 2360 ->GetWeakPtr()); |
2367 } | 2361 } |
2368 | 2362 |
2369 bool pepper_plugin_was_registered = false; | 2363 bool pepper_plugin_was_registered = false; |
2370 scoped_refptr<PluginModule> pepper_module(PluginModule::Create( | 2364 scoped_refptr<PluginModule> pepper_module(PluginModule::Create( |
2371 this, info, &pepper_plugin_was_registered)); | 2365 this, info, &pepper_plugin_was_registered)); |
2372 if (pepper_plugin_was_registered) { | 2366 if (pepper_plugin_was_registered) { |
2373 if (pepper_module.get()) { | 2367 if (pepper_module.get()) { |
2374 is_plugin_initializing_ = true; | |
2375 return new PepperWebPluginImpl( | 2368 return new PepperWebPluginImpl( |
2376 pepper_module.get(), params, this, | 2369 pepper_module.get(), params, this, |
2377 base::WrapUnique( | 2370 base::WrapUnique( |
2378 static_cast<PluginInstanceThrottlerImpl*>(throttler.release()))); | 2371 static_cast<PluginInstanceThrottlerImpl*>(throttler.release()))); |
2379 } | 2372 } |
2380 } | 2373 } |
2381 #if defined(OS_CHROMEOS) | 2374 #if defined(OS_CHROMEOS) |
2382 LOG(WARNING) << "Pepper module/plugin creation failed."; | 2375 LOG(WARNING) << "Pepper module/plugin creation failed."; |
2383 #endif | 2376 #endif |
2384 #endif | 2377 #endif |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2518 void RenderFrameImpl::GetInterfaceProvider( | 2511 void RenderFrameImpl::GetInterfaceProvider( |
2519 shell::mojom::InterfaceProviderRequest request) { | 2512 shell::mojom::InterfaceProviderRequest request) { |
2520 interface_registry_->Bind(std::move(request)); | 2513 interface_registry_->Bind(std::move(request)); |
2521 } | 2514 } |
2522 | 2515 |
2523 // blink::WebFrameClient implementation ---------------------------------------- | 2516 // blink::WebFrameClient implementation ---------------------------------------- |
2524 | 2517 |
2525 blink::WebPlugin* RenderFrameImpl::createPlugin( | 2518 blink::WebPlugin* RenderFrameImpl::createPlugin( |
2526 blink::WebLocalFrame* frame, | 2519 blink::WebLocalFrame* frame, |
2527 const blink::WebPluginParams& params) { | 2520 const blink::WebPluginParams& params) { |
2528 CHECK_EQ(frame_, frame); | 2521 DCHECK_EQ(frame_, frame); |
2529 blink::WebPlugin* plugin = NULL; | 2522 blink::WebPlugin* plugin = NULL; |
2530 if (GetContentClient()->renderer()->OverrideCreatePlugin( | 2523 if (GetContentClient()->renderer()->OverrideCreatePlugin( |
2531 this, frame, params, &plugin)) { | 2524 this, frame, params, &plugin)) { |
2532 return plugin; | 2525 return plugin; |
2533 } | 2526 } |
2534 | 2527 |
2535 if (base::UTF16ToUTF8(base::StringPiece16(params.mimeType)) == | 2528 if (base::UTF16ToUTF8(base::StringPiece16(params.mimeType)) == |
2536 kBrowserPluginMimeType) { | 2529 kBrowserPluginMimeType) { |
2537 return BrowserPluginManager::Get()->CreateBrowserPlugin( | 2530 return BrowserPluginManager::Get()->CreateBrowserPlugin( |
2538 this, GetContentClient() | 2531 this, GetContentClient() |
(...skipping 3699 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6238 request_id, | 6231 request_id, |
6239 match_count, | 6232 match_count, |
6240 selection_rect, | 6233 selection_rect, |
6241 ordinal, | 6234 ordinal, |
6242 final_status_update)); | 6235 final_status_update)); |
6243 } | 6236 } |
6244 | 6237 |
6245 #if defined(ENABLE_PLUGINS) | 6238 #if defined(ENABLE_PLUGINS) |
6246 void RenderFrameImpl::PepperInstanceCreated( | 6239 void RenderFrameImpl::PepperInstanceCreated( |
6247 PepperPluginInstanceImpl* instance) { | 6240 PepperPluginInstanceImpl* instance) { |
6248 is_plugin_initializing_ = false; | |
6249 active_pepper_instances_.insert(instance); | 6241 active_pepper_instances_.insert(instance); |
6250 | 6242 |
6251 Send(new FrameHostMsg_PepperInstanceCreated( | 6243 Send(new FrameHostMsg_PepperInstanceCreated( |
6252 routing_id_, instance->pp_instance())); | 6244 routing_id_, instance->pp_instance())); |
6253 } | 6245 } |
6254 | 6246 |
6255 void RenderFrameImpl::PepperInstanceDeleted( | 6247 void RenderFrameImpl::PepperInstanceDeleted( |
6256 PepperPluginInstanceImpl* instance) { | 6248 PepperPluginInstanceImpl* instance) { |
6257 active_pepper_instances_.erase(instance); | 6249 active_pepper_instances_.erase(instance); |
6258 | 6250 |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6327 // event target. Potentially a Pepper plugin will receive the event. | 6319 // event target. Potentially a Pepper plugin will receive the event. |
6328 // In order to tell whether a plugin gets the last mouse event and which it | 6320 // In order to tell whether a plugin gets the last mouse event and which it |
6329 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets | 6321 // is, we set |pepper_last_mouse_event_target_| to null here. If a plugin gets |
6330 // the event, it will notify us via DidReceiveMouseEvent() and set itself as | 6322 // the event, it will notify us via DidReceiveMouseEvent() and set itself as |
6331 // |pepper_last_mouse_event_target_|. | 6323 // |pepper_last_mouse_event_target_|. |
6332 pepper_last_mouse_event_target_ = nullptr; | 6324 pepper_last_mouse_event_target_ = nullptr; |
6333 #endif | 6325 #endif |
6334 } | 6326 } |
6335 | 6327 |
6336 } // namespace content | 6328 } // namespace content |
OLD | NEW |