| 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 #ifndef UI_VIEWS_MOUSE_WATCHER_VIEW_HOST_H_ | 5 #ifndef UI_VIEWS_MOUSE_WATCHER_VIEW_HOST_H_ |
| 6 #define UI_VIEWS_MOUSE_WATCHER_VIEW_HOST_H_ | 6 #define UI_VIEWS_MOUSE_WATCHER_VIEW_HOST_H_ |
| 7 | 7 |
| 8 #include "ui/views/mouse_watcher.h" | 8 #include "ui/views/mouse_watcher.h" |
| 9 | 9 |
| 10 namespace views { | 10 namespace views { |
| 11 | 11 |
| 12 class View; | 12 class View; |
| 13 | 13 |
| 14 class VIEWS_EXPORT MouseWatcherViewHost : public MouseWatcherHost { | 14 class VIEWS_EXPORT MouseWatcherViewHost : public MouseWatcherHost { |
| 15 public: | 15 public: |
| 16 // Creates a new MouseWatcherViewHost. |hot_zone_insets| is added to the | 16 // Creates a new MouseWatcherViewHost. |hot_zone_insets| is added to the |
| 17 // bounds of the view to determine the active zone. For example, if | 17 // bounds of the view to determine the active zone. For example, if |
| 18 // |hot_zone_insets.bottom()| is 10, then the listener is not notified if | 18 // |hot_zone_insets.bottom()| is 10, then the listener is not notified if |
| 19 // the y coordinate is between the origin of the view and height of the view | 19 // the y coordinate is between the origin of the view and height of the view |
| 20 // plus 10. | 20 // plus 10. |
| 21 MouseWatcherViewHost(View* view, const gfx::Insets& hot_zone_insets); | 21 MouseWatcherViewHost(View* view, const gfx::Insets& hot_zone_insets); |
| 22 virtual ~MouseWatcherViewHost(); | 22 ~MouseWatcherViewHost() override; |
| 23 | 23 |
| 24 // MouseWatcherHost. | 24 // MouseWatcherHost. |
| 25 virtual bool Contains(const gfx::Point& screen_point, | 25 bool Contains(const gfx::Point& screen_point, MouseEventType type) override; |
| 26 MouseEventType type) override; | |
| 27 | 26 |
| 28 private: | 27 private: |
| 29 bool IsCursorInViewZone(const gfx::Point& screen_point); | 28 bool IsCursorInViewZone(const gfx::Point& screen_point); |
| 30 bool IsMouseOverWindow(); | 29 bool IsMouseOverWindow(); |
| 31 | 30 |
| 32 // View we're listening for events over. | 31 // View we're listening for events over. |
| 33 View* view_; | 32 View* view_; |
| 34 // Insets added to the bounds of the view. | 33 // Insets added to the bounds of the view. |
| 35 const gfx::Insets hot_zone_insets_; | 34 const gfx::Insets hot_zone_insets_; |
| 36 | 35 |
| 37 DISALLOW_COPY_AND_ASSIGN(MouseWatcherViewHost); | 36 DISALLOW_COPY_AND_ASSIGN(MouseWatcherViewHost); |
| 38 }; | 37 }; |
| 39 | 38 |
| 40 } // namespace views | 39 } // namespace views |
| 41 | 40 |
| 42 #endif // UI_VIEWS_MOUSE_WATCHER_VIEW_HOST_H_ | 41 #endif // UI_VIEWS_MOUSE_WATCHER_VIEW_HOST_H_ |
| OLD | NEW |