| 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 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 input_event_mask_(0), | 430 input_event_mask_(0), |
| 431 filtered_input_event_mask_(0), | 431 filtered_input_event_mask_(0), |
| 432 text_input_type_(kPluginDefaultTextInputType), | 432 text_input_type_(kPluginDefaultTextInputType), |
| 433 text_input_caret_(0, 0, 0, 0), | 433 text_input_caret_(0, 0, 0, 0), |
| 434 text_input_caret_bounds_(0, 0, 0, 0), | 434 text_input_caret_bounds_(0, 0, 0, 0), |
| 435 text_input_caret_set_(false), | 435 text_input_caret_set_(false), |
| 436 selection_caret_(0), | 436 selection_caret_(0), |
| 437 selection_anchor_(0), | 437 selection_anchor_(0), |
| 438 pending_user_gesture_(0.0), | 438 pending_user_gesture_(0.0), |
| 439 document_loader_(NULL), | 439 document_loader_(NULL), |
| 440 nacl_document_load_(false), | 440 nacl_document_load_(false) { |
| 441 npp_(new NPP_t) { | |
| 442 pp_instance_ = HostGlobals::Get()->AddInstance(this); | 441 pp_instance_ = HostGlobals::Get()->AddInstance(this); |
| 443 | 442 |
| 444 memset(¤t_print_settings_, 0, sizeof(current_print_settings_)); | 443 memset(¤t_print_settings_, 0, sizeof(current_print_settings_)); |
| 445 DCHECK(delegate); | 444 DCHECK(delegate); |
| 446 module_->InstanceCreated(this); | 445 module_->InstanceCreated(this); |
| 447 delegate_->InstanceCreated(this); | 446 delegate_->InstanceCreated(this); |
| 447 message_channel_.reset(new MessageChannel(this)); |
| 448 | 448 |
| 449 view_data_.is_page_visible = delegate->IsPageVisible(); | 449 view_data_.is_page_visible = delegate->IsPageVisible(); |
| 450 |
| 450 resource_creation_ = delegate_->CreateResourceCreationAPI(this); | 451 resource_creation_ = delegate_->CreateResourceCreationAPI(this); |
| 451 | 452 |
| 452 // TODO(bbudge) remove this when the trusted NaCl plugin has been removed. | 453 // TODO(bbudge) remove this when the trusted NaCl plugin has been removed. |
| 453 // We must defer certain plugin events for NaCl instances since we switch | 454 // We must defer certain plugin events for NaCl instances since we switch |
| 454 // from the in-process to the out-of-process proxy after instantiating them. | 455 // from the in-process to the out-of-process proxy after instantiating them. |
| 455 if (module->name() == "Native Client") | 456 if (module->name() == "Native Client") |
| 456 nacl_document_load_ = true; | 457 nacl_document_load_ = true; |
| 457 } | 458 } |
| 458 | 459 |
| 459 PluginInstance::~PluginInstance() { | 460 PluginInstance::~PluginInstance() { |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 626 // 6 : 3D content but GPU is blacklisted on XP | 627 // 6 : 3D content but GPU is blacklisted on XP |
| 627 // 7 : 3D content and GPU is not blacklisted on XP | 628 // 7 : 3D content and GPU is not blacklisted on XP |
| 628 UMA_HISTOGRAM_ENUMERATION("Flash.UsesGPU", | 629 UMA_HISTOGRAM_ENUMERATION("Flash.UsesGPU", |
| 629 is_xp * 4 + needs_gpu * 2 + prefs.is_webgl_supported, 8); | 630 is_xp * 4 + needs_gpu * 2 + prefs.is_webgl_supported, 8); |
| 630 #endif | 631 #endif |
| 631 } | 632 } |
| 632 | 633 |
| 633 bool PluginInstance::Initialize(const std::vector<std::string>& arg_names, | 634 bool PluginInstance::Initialize(const std::vector<std::string>& arg_names, |
| 634 const std::vector<std::string>& arg_values, | 635 const std::vector<std::string>& arg_values, |
| 635 bool full_frame) { | 636 bool full_frame) { |
| 636 message_channel_.reset(new MessageChannel(this)); | |
| 637 | |
| 638 full_frame_ = full_frame; | 637 full_frame_ = full_frame; |
| 639 | 638 |
| 640 UpdateTouchEventRequest(); | 639 UpdateTouchEventRequest(); |
| 641 container_->setWantsWheelEvents(IsAcceptingWheelEvents()); | 640 container_->setWantsWheelEvents(IsAcceptingWheelEvents()); |
| 642 | 641 |
| 643 SetGPUHistogram(delegate_->GetPreferences(), arg_names, arg_values); | 642 SetGPUHistogram(delegate_->GetPreferences(), arg_names, arg_values); |
| 644 | 643 |
| 645 argn_ = arg_names; | 644 argn_ = arg_names; |
| 646 argv_ = arg_values; | 645 argv_ = arg_values; |
| 647 scoped_ptr<const char*[]> argn_array(StringVectorToArgArray(argn_)); | 646 scoped_ptr<const char*[]> argn_array(StringVectorToArgArray(argn_)); |
| (...skipping 1891 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2539 | 2538 |
| 2540 return PP_NACL_OK; | 2539 return PP_NACL_OK; |
| 2541 } | 2540 } |
| 2542 | 2541 |
| 2543 bool PluginInstance::IsValidInstanceOf(PluginModule* module) { | 2542 bool PluginInstance::IsValidInstanceOf(PluginModule* module) { |
| 2544 DCHECK(module); | 2543 DCHECK(module); |
| 2545 return module == module_.get() || | 2544 return module == module_.get() || |
| 2546 module == original_module_.get(); | 2545 module == original_module_.get(); |
| 2547 } | 2546 } |
| 2548 | 2547 |
| 2549 NPP PluginInstance::instanceNPP() { | |
| 2550 return npp_.get(); | |
| 2551 } | |
| 2552 | |
| 2553 void PluginInstance::DoSetCursor(WebCursorInfo* cursor) { | 2548 void PluginInstance::DoSetCursor(WebCursorInfo* cursor) { |
| 2554 cursor_.reset(cursor); | 2549 cursor_.reset(cursor); |
| 2555 if (fullscreen_container_) { | 2550 if (fullscreen_container_) { |
| 2556 fullscreen_container_->DidChangeCursor(*cursor); | 2551 fullscreen_container_->DidChangeCursor(*cursor); |
| 2557 } else { | 2552 } else { |
| 2558 delegate()->DidChangeCursor(this, *cursor); | 2553 delegate()->DidChangeCursor(this, *cursor); |
| 2559 } | 2554 } |
| 2560 } | 2555 } |
| 2561 | 2556 |
| 2562 bool PluginInstance::CanAccessMainFrame() const { | 2557 bool PluginInstance::CanAccessMainFrame() const { |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2613 screen_size_for_fullscreen_ = gfx::Size(); | 2608 screen_size_for_fullscreen_ = gfx::Size(); |
| 2614 WebElement element = container_->element(); | 2609 WebElement element = container_->element(); |
| 2615 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); | 2610 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); |
| 2616 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); | 2611 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); |
| 2617 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); | 2612 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); |
| 2618 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); | 2613 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); |
| 2619 } | 2614 } |
| 2620 | 2615 |
| 2621 } // namespace ppapi | 2616 } // namespace ppapi |
| 2622 } // namespace webkit | 2617 } // namespace webkit |
| OLD | NEW |