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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 delegate_(delegate), | 78 delegate_(delegate), |
79 weak_ptr_factory_(this) { | 79 weak_ptr_factory_(this) { |
80 browser_plugin_instance_id_ = | 80 browser_plugin_instance_id_ = |
81 BrowserPluginManager::Get()->GetNextInstanceID(); | 81 BrowserPluginManager::Get()->GetNextInstanceID(); |
82 | 82 |
83 if (delegate_) | 83 if (delegate_) |
84 delegate_->SetElementInstanceID(browser_plugin_instance_id_); | 84 delegate_->SetElementInstanceID(browser_plugin_instance_id_); |
85 } | 85 } |
86 | 86 |
87 BrowserPlugin::~BrowserPlugin() { | 87 BrowserPlugin::~BrowserPlugin() { |
| 88 Detach(); |
| 89 |
88 if (compositing_helper_.get()) | 90 if (compositing_helper_.get()) |
89 compositing_helper_->OnContainerDestroy(); | 91 compositing_helper_->OnContainerDestroy(); |
90 | 92 |
91 if (delegate_) { | 93 if (delegate_) { |
92 delegate_->DidDestroyElement(); | 94 delegate_->DidDestroyElement(); |
93 delegate_.reset(); | 95 delegate_.reset(); |
94 } | 96 } |
95 | 97 |
96 BrowserPluginManager::Get()->RemoveBrowserPlugin(browser_plugin_instance_id_); | 98 BrowserPluginManager::Get()->RemoveBrowserPlugin(browser_plugin_instance_id_); |
97 } | 99 } |
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 | 496 |
495 bool BrowserPlugin::acceptsInputEvents() { | 497 bool BrowserPlugin::acceptsInputEvents() { |
496 return true; | 498 return true; |
497 } | 499 } |
498 | 500 |
499 bool BrowserPlugin::handleInputEvent(const blink::WebInputEvent& event, | 501 bool BrowserPlugin::handleInputEvent(const blink::WebInputEvent& event, |
500 blink::WebCursorInfo& cursor_info) { | 502 blink::WebCursorInfo& cursor_info) { |
501 if (guest_crashed_ || !attached()) | 503 if (guest_crashed_ || !attached()) |
502 return false; | 504 return false; |
503 | 505 |
| 506 DCHECK(!blink::WebInputEvent::isTouchEventType(event.type)); |
| 507 |
504 if (event.type == blink::WebInputEvent::MouseWheel) { | 508 if (event.type == blink::WebInputEvent::MouseWheel) { |
505 auto wheel_event = static_cast<const blink::WebMouseWheelEvent&>(event); | 509 auto wheel_event = static_cast<const blink::WebMouseWheelEvent&>(event); |
506 if (wheel_event.resendingPluginId == browser_plugin_instance_id_) | 510 if (wheel_event.resendingPluginId == browser_plugin_instance_id_) |
507 return false; | 511 return false; |
508 } | 512 } |
509 | 513 |
510 if (blink::WebInputEvent::isGestureEventType(event.type)) { | 514 if (blink::WebInputEvent::isGestureEventType(event.type)) { |
511 auto gesture_event = static_cast<const blink::WebGestureEvent&>(event); | 515 auto gesture_event = static_cast<const blink::WebGestureEvent&>(event); |
512 if (gesture_event.resendingPluginId == browser_plugin_instance_id_) | 516 if (gesture_event.resendingPluginId == browser_plugin_instance_id_) |
513 return false; | 517 return false; |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
661 bool BrowserPlugin::HandleMouseLockedInputEvent( | 665 bool BrowserPlugin::HandleMouseLockedInputEvent( |
662 const blink::WebMouseEvent& event) { | 666 const blink::WebMouseEvent& event) { |
663 BrowserPluginManager::Get()->Send( | 667 BrowserPluginManager::Get()->Send( |
664 new BrowserPluginHostMsg_HandleInputEvent(browser_plugin_instance_id_, | 668 new BrowserPluginHostMsg_HandleInputEvent(browser_plugin_instance_id_, |
665 view_rect_, | 669 view_rect_, |
666 &event)); | 670 &event)); |
667 return true; | 671 return true; |
668 } | 672 } |
669 | 673 |
670 } // namespace content | 674 } // namespace content |
OLD | NEW |