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