#ifndef CHROME_BROWSER_CHROMEOS_POLICY_RECOMMENDATION_RESTORER_H_
#define CHROME_BROWSER_CHROMEOS_POLICY_RECOMMENDATION_RESTORER_H_
#include <string>
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/prefs/pref_change_registrar.h"
#include "base/timer/timer.h"
#include "components/keyed_service/core/keyed_service.h"
#include "content/public/browser/notification_observer.h"
#include "content/public/browser/notification_registrar.h"
#include "ui/wm/core/user_activity_observer.h"
class Profile;
namespace policy {
class RecommendationRestorer : public KeyedService,
public content::NotificationObserver,
public wm::UserActivityObserver {
public:
explicit RecommendationRestorer(Profile* profile);
virtual ~RecommendationRestorer();
virtual void Shutdown() OVERRIDE;
virtual void Observe(int type,
const content::NotificationSource& source,
const content::NotificationDetails& details) OVERRIDE;
virtual void OnUserActivity(const ui::Event* event) OVERRIDE;
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);
};
}
#endif