Index: trunk/src/chrome/browser/chromeos/policy/recommendation_restorer.h |
=================================================================== |
--- trunk/src/chrome/browser/chromeos/policy/recommendation_restorer.h (revision 207797) |
+++ trunk/src/chrome/browser/chromeos/policy/recommendation_restorer.h (working copy) |
@@ -1,74 +0,0 @@ |
-// Copyright 2013 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 CHROME_BROWSER_CHROMEOS_POLICY_RECOMMENDATION_RESTORER_H_ |
-#define CHROME_BROWSER_CHROMEOS_POLICY_RECOMMENDATION_RESTORER_H_ |
- |
-#include <string> |
- |
-#include "ash/wm/user_activity_observer.h" |
-#include "base/basictypes.h" |
-#include "base/compiler_specific.h" |
-#include "base/prefs/pref_change_registrar.h" |
-#include "base/timer.h" |
-#include "components/browser_context_keyed_service/browser_context_keyed_service.h" |
-#include "content/public/browser/notification_observer.h" |
-#include "content/public/browser/notification_registrar.h" |
- |
-class Profile; |
- |
-namespace policy { |
- |
-// Observes a set of prefs in the login profile. If any of the prefs has a |
-// recommended value, its user setting is cleared so that the recommendation can |
-// take effect. This happens immediately when the login screen is shown, when |
-// a session is being started and whenever recommended values change during a |
-// user session. On the login screen, user settings are cleared when the user |
-// becomes idle for one minute. |
-class RecommendationRestorer : public BrowserContextKeyedService, |
- public content::NotificationObserver, |
- public ash::UserActivityObserver { |
- public: |
- explicit RecommendationRestorer(Profile* profile); |
- virtual ~RecommendationRestorer(); |
- |
- // BrowserContextKeyedService: |
- virtual void Shutdown() OVERRIDE; |
- |
- // content::NotificationObserver: |
- virtual void Observe(int type, |
- const content::NotificationSource& source, |
- const content::NotificationDetails& details) OVERRIDE; |
- |
- // ash::UserActivityObserver::Observer: |
- virtual void OnUserActivity() OVERRIDE; |
- |
- // If a recommended value and a user setting exist for |pref_name|, clears the |
- // user setting so that the recommended value can take effect. If |
- // |allow_delay| is |true| and the login screen is being shown, a timer is |
- // started that will clear the setting when the user becomes idle for one |
- // minute. Otherwise, the setting is cleared immediately. |
- void Restore(bool allow_delay, const std::string& pref_name); |
- |
- private: |
- friend class RecommendationRestorerTest; |
- |
- void RestoreAll(); |
- |
- void StartTimer(); |
- void StopTimer(); |
- |
- PrefChangeRegistrar pref_change_registrar_; |
- content::NotificationRegistrar notification_registrar_; |
- |
- bool logged_in_; |
- |
- base::OneShotTimer<RecommendationRestorer> restore_timer_; |
- |
- DISALLOW_COPY_AND_ASSIGN(RecommendationRestorer); |
-}; |
- |
-} // namespace policy |
- |
-#endif // CHROME_BROWSER_CHROMEOS_POLICY_RECOMMENDATION_RESTORER_H_ |