Chromium Code Reviews| 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..636562754f972d6108f490ac7924745a07acc5ee 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(); |
|
Mattias Nissler (ping if slow)
2010/12/21 16:42:24
I'm not so sure whether we really want all this re
danno
2010/12/22 11:02:17
Right, the reasons are different, but the underlyi
|
| private: |
| friend class AsynchronousPolicyLoaderTest; |
| + // Finishes loader finitialization after the threading system has been fully |
|
Mattias Nissler (ping if slow)
2010/12/22 08:45:53
s/finitialization/initialization/
danno
2010/12/22 11:02:17
Done.
|
| + // 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 that a policy reload will be triggered as a fallback. |
|
Mattias Nissler (ping if slow)
2010/12/22 08:45:53
s/that/at which/?
danno
2010/12/22 11:02:17
Done.
|
| + 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); |
| }; |