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

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

Issue 2263863002: Remove implementation of Panels on OSes other than ChromeOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CR feedback Created 4 years, 4 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_timer.cc b/chrome/browser/ui/panels/panel_mouse_watcher_timer.cc
deleted file mode 100644
index dc4ff517a1e304562ae807bc67554d43b587402e..0000000000000000000000000000000000000000
--- a/chrome/browser/ui/panels/panel_mouse_watcher_timer.cc
+++ /dev/null
@@ -1,75 +0,0 @@
-// Copyright (c) 2012 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 "base/macros.h"
-#include "base/time/time.h"
-#include "base/timer/timer.h"
-#include "chrome/browser/ui/panels/panel_mouse_watcher.h"
-#include "ui/display/screen.h"
-#include "ui/gfx/geometry/point.h"
-
-// A timer based implementation of PanelMouseWatcher. Currently used for Gtk
-// and Mac panels implementations.
-class PanelMouseWatcherTimer : public PanelMouseWatcher {
- public:
- PanelMouseWatcherTimer();
- ~PanelMouseWatcherTimer() override;
-
- private:
- void Start() override;
- void Stop() override;
- bool IsActive() const override;
- gfx::Point GetMousePosition() const override;
-
- // Specifies the rate at which we want to sample the mouse position.
- static const int kMousePollingIntervalMs = 250;
-
- // Timer callback function.
- void DoWork();
- friend class base::RepeatingTimer;
-
- // 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 timer_;
-
- DISALLOW_COPY_AND_ASSIGN(PanelMouseWatcherTimer);
-};
-
-// static
-PanelMouseWatcher* PanelMouseWatcher::Create() {
- return new PanelMouseWatcherTimer();
-}
-
-PanelMouseWatcherTimer::PanelMouseWatcherTimer() {
-}
-
-PanelMouseWatcherTimer::~PanelMouseWatcherTimer() {
- DCHECK(!IsActive());
-}
-
-void PanelMouseWatcherTimer::Start() {
- DCHECK(!IsActive());
- timer_.Start(FROM_HERE,
- base::TimeDelta::FromMilliseconds(kMousePollingIntervalMs),
- this, &PanelMouseWatcherTimer::DoWork);
-}
-
-void PanelMouseWatcherTimer::Stop() {
- DCHECK(IsActive());
- timer_.Stop();
-}
-
-bool PanelMouseWatcherTimer::IsActive() const {
- return timer_.IsRunning();
-}
-
-gfx::Point PanelMouseWatcherTimer::GetMousePosition() const {
- return display::Screen::GetScreen()->GetCursorScreenPoint();
-}
-
-void PanelMouseWatcherTimer::DoWork() {
- NotifyMouseMovement(GetMousePosition());
-}
« no previous file with comments | « chrome/browser/ui/panels/panel_mouse_watcher_observer.h ('k') | chrome/browser/ui/panels/panel_mouse_watcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698