| Index: chrome/browser/policy/asynchronous_policy_loader.h
|
| diff --git a/chrome/browser/policy/asynchronous_policy_loader.h b/chrome/browser/policy/asynchronous_policy_loader.h
|
| index d88cdff53c48d352404eeafd7c71c57b637d4a71..8a5838f9d05e77082dcc027436d5ebb404496d41 100644
|
| --- a/chrome/browser/policy/asynchronous_policy_loader.h
|
| +++ b/chrome/browser/policy/asynchronous_policy_loader.h
|
| @@ -21,7 +21,8 @@ class AsynchronousPolicyLoader
|
| : public base::RefCountedThreadSafe<AsynchronousPolicyLoader> {
|
| public:
|
| explicit AsynchronousPolicyLoader(
|
| - AsynchronousPolicyProvider::Delegate* delegate);
|
| + AsynchronousPolicyProvider::Delegate* delegate,
|
| + int reload_interval_minutes);
|
|
|
| // Triggers initial policy load.
|
| virtual void Init();
|
| @@ -55,13 +56,32 @@ class AsynchronousPolicyLoader
|
| return delegate_.get();
|
| }
|
|
|
| - AsynchronousPolicyProvider* provider() {
|
| - return provider_;
|
| - }
|
| + // Performs start operations that must be performed on the file thread.
|
| + virtual void InitOnFileThread();
|
| +
|
| + // Performs stop operations that must be performed on the file thread.
|
| + virtual void StopOnFileThread();
|
| +
|
| + // Schedules a reload task to run when |delay| expires. Must be called on the
|
| + // file thread.
|
| + void ScheduleReloadTask(const base::TimeDelta& delay);
|
| +
|
| + // Schedules a reload task to run after the number of minutes specified
|
| + // in |reload_interval_minutes_|. Must be called on the file thread.
|
| + void ScheduleFallbackReloadTask();
|
| +
|
| + void CancelReloadTask();
|
| +
|
| + // Invoked from the reload task on the file thread.
|
| + void ReloadFromTask();
|
|
|
| private:
|
| friend class AsynchronousPolicyLoaderTest;
|
|
|
| + // Finishes loader initialization after the threading system has been fully
|
| + // intialized.
|
| + void InitAfterFileThreadAvailable();
|
| +
|
| // Replaces the existing policy to value map with a new one, sending
|
| // notification to the provider if there is a policy change. Must be called on
|
| // |origin_loop_| so that it's safe to call back into the provider, which is
|
| @@ -78,11 +98,21 @@ class AsynchronousPolicyLoader
|
| // called the constructor. See |origin_loop_| below.
|
| AsynchronousPolicyProvider* provider_;
|
|
|
| + // The reload task. Access only on the file thread. Holds a reference to the
|
| + // currently posted task, so we can cancel and repost it if necessary.
|
| + CancelableTask* reload_task_;
|
| +
|
| + // The interval at which a policy reload will be triggered as a fallback.
|
| + const base::TimeDelta reload_interval_;
|
| +
|
| // The message loop on which this object was constructed. Recorded so that
|
| // it's possible to call back into the non thread safe provider to fire the
|
| // notification.
|
| MessageLoop* origin_loop_;
|
|
|
| + // True if Stop has been called.
|
| + bool stopped_;
|
| +
|
| DISALLOW_COPY_AND_ASSIGN(AsynchronousPolicyLoader);
|
| };
|
|
|
|
|