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 #ifndef CHROME_BROWSER_UI_PANELS_PANEL_MOUSE_WATCHER_H_ | 5 #ifndef CHROME_BROWSER_UI_PANELS_PANEL_MOUSE_WATCHER_H_ |
6 #define CHROME_BROWSER_UI_PANELS_PANEL_MOUSE_WATCHER_H_ | 6 #define CHROME_BROWSER_UI_PANELS_PANEL_MOUSE_WATCHER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/gtest_prod_util.h" | 9 #include "base/gtest_prod_util.h" |
10 #include "base/observer_list.h" | 10 #include "base/observer_list.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 public: | 22 public: |
23 // Returns an instance of the platform specific implementation. | 23 // Returns an instance of the platform specific implementation. |
24 static PanelMouseWatcher* Create(); | 24 static PanelMouseWatcher* Create(); |
25 | 25 |
26 // clang gives an error asking for an out of line destructor. | 26 // clang gives an error asking for an out of line destructor. |
27 virtual ~PanelMouseWatcher(); | 27 virtual ~PanelMouseWatcher(); |
28 | 28 |
29 void AddObserver(PanelMouseWatcherObserver* observer); | 29 void AddObserver(PanelMouseWatcherObserver* observer); |
30 void RemoveObserver(PanelMouseWatcherObserver* observer); | 30 void RemoveObserver(PanelMouseWatcherObserver* observer); |
31 | 31 |
| 32 // Returns current mouse position. This may be different from the |
| 33 // mouse position in NotifyMouseMovement. |
| 34 virtual gfx::Point GetMousePosition() const = 0; |
| 35 |
32 protected: | 36 protected: |
33 PanelMouseWatcher(); | 37 PanelMouseWatcher(); |
34 | 38 |
35 // |mouse_position| is in screen coordinates. | 39 // |mouse_position| is in screen coordinates. |
36 void NotifyMouseMovement(const gfx::Point& mouse_position); | 40 virtual void NotifyMouseMovement(const gfx::Point& mouse_position); |
37 | 41 |
38 // Returns true if watching mouse movements. | 42 // Returns true if watching mouse movements. |
39 virtual bool IsActive() const = 0; | 43 virtual bool IsActive() const = 0; |
40 | 44 |
41 private: | 45 private: |
42 friend class PanelMouseWatcherTest; | 46 friend class PanelMouseWatcherTest; |
43 FRIEND_TEST_ALL_PREFIXES(PanelMouseWatcherTest, StartStopWatching); | 47 FRIEND_TEST_ALL_PREFIXES(PanelMouseWatcherTest, StartStopWatching); |
44 friend class BasePanelBrowserTest; | 48 friend class BasePanelBrowserTest; |
45 FRIEND_TEST_ALL_PREFIXES(PanelOverflowBrowserTest, FullScreenMode); | 49 FRIEND_TEST_ALL_PREFIXES(PanelOverflowBrowserTest, FullScreenMode); |
46 | 50 |
47 // Start/stop tracking mouse movements. | 51 // Start/stop tracking mouse movements. |
48 virtual void Start() = 0; | 52 virtual void Start() = 0; |
49 virtual void Stop() = 0; | 53 virtual void Stop() = 0; |
50 | 54 |
51 ObserverList<PanelMouseWatcherObserver> observers_; | 55 ObserverList<PanelMouseWatcherObserver> observers_; |
52 }; | 56 }; |
53 | 57 |
54 #endif // CHROME_BROWSER_UI_PANELS_PANEL_MOUSE_WATCHER_H_ | 58 #endif // CHROME_BROWSER_UI_PANELS_PANEL_MOUSE_WATCHER_H_ |
OLD | NEW |