| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "views/mouse_watcher.h" | 5 #include "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.h" | 11 #include "base/message_loop.h" |
| 12 #include "ui/base/events.h" | 12 #include "ui/base/events.h" |
| 13 #include "ui/gfx/screen.h" | 13 #include "ui/gfx/screen.h" |
| 14 #include "ui/views/widget/widget.h" |
| 14 #include "views/view.h" | 15 #include "views/view.h" |
| 15 #include "views/widget/widget.h" | |
| 16 | 16 |
| 17 namespace views { | 17 namespace views { |
| 18 | 18 |
| 19 // Amount of time between when the mouse moves outside the view's zone and when | 19 // Amount of time between when the mouse moves outside the view's zone and when |
| 20 // the listener is notified. | 20 // the listener is notified. |
| 21 const int kNotifyListenerTimeMs = 300; | 21 const int kNotifyListenerTimeMs = 300; |
| 22 | 22 |
| 23 class MouseWatcher::Observer : public MessageLoopForUI::Observer { | 23 class MouseWatcher::Observer : public MessageLoopForUI::Observer { |
| 24 public: | 24 public: |
| 25 explicit Observer(MouseWatcher* mouse_watcher) | 25 explicit Observer(MouseWatcher* mouse_watcher) |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 void MouseWatcher::Stop() { | 202 void MouseWatcher::Stop() { |
| 203 observer_.reset(NULL); | 203 observer_.reset(NULL); |
| 204 } | 204 } |
| 205 | 205 |
| 206 void MouseWatcher::NotifyListener() { | 206 void MouseWatcher::NotifyListener() { |
| 207 observer_.reset(NULL); | 207 observer_.reset(NULL); |
| 208 listener_->MouseMovedOutOfView(); | 208 listener_->MouseMovedOutOfView(); |
| 209 } | 209 } |
| 210 | 210 |
| 211 } // namespace views | 211 } // namespace views |
| OLD | NEW |