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

Unified Diff: chrome/browser/chromeos/policy/recommendation_restorer.cc

Issue 693643004: Make UserActivityDetector a singleton (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@athena_do_not_use_ash45
Patch Set: Created 6 years, 1 month 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/chromeos/policy/recommendation_restorer.cc
diff --git a/chrome/browser/chromeos/policy/recommendation_restorer.cc b/chrome/browser/chromeos/policy/recommendation_restorer.cc
index 6b85e0f42eed8b8b6d94f26e157760e38551ff56..7dfcbd91cc3a2e560f2108a17fe8a3e92cf9861c 100644
--- a/chrome/browser/chromeos/policy/recommendation_restorer.cc
+++ b/chrome/browser/chromeos/policy/recommendation_restorer.cc
@@ -4,7 +4,6 @@
#include "chrome/browser/chromeos/policy/recommendation_restorer.h"
-#include "ash/shell.h"
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/location.h"
@@ -107,11 +106,14 @@ void RecommendationRestorer::Restore(bool allow_delay,
if (logged_in_) {
allow_delay = false;
- } else if (allow_delay && ash::Shell::HasInstance()) {
+ } else if (allow_delay) {
// Skip the delay if there has been no user input since the browser started.
const wm::UserActivityDetector* user_activity_detector =
- ash::Shell::GetInstance()->user_activity_detector();
- allow_delay = !user_activity_detector->last_activity_time().is_null();
+ wm::UserActivityDetector::Get();
+ if (user_activity_detector &&
+ user_activity_detector->last_activity_time().is_null()) {
+ allow_delay = false;
+ }
}
if (allow_delay)
@@ -133,12 +135,10 @@ void RecommendationRestorer::StartTimer() {
// Listen for user activity so that the timer can be reset while the user is
// active, causing it to fire only when the user remains idle for
// |kRestoreDelayInMs|.
- if (ash::Shell::HasInstance()) {
- wm::UserActivityDetector* user_activity_detector =
- ash::Shell::GetInstance()->user_activity_detector();
- if (!user_activity_detector->HasObserver(this))
- user_activity_detector->AddObserver(this);
- }
+ wm::UserActivityDetector* user_activity_detector =
+ wm::UserActivityDetector::Get();
+ if (user_activity_detector && !user_activity_detector->HasObserver(this))
+ user_activity_detector->AddObserver(this);
// There should be a separate timer for each pref. However, in the common
// case of the user changing settings, a single timer is sufficient. This is
@@ -156,8 +156,8 @@ void RecommendationRestorer::StartTimer() {
void RecommendationRestorer::StopTimer() {
restore_timer_.Stop();
- if (ash::Shell::HasInstance())
- ash::Shell::GetInstance()->user_activity_detector()->RemoveObserver(this);
+ if (wm::UserActivityDetector::Get())
+ wm::UserActivityDetector::Get()->RemoveObserver(this);
}
} // namespace policy
« no previous file with comments | « chrome/browser/chromeos/login/ui/webui_login_display.cc ('k') | chrome/browser/chromeos/session_length_limiter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698