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. | |
jianli
2012/05/15 22:59:47
Please comment that this would return the latest m
jennb
2012/05/16 00:47:09
Done.
| |
33 virtual gfx::Point GetMousePosition() const = 0; | |
34 | |
32 protected: | 35 protected: |
33 PanelMouseWatcher(); | 36 PanelMouseWatcher(); |
34 | 37 |
35 // |mouse_position| is in screen coordinates. | 38 // |mouse_position| is in screen coordinates. |
36 void NotifyMouseMovement(const gfx::Point& mouse_position); | 39 virtual void NotifyMouseMovement(const gfx::Point& mouse_position); |
37 | 40 |
38 // Returns true if watching mouse movements. | 41 // Returns true if watching mouse movements. |
39 virtual bool IsActive() const = 0; | 42 virtual bool IsActive() const = 0; |
40 | 43 |
41 private: | 44 private: |
42 friend class PanelMouseWatcherTest; | 45 friend class PanelMouseWatcherTest; |
43 FRIEND_TEST_ALL_PREFIXES(PanelMouseWatcherTest, StartStopWatching); | 46 FRIEND_TEST_ALL_PREFIXES(PanelMouseWatcherTest, StartStopWatching); |
44 friend class BasePanelBrowserTest; | 47 friend class BasePanelBrowserTest; |
45 FRIEND_TEST_ALL_PREFIXES(PanelOverflowBrowserTest, FullScreenMode); | 48 FRIEND_TEST_ALL_PREFIXES(PanelOverflowBrowserTest, FullScreenMode); |
46 | 49 |
47 // Start/stop tracking mouse movements. | 50 // Start/stop tracking mouse movements. |
48 virtual void Start() = 0; | 51 virtual void Start() = 0; |
49 virtual void Stop() = 0; | 52 virtual void Stop() = 0; |
50 | 53 |
51 ObserverList<PanelMouseWatcherObserver> observers_; | 54 ObserverList<PanelMouseWatcherObserver> observers_; |
52 }; | 55 }; |
53 | 56 |
54 #endif // CHROME_BROWSER_UI_PANELS_PANEL_MOUSE_WATCHER_H_ | 57 #endif // CHROME_BROWSER_UI_PANELS_PANEL_MOUSE_WATCHER_H_ |
OLD | NEW |