Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5039)

Unified Diff: chrome/browser/ui/panels/panel_mouse_watcher_timer.cc

Issue 7981012: Add Mouse hover behavior to Mac Panels when minimized (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cr feedback Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/panels/panel_mouse_watcher_timer.cc
diff --git a/chrome/browser/ui/panels/panel_mouse_watcher_gtk.cc b/chrome/browser/ui/panels/panel_mouse_watcher_timer.cc
similarity index 52%
rename from chrome/browser/ui/panels/panel_mouse_watcher_gtk.cc
rename to chrome/browser/ui/panels/panel_mouse_watcher_timer.cc
index 9ae6002e10b6ee71be7b129867e2e0a1d0a5f810..089d3e9bd83b56b7dcab8208449b3a3f084708dd 100644
--- a/chrome/browser/ui/panels/panel_mouse_watcher_gtk.cc
+++ b/chrome/browser/ui/panels/panel_mouse_watcher_timer.cc
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// #include "chrome/browser/ui/panels/panel_mouse_watcher_gtk.h"
-
#include "base/memory/singleton.h"
#include "base/time.h"
#include "base/timer.h"
@@ -11,14 +9,14 @@
#include "chrome/browser/ui/panels/panel_mouse_watcher.h"
#include "ui/gfx/screen.h"
-// A timer based implementation of PanelMouseWatcher. Currently used on Gtk
-// but could be used on any platform.
-class PanelMouseWatcherGtk : public PanelMouseWatcher {
+// A timer based implementation of PanelMouseWatcher. Currently used for Gtk
+// and Mac panels implementations.
+class PanelMouseWatcherTimer : public PanelMouseWatcher {
jennb 2011/09/21 21:21:26 Thanks for making this diff-able!
public:
// Returns the singleton instance.
- static PanelMouseWatcherGtk* GetInstance();
+ static PanelMouseWatcherTimer* GetInstance();
- virtual ~PanelMouseWatcherGtk();
+ virtual ~PanelMouseWatcherTimer();
protected:
virtual void Start();
@@ -28,50 +26,51 @@ class PanelMouseWatcherGtk : public PanelMouseWatcher {
// Specifies the rate at which we want to sample the mouse position.
static const int kMousePollingIntervalMs = 250;
- PanelMouseWatcherGtk();
- friend struct DefaultSingletonTraits<PanelMouseWatcherGtk>;
+ PanelMouseWatcherTimer();
+ friend struct DefaultSingletonTraits<PanelMouseWatcherTimer>;
// Timer callback function.
void DoWork();
- friend class base::RepeatingTimer<PanelMouseWatcherGtk>;
+ friend class base::RepeatingTimer<PanelMouseWatcherTimer>;
- // Timer used to track mouse movements. Gtk does not provide an easy way of
- // tracking mouse movements across applications. So we use a timer to
+ // Timer used to track mouse movements. Some OSes do not provide an easy way
+ // of tracking mouse movements across applications. So we use a timer to
// accomplish the same. This could also be more efficient as you end up
// getting a lot of notifications when tracking mouse movements.
- base::RepeatingTimer<PanelMouseWatcherGtk> timer_;
+ base::RepeatingTimer<PanelMouseWatcherTimer> timer_;
- DISALLOW_COPY_AND_ASSIGN(PanelMouseWatcherGtk);
+ DISALLOW_COPY_AND_ASSIGN(PanelMouseWatcherTimer);
};
// static
PanelMouseWatcher* PanelMouseWatcher::GetInstance() {
- return PanelMouseWatcherGtk::GetInstance();
+ return PanelMouseWatcherTimer::GetInstance();
}
// static
-PanelMouseWatcherGtk* PanelMouseWatcherGtk::GetInstance() {
- return Singleton<PanelMouseWatcherGtk>::get();
+PanelMouseWatcherTimer* PanelMouseWatcherTimer::GetInstance() {
+ return Singleton<PanelMouseWatcherTimer>::get();
}
-PanelMouseWatcherGtk::PanelMouseWatcherGtk() : PanelMouseWatcher() {
+PanelMouseWatcherTimer::PanelMouseWatcherTimer() : PanelMouseWatcher() {
}
-PanelMouseWatcherGtk::~PanelMouseWatcherGtk() {
+PanelMouseWatcherTimer::~PanelMouseWatcherTimer() {
+ DCHECK(!timer_.IsRunning());
}
-void PanelMouseWatcherGtk::Start() {
+void PanelMouseWatcherTimer::Start() {
DCHECK(!timer_.IsRunning());
timer_.Start(FROM_HERE,
base::TimeDelta::FromMilliseconds(kMousePollingIntervalMs),
- this, &PanelMouseWatcherGtk::DoWork);
+ this, &PanelMouseWatcherTimer::DoWork);
}
-void PanelMouseWatcherGtk::Stop() {
+void PanelMouseWatcherTimer::Stop() {
DCHECK(timer_.IsRunning());
timer_.Stop();
}
-void PanelMouseWatcherGtk::DoWork() {
+void PanelMouseWatcherTimer::DoWork() {
HandleMouseMovement(gfx::Screen::GetCursorScreenPoint());
}

Powered by Google App Engine
This is Rietveld 408576698