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

Unified Diff: chrome/browser/ui/panels/panel_mouse_watcher_gtk.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_gtk.cc
diff --git a/chrome/browser/ui/panels/panel_mouse_watcher_gtk.cc b/chrome/browser/ui/panels/panel_mouse_watcher_gtk.cc
deleted file mode 100644
index 9ae6002e10b6ee71be7b129867e2e0a1d0a5f810..0000000000000000000000000000000000000000
--- a/chrome/browser/ui/panels/panel_mouse_watcher_gtk.cc
+++ /dev/null
@@ -1,77 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// 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"
-#include "chrome/browser/ui/panels/panel_manager.h"
-#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 {
- public:
- // Returns the singleton instance.
- static PanelMouseWatcherGtk* GetInstance();
-
- virtual ~PanelMouseWatcherGtk();
-
- protected:
- virtual void Start();
- virtual void Stop();
-
- private:
- // Specifies the rate at which we want to sample the mouse position.
- static const int kMousePollingIntervalMs = 250;
-
- PanelMouseWatcherGtk();
- friend struct DefaultSingletonTraits<PanelMouseWatcherGtk>;
-
- // Timer callback function.
- void DoWork();
- friend class base::RepeatingTimer<PanelMouseWatcherGtk>;
-
- // 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
- // 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_;
-
- DISALLOW_COPY_AND_ASSIGN(PanelMouseWatcherGtk);
-};
-
-// static
-PanelMouseWatcher* PanelMouseWatcher::GetInstance() {
- return PanelMouseWatcherGtk::GetInstance();
-}
-
-// static
-PanelMouseWatcherGtk* PanelMouseWatcherGtk::GetInstance() {
- return Singleton<PanelMouseWatcherGtk>::get();
-}
-
-PanelMouseWatcherGtk::PanelMouseWatcherGtk() : PanelMouseWatcher() {
-}
-
-PanelMouseWatcherGtk::~PanelMouseWatcherGtk() {
-}
-
-void PanelMouseWatcherGtk::Start() {
- DCHECK(!timer_.IsRunning());
- timer_.Start(FROM_HERE,
- base::TimeDelta::FromMilliseconds(kMousePollingIntervalMs),
- this, &PanelMouseWatcherGtk::DoWork);
-}
-
-void PanelMouseWatcherGtk::Stop() {
- DCHECK(timer_.IsRunning());
- timer_.Stop();
-}
-
-void PanelMouseWatcherGtk::DoWork() {
- HandleMouseMovement(gfx::Screen::GetCursorScreenPoint());
-}

Powered by Google App Engine
This is Rietveld 408576698