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 385 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 bool BrowserPlugin::acceptsInputEvents() { | 484 bool BrowserPlugin::acceptsInputEvents() { |
483 return true; | 485 return true; |
484 } | 486 } |
485 | 487 |
486 blink::WebInputEventResult BrowserPlugin::handleInputEvent( | 488 blink::WebInputEventResult BrowserPlugin::handleInputEvent( |
487 const blink::WebInputEvent& event, | 489 const blink::WebInputEvent& event, |
488 blink::WebCursorInfo& cursor_info) { | 490 blink::WebCursorInfo& cursor_info) { |
489 if (guest_crashed_ || !attached()) | 491 if (guest_crashed_ || !attached()) |
490 return blink::WebInputEventResult::NotHandled; | 492 return blink::WebInputEventResult::NotHandled; |
491 | 493 |
| 494 DCHECK(!blink::WebInputEvent::isTouchEventType(event.type)); |
| 495 |
492 if (event.type == blink::WebInputEvent::MouseWheel) { | 496 if (event.type == blink::WebInputEvent::MouseWheel) { |
493 auto wheel_event = static_cast<const blink::WebMouseWheelEvent&>(event); | 497 auto wheel_event = static_cast<const blink::WebMouseWheelEvent&>(event); |
494 if (wheel_event.resendingPluginId == browser_plugin_instance_id_) | 498 if (wheel_event.resendingPluginId == browser_plugin_instance_id_) |
495 return blink::WebInputEventResult::NotHandled; | 499 return blink::WebInputEventResult::NotHandled; |
496 } | 500 } |
497 | 501 |
498 if (blink::WebInputEvent::isGestureEventType(event.type)) { | 502 if (blink::WebInputEvent::isGestureEventType(event.type)) { |
499 auto gesture_event = static_cast<const blink::WebGestureEvent&>(event); | 503 auto gesture_event = static_cast<const blink::WebGestureEvent&>(event); |
500 if (gesture_event.resendingPluginId == browser_plugin_instance_id_) | 504 if (gesture_event.resendingPluginId == browser_plugin_instance_id_) |
501 return blink::WebInputEventResult::NotHandled; | 505 return blink::WebInputEventResult::NotHandled; |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
639 bool BrowserPlugin::HandleMouseLockedInputEvent( | 643 bool BrowserPlugin::HandleMouseLockedInputEvent( |
640 const blink::WebMouseEvent& event) { | 644 const blink::WebMouseEvent& event) { |
641 BrowserPluginManager::Get()->Send( | 645 BrowserPluginManager::Get()->Send( |
642 new BrowserPluginHostMsg_HandleInputEvent(browser_plugin_instance_id_, | 646 new BrowserPluginHostMsg_HandleInputEvent(browser_plugin_instance_id_, |
643 view_rect_, | 647 view_rect_, |
644 &event)); | 648 &event)); |
645 return true; | 649 return true; |
646 } | 650 } |
647 | 651 |
648 } // namespace content | 652 } // namespace content |
OLD | NEW |