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

Unified Diff: ui/wm/core/user_activity_detector.h

Issue 833893003: Move UserActivityDetector to ui/base/user_activity/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: don't build test on android Created 5 years, 11 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
« no previous file with comments | « ui/wm/BUILD.gn ('k') | ui/wm/core/user_activity_detector.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/wm/core/user_activity_detector.h
diff --git a/ui/wm/core/user_activity_detector.h b/ui/wm/core/user_activity_detector.h
deleted file mode 100644
index 55ffc24d4b96b4f3da68f0f96791e218186fcab5..0000000000000000000000000000000000000000
--- a/ui/wm/core/user_activity_detector.h
+++ /dev/null
@@ -1,84 +0,0 @@
-// Copyright 2014 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.
-
-#ifndef UI_WM_CORE_USER_ACTIVITY_DETECTOR_H_
-#define UI_WM_CORE_USER_ACTIVITY_DETECTOR_H_
-
-#include "base/basictypes.h"
-#include "base/compiler_specific.h"
-#include "base/observer_list.h"
-#include "base/time/time.h"
-#include "ui/events/event_handler.h"
-#include "ui/wm/wm_export.h"
-
-namespace wm {
-
-class UserActivityObserver;
-
-// Watches for input events and notifies observers that the user is active.
-class WM_EXPORT UserActivityDetector : public ui::EventHandler {
- public:
- // Minimum amount of time between notifications to observers.
- static const int kNotifyIntervalMs;
-
- // Amount of time that mouse events should be ignored after notification
- // is received that displays' power states are being changed.
- static const int kDisplayPowerChangeIgnoreMouseMs;
-
- UserActivityDetector();
- ~UserActivityDetector() override;
-
- // Returns the UserActivityDetector instance if one was created.
- static UserActivityDetector* Get();
-
- base::TimeTicks last_activity_time() const { return last_activity_time_; }
-
- void set_now_for_test(base::TimeTicks now) { now_for_test_ = now; }
-
- bool HasObserver(const UserActivityObserver* observer) const;
- void AddObserver(UserActivityObserver* observer);
- void RemoveObserver(UserActivityObserver* observer);
-
- // Called when displays are about to be turned on or off.
- void OnDisplayPowerChanging();
-
- // ui::EventHandler implementation.
- void OnKeyEvent(ui::KeyEvent* event) override;
- void OnMouseEvent(ui::MouseEvent* event) override;
- void OnScrollEvent(ui::ScrollEvent* event) override;
- void OnTouchEvent(ui::TouchEvent* event) override;
- void OnGestureEvent(ui::GestureEvent* event) override;
-
- private:
- // Returns |now_for_test_| if set or base::TimeTicks::Now() otherwise.
- base::TimeTicks GetCurrentTime() const;
-
- // Updates |last_activity_time_|. Additionally notifies observers and
- // updates |last_observer_notification_time_| if enough time has passed
- // since the last notification.
- void HandleActivity(const ui::Event* event);
-
- ObserverList<UserActivityObserver> observers_;
-
- // Last time at which user activity was observed.
- base::TimeTicks last_activity_time_;
-
- // Last time at which we notified observers that the user was active.
- base::TimeTicks last_observer_notification_time_;
-
- // If set, used when the current time is needed. This can be set by tests to
- // simulate the passage of time.
- base::TimeTicks now_for_test_;
-
- // If set, mouse events will be ignored until this time is reached. This
- // is to avoid reporting mouse events that occur when displays are turned
- // on or off as user activity.
- base::TimeTicks honor_mouse_events_time_;
-
- DISALLOW_COPY_AND_ASSIGN(UserActivityDetector);
-};
-
-} // namespace wm
-
-#endif // UI_WM_CORE_USER_ACTIVITY_DETECTOR_H_
« no previous file with comments | « ui/wm/BUILD.gn ('k') | ui/wm/core/user_activity_detector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698