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 18 matching lines...) Expand all Loading... |
29 : mouse_watcher_(mouse_watcher), | 29 : mouse_watcher_(mouse_watcher), |
30 notify_listener_factory_(this) { | 30 notify_listener_factory_(this) { |
31 aura::Env::GetInstance()->AddPreTargetHandler(this); | 31 aura::Env::GetInstance()->AddPreTargetHandler(this); |
32 } | 32 } |
33 | 33 |
34 virtual ~Observer() { | 34 virtual ~Observer() { |
35 aura::Env::GetInstance()->RemovePreTargetHandler(this); | 35 aura::Env::GetInstance()->RemovePreTargetHandler(this); |
36 } | 36 } |
37 | 37 |
38 // ui::EventHandler implementation: | 38 // ui::EventHandler implementation: |
39 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE { | 39 virtual void OnMouseEvent(ui::MouseEvent* event) override { |
40 switch (event->type()) { | 40 switch (event->type()) { |
41 case ui::ET_MOUSE_MOVED: | 41 case ui::ET_MOUSE_MOVED: |
42 case ui::ET_MOUSE_DRAGGED: | 42 case ui::ET_MOUSE_DRAGGED: |
43 HandleMouseEvent(MouseWatcherHost::MOUSE_MOVE); | 43 HandleMouseEvent(MouseWatcherHost::MOUSE_MOVE); |
44 break; | 44 break; |
45 case ui::ET_MOUSE_EXITED: | 45 case ui::ET_MOUSE_EXITED: |
46 HandleMouseEvent(MouseWatcherHost::MOUSE_EXIT); | 46 HandleMouseEvent(MouseWatcherHost::MOUSE_EXIT); |
47 break; | 47 break; |
48 default: | 48 default: |
49 break; | 49 break; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 void MouseWatcher::Stop() { | 116 void MouseWatcher::Stop() { |
117 observer_.reset(NULL); | 117 observer_.reset(NULL); |
118 } | 118 } |
119 | 119 |
120 void MouseWatcher::NotifyListener() { | 120 void MouseWatcher::NotifyListener() { |
121 observer_.reset(NULL); | 121 observer_.reset(NULL); |
122 listener_->MouseMovedOutOfHost(); | 122 listener_->MouseMovedOutOfHost(); |
123 } | 123 } |
124 | 124 |
125 } // namespace views | 125 } // namespace views |
OLD | NEW |