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/macros.h" | 10 #include "base/macros.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 } | 76 } |
77 } | 77 } |
78 | 78 |
79 void NotifyListener() { | 79 void NotifyListener() { |
80 mouse_watcher_->NotifyListener(); | 80 mouse_watcher_->NotifyListener(); |
81 // WARNING: we've been deleted. | 81 // WARNING: we've been deleted. |
82 } | 82 } |
83 | 83 |
84 private: | 84 private: |
85 MouseWatcher* mouse_watcher_; | 85 MouseWatcher* mouse_watcher_; |
86 scoped_ptr<views::EventMonitor> event_monitor_; | 86 std::unique_ptr<views::EventMonitor> event_monitor_; |
87 | 87 |
88 // A factory that is used to construct a delayed callback to the listener. | 88 // A factory that is used to construct a delayed callback to the listener. |
89 base::WeakPtrFactory<Observer> notify_listener_factory_; | 89 base::WeakPtrFactory<Observer> notify_listener_factory_; |
90 | 90 |
91 DISALLOW_COPY_AND_ASSIGN(Observer); | 91 DISALLOW_COPY_AND_ASSIGN(Observer); |
92 }; | 92 }; |
93 | 93 |
94 MouseWatcherListener::~MouseWatcherListener() { | 94 MouseWatcherListener::~MouseWatcherListener() { |
95 } | 95 } |
96 | 96 |
(...skipping 19 matching lines...) Expand all 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 |