| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/views/mouse_watcher.h" | 5 #include "ui/views/mouse_watcher.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/event_types.h" | 9 #include "base/event_types.h" |
| 10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 | 23 |
| 24 class MouseWatcher::Observer : public ui::EventHandler { | 24 class MouseWatcher::Observer : public ui::EventHandler { |
| 25 public: | 25 public: |
| 26 explicit Observer(MouseWatcher* mouse_watcher) | 26 explicit Observer(MouseWatcher* mouse_watcher) |
| 27 : mouse_watcher_(mouse_watcher), | 27 : mouse_watcher_(mouse_watcher), |
| 28 event_monitor_(EventMonitor::CreateApplicationMonitor(this)), | 28 event_monitor_(EventMonitor::CreateApplicationMonitor(this)), |
| 29 notify_listener_factory_(this) { | 29 notify_listener_factory_(this) { |
| 30 } | 30 } |
| 31 | 31 |
| 32 // ui::EventHandler implementation: | 32 // ui::EventHandler implementation: |
| 33 virtual void OnMouseEvent(ui::MouseEvent* event) override { | 33 void OnMouseEvent(ui::MouseEvent* event) override { |
| 34 switch (event->type()) { | 34 switch (event->type()) { |
| 35 case ui::ET_MOUSE_MOVED: | 35 case ui::ET_MOUSE_MOVED: |
| 36 case ui::ET_MOUSE_DRAGGED: | 36 case ui::ET_MOUSE_DRAGGED: |
| 37 HandleMouseEvent(MouseWatcherHost::MOUSE_MOVE); | 37 HandleMouseEvent(MouseWatcherHost::MOUSE_MOVE); |
| 38 break; | 38 break; |
| 39 case ui::ET_MOUSE_EXITED: | 39 case ui::ET_MOUSE_EXITED: |
| 40 HandleMouseEvent(MouseWatcherHost::MOUSE_EXIT); | 40 HandleMouseEvent(MouseWatcherHost::MOUSE_EXIT); |
| 41 break; | 41 break; |
| 42 case ui::ET_MOUSE_PRESSED: | 42 case ui::ET_MOUSE_PRESSED: |
| 43 HandleMouseEvent(MouseWatcherHost::MOUSE_PRESS); | 43 HandleMouseEvent(MouseWatcherHost::MOUSE_PRESS); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 void MouseWatcher::Stop() { | 115 void MouseWatcher::Stop() { |
| 116 observer_.reset(NULL); | 116 observer_.reset(NULL); |
| 117 } | 117 } |
| 118 | 118 |
| 119 void MouseWatcher::NotifyListener() { | 119 void MouseWatcher::NotifyListener() { |
| 120 observer_.reset(NULL); | 120 observer_.reset(NULL); |
| 121 listener_->MouseMovedOutOfHost(); | 121 listener_->MouseMovedOutOfHost(); |
| 122 } | 122 } |
| 123 | 123 |
| 124 } // namespace views | 124 } // namespace views |
| OLD | NEW |