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