Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "webkit/plugins/ppapi/ppapi_plugin_instance.h" | 5 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 573 | 573 |
| 574 UpdateTouchEventRequest(); | 574 UpdateTouchEventRequest(); |
| 575 container_->setWantsWheelEvents(IsAcceptingWheelEvents()); | 575 container_->setWantsWheelEvents(IsAcceptingWheelEvents()); |
| 576 | 576 |
| 577 SetGPUHistogram(delegate_->GetPreferences(), arg_names, arg_values); | 577 SetGPUHistogram(delegate_->GetPreferences(), arg_names, arg_values); |
| 578 | 578 |
| 579 argn_ = arg_names; | 579 argn_ = arg_names; |
| 580 argv_ = arg_values; | 580 argv_ = arg_values; |
| 581 scoped_array<const char*> argn_array(StringVectorToArgArray(argn_)); | 581 scoped_array<const char*> argn_array(StringVectorToArgArray(argn_)); |
| 582 scoped_array<const char*> argv_array(StringVectorToArgArray(argv_)); | 582 scoped_array<const char*> argv_array(StringVectorToArgArray(argv_)); |
| 583 return PP_ToBool(instance_interface_->DidCreate(pp_instance(), | 583 bool success = PP_ToBool(instance_interface_->DidCreate(pp_instance(), |
| 584 argn_.size(), | 584 argn_.size(), |
| 585 argn_array.get(), | 585 argn_array.get(), |
| 586 argv_array.get())); | 586 argv_array.get())); |
| 587 if (success) | |
| 588 message_channel_->EndQueueingJavaScriptMessages(); | |
| 589 return success; | |
| 587 } | 590 } |
| 588 | 591 |
| 589 bool PluginInstance::HandleDocumentLoad(PPB_URLLoader_Impl* loader) { | 592 bool PluginInstance::HandleDocumentLoad(PPB_URLLoader_Impl* loader) { |
| 590 if (!document_loader_) | 593 if (!document_loader_) |
| 591 document_loader_ = loader; | 594 document_loader_ = loader; |
| 592 DCHECK(loader == document_loader_.get()); | 595 DCHECK(loader == document_loader_.get()); |
| 593 | 596 |
| 594 return PP_ToBool(instance_interface_->HandleDocumentLoad( | 597 return PP_ToBool(instance_interface_->HandleDocumentLoad( |
| 595 pp_instance(), loader->pp_resource())); | 598 pp_instance(), loader->pp_resource())); |
| 596 } | 599 } |
| (...skipping 1782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2379 return ::ppapi::PPB_URLUtil_Shared::GenerateURLReturn(plugin_url_, | 2382 return ::ppapi::PPB_URLUtil_Shared::GenerateURLReturn(plugin_url_, |
| 2380 components); | 2383 components); |
| 2381 } | 2384 } |
| 2382 | 2385 |
| 2383 bool PluginInstance::ResetAsProxied(scoped_refptr<PluginModule> module) { | 2386 bool PluginInstance::ResetAsProxied(scoped_refptr<PluginModule> module) { |
| 2384 // Save the original module and switch over to the new one now that this | 2387 // Save the original module and switch over to the new one now that this |
| 2385 // plugin is using the IPC-based proxy. | 2388 // plugin is using the IPC-based proxy. |
| 2386 original_module_ = module_; | 2389 original_module_ = module_; |
| 2387 module_ = module; | 2390 module_ = module; |
| 2388 | 2391 |
| 2392 message_channel_->QueueJavaScriptMessages(); | |
|
dmichael (off chromium)
2012/12/11 18:55:55
Probably worth a comment?
teravest
2012/12/11 21:32:12
Done.
| |
| 2389 // For NaCl instances, remember the NaCl plugin instance interface, so we | 2393 // For NaCl instances, remember the NaCl plugin instance interface, so we |
| 2390 // can shut it down by calling its DidDestroy in our Delete() method. | 2394 // can shut it down by calling its DidDestroy in our Delete() method. |
| 2391 original_instance_interface_.reset(instance_interface_.release()); | 2395 original_instance_interface_.reset(instance_interface_.release()); |
| 2392 | 2396 |
| 2393 base::Callback<const void*(const char*)> get_plugin_interface_func = | 2397 base::Callback<const void*(const char*)> get_plugin_interface_func = |
| 2394 base::Bind(&PluginModule::GetPluginInterface, module_.get()); | 2398 base::Bind(&PluginModule::GetPluginInterface, module_.get()); |
| 2395 PPP_Instance_Combined* ppp_instance_combined = | 2399 PPP_Instance_Combined* ppp_instance_combined = |
| 2396 PPP_Instance_Combined::Create(get_plugin_interface_func); | 2400 PPP_Instance_Combined::Create(get_plugin_interface_func); |
| 2397 if (!ppp_instance_combined) { | 2401 if (!ppp_instance_combined) { |
| 2398 // The proxy must support at least one usable PPP_Instance interface. | 2402 // The proxy must support at least one usable PPP_Instance interface. |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 2413 plugin_selection_interface_ = NULL; | 2417 plugin_selection_interface_ = NULL; |
| 2414 plugin_textinput_interface_ = NULL; | 2418 plugin_textinput_interface_ = NULL; |
| 2415 plugin_zoom_interface_ = NULL; | 2419 plugin_zoom_interface_ = NULL; |
| 2416 | 2420 |
| 2417 // Re-send the DidCreate event via the proxy. | 2421 // Re-send the DidCreate event via the proxy. |
| 2418 scoped_array<const char*> argn_array(StringVectorToArgArray(argn_)); | 2422 scoped_array<const char*> argn_array(StringVectorToArgArray(argn_)); |
| 2419 scoped_array<const char*> argv_array(StringVectorToArgArray(argv_)); | 2423 scoped_array<const char*> argv_array(StringVectorToArgArray(argv_)); |
| 2420 if (!instance_interface_->DidCreate(pp_instance(), argn_.size(), | 2424 if (!instance_interface_->DidCreate(pp_instance(), argn_.size(), |
| 2421 argn_array.get(), argv_array.get())) | 2425 argn_array.get(), argv_array.get())) |
| 2422 return false; | 2426 return false; |
| 2427 message_channel_->EndQueueingJavaScriptMessages(); | |
| 2423 | 2428 |
| 2424 // Clear sent_initial_did_change_view_ and cancel any pending DidChangeView | 2429 // Clear sent_initial_did_change_view_ and cancel any pending DidChangeView |
| 2425 // event. This way, SendDidChangeView will send the "current" view | 2430 // event. This way, SendDidChangeView will send the "current" view |
| 2426 // immediately (before other events like HandleDocumentLoad). | 2431 // immediately (before other events like HandleDocumentLoad). |
| 2427 sent_initial_did_change_view_ = false; | 2432 sent_initial_did_change_view_ = false; |
| 2428 view_change_weak_ptr_factory_.InvalidateWeakPtrs(); | 2433 view_change_weak_ptr_factory_.InvalidateWeakPtrs(); |
| 2429 SendDidChangeView(); | 2434 SendDidChangeView(); |
| 2430 | 2435 |
| 2431 // If we received HandleDocumentLoad, re-send it now via the proxy. | 2436 // If we received HandleDocumentLoad, re-send it now via the proxy. |
| 2432 if (document_loader_) | 2437 if (document_loader_) |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2497 screen_size_for_fullscreen_ = gfx::Size(); | 2502 screen_size_for_fullscreen_ = gfx::Size(); |
| 2498 WebElement element = container_->element(); | 2503 WebElement element = container_->element(); |
| 2499 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); | 2504 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); |
| 2500 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); | 2505 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); |
| 2501 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); | 2506 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); |
| 2502 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); | 2507 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); |
| 2503 } | 2508 } |
| 2504 | 2509 |
| 2505 } // namespace ppapi | 2510 } // namespace ppapi |
| 2506 } // namespace webkit | 2511 } // namespace webkit |
| OLD | NEW |