OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "content/renderer/browser_plugin/browser_plugin.h" | 5 #include "content/renderer/browser_plugin/browser_plugin.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/location.h" | 8 #include "base/location.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
77 delegate_(delegate), | 77 delegate_(delegate), |
78 weak_ptr_factory_(this) { | 78 weak_ptr_factory_(this) { |
79 browser_plugin_instance_id_ = | 79 browser_plugin_instance_id_ = |
80 BrowserPluginManager::Get()->GetNextInstanceID(); | 80 BrowserPluginManager::Get()->GetNextInstanceID(); |
81 | 81 |
82 if (delegate_) | 82 if (delegate_) |
83 delegate_->SetElementInstanceID(browser_plugin_instance_id_); | 83 delegate_->SetElementInstanceID(browser_plugin_instance_id_); |
84 } | 84 } |
85 | 85 |
86 BrowserPlugin::~BrowserPlugin() { | 86 BrowserPlugin::~BrowserPlugin() { |
| 87 Detach(); |
| 88 |
87 if (compositing_helper_.get()) | 89 if (compositing_helper_.get()) |
88 compositing_helper_->OnContainerDestroy(); | 90 compositing_helper_->OnContainerDestroy(); |
89 | 91 |
90 if (delegate_) { | 92 if (delegate_) { |
91 delegate_->DidDestroyElement(); | 93 delegate_->DidDestroyElement(); |
92 delegate_.reset(); | 94 delegate_.reset(); |
93 } | 95 } |
94 | 96 |
95 BrowserPluginManager::Get()->RemoveBrowserPlugin(browser_plugin_instance_id_); | 97 BrowserPluginManager::Get()->RemoveBrowserPlugin(browser_plugin_instance_id_); |
96 } | 98 } |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
481 | 483 |
482 bool BrowserPlugin::acceptsInputEvents() { | 484 bool BrowserPlugin::acceptsInputEvents() { |
483 return true; | 485 return true; |
484 } | 486 } |
485 | 487 |
486 bool BrowserPlugin::handleInputEvent(const blink::WebInputEvent& event, | 488 bool BrowserPlugin::handleInputEvent(const blink::WebInputEvent& event, |
487 blink::WebCursorInfo& cursor_info) { | 489 blink::WebCursorInfo& cursor_info) { |
488 if (guest_crashed_ || !attached()) | 490 if (guest_crashed_ || !attached()) |
489 return false; | 491 return false; |
490 | 492 |
| 493 DCHECK(!blink::WebInputEvent::isTouchEventType(event.type)); |
| 494 |
491 if (event.type == blink::WebInputEvent::MouseWheel) { | 495 if (event.type == blink::WebInputEvent::MouseWheel) { |
492 auto wheel_event = static_cast<const blink::WebMouseWheelEvent&>(event); | 496 auto wheel_event = static_cast<const blink::WebMouseWheelEvent&>(event); |
493 if (wheel_event.resendingPluginId == browser_plugin_instance_id_) | 497 if (wheel_event.resendingPluginId == browser_plugin_instance_id_) |
494 return false; | 498 return false; |
495 } | 499 } |
496 | 500 |
497 if (blink::WebInputEvent::isGestureEventType(event.type)) { | 501 if (blink::WebInputEvent::isGestureEventType(event.type)) { |
498 auto gesture_event = static_cast<const blink::WebGestureEvent&>(event); | 502 auto gesture_event = static_cast<const blink::WebGestureEvent&>(event); |
499 if (gesture_event.resendingPluginId == browser_plugin_instance_id_) | 503 if (gesture_event.resendingPluginId == browser_plugin_instance_id_) |
500 return false; | 504 return false; |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 bool BrowserPlugin::HandleMouseLockedInputEvent( | 652 bool BrowserPlugin::HandleMouseLockedInputEvent( |
649 const blink::WebMouseEvent& event) { | 653 const blink::WebMouseEvent& event) { |
650 BrowserPluginManager::Get()->Send( | 654 BrowserPluginManager::Get()->Send( |
651 new BrowserPluginHostMsg_HandleInputEvent(browser_plugin_instance_id_, | 655 new BrowserPluginHostMsg_HandleInputEvent(browser_plugin_instance_id_, |
652 view_rect_, | 656 view_rect_, |
653 &event)); | 657 &event)); |
654 return true; | 658 return true; |
655 } | 659 } |
656 | 660 |
657 } // namespace content | 661 } // namespace content |
OLD | NEW |