OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "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" |
11 #include "base/message_loop/message_loop.h" | 11 #include "base/message_loop/message_loop.h" |
| 12 #include "ui/aura/env.h" |
| 13 #include "ui/aura/window.h" |
| 14 #include "ui/events/event.h" |
12 #include "ui/events/event_constants.h" | 15 #include "ui/events/event_constants.h" |
| 16 #include "ui/events/event_handler.h" |
13 #include "ui/events/event_utils.h" | 17 #include "ui/events/event_utils.h" |
14 #include "ui/gfx/screen.h" | 18 #include "ui/gfx/screen.h" |
15 | 19 |
16 #if defined(USE_AURA) | |
17 #include "ui/aura/env.h" | |
18 #include "ui/aura/window.h" | |
19 #include "ui/events/event.h" | |
20 #include "ui/events/event_handler.h" | |
21 #endif | |
22 | |
23 namespace views { | 20 namespace views { |
24 | 21 |
25 // Amount of time between when the mouse moves outside the Host's zone and when | 22 // Amount of time between when the mouse moves outside the Host's zone and when |
26 // the listener is notified. | 23 // the listener is notified. |
27 const int kNotifyListenerTimeMs = 300; | 24 const int kNotifyListenerTimeMs = 300; |
28 | 25 |
29 class MouseWatcher::Observer : public ui::EventHandler { | 26 class MouseWatcher::Observer : public ui::EventHandler { |
30 public: | 27 public: |
31 explicit Observer(MouseWatcher* mouse_watcher) | 28 explicit Observer(MouseWatcher* mouse_watcher) |
32 : mouse_watcher_(mouse_watcher), | 29 : mouse_watcher_(mouse_watcher), |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 void MouseWatcher::Stop() { | 116 void MouseWatcher::Stop() { |
120 observer_.reset(NULL); | 117 observer_.reset(NULL); |
121 } | 118 } |
122 | 119 |
123 void MouseWatcher::NotifyListener() { | 120 void MouseWatcher::NotifyListener() { |
124 observer_.reset(NULL); | 121 observer_.reset(NULL); |
125 listener_->MouseMovedOutOfHost(); | 122 listener_->MouseMovedOutOfHost(); |
126 } | 123 } |
127 | 124 |
128 } // namespace views | 125 } // namespace views |
OLD | NEW |