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
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_UI_PANELS_PANEL_MOUSE_WATCHER_H_
6 #define CHROME_BROWSER_UI_PANELS_PANEL_MOUSE_WATCHER_H_
8 #include "base/gtest_prod_util.h"
9 #include "base/observer_list.h"
15 class PanelMouseWatcherObserver
;
17 // This is the base class for functionality to watch for mouse movements.
18 // The specific implementation of this abstract class differ in how they
19 // track mouse movements.
20 class PanelMouseWatcher
{
22 // Returns an instance of the platform specific implementation.
23 static PanelMouseWatcher
* Create();
25 // clang gives an error asking for an out of line destructor.
26 virtual ~PanelMouseWatcher();
28 void AddObserver(PanelMouseWatcherObserver
* observer
);
29 void RemoveObserver(PanelMouseWatcherObserver
* observer
);
31 // Returns current mouse position. This may be different from the
32 // mouse position in NotifyMouseMovement.
33 virtual gfx::Point
GetMousePosition() const = 0;
38 // |mouse_position| is in screen coordinates.
39 virtual void NotifyMouseMovement(const gfx::Point
& mouse_position
);
41 // Returns true if watching mouse movements.
42 virtual bool IsActive() const = 0;
45 friend class PanelMouseWatcherTest
;
46 FRIEND_TEST_ALL_PREFIXES(PanelMouseWatcherTest
, StartStopWatching
);
47 friend class BasePanelBrowserTest
;
49 // Start/stop tracking mouse movements.
50 virtual void Start() = 0;
51 virtual void Stop() = 0;
53 base::ObserverList
<PanelMouseWatcherObserver
> observers_
;
56 #endif // CHROME_BROWSER_UI_PANELS_PANEL_MOUSE_WATCHER_H_