| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CHROME_BROWSER_POLICY_ASYNC_POLICY_LOADER_H_ | 5 #ifndef COMPONENTS_POLICY_CORE_COMMON_ASYNC_POLICY_LOADER_H_ |
| 6 #define CHROME_BROWSER_POLICY_ASYNC_POLICY_LOADER_H_ | 6 #define COMPONENTS_POLICY_CORE_COMMON_ASYNC_POLICY_LOADER_H_ |
| 7 | 7 |
| 8 #include "base/callback.h" | 8 #include "base/callback.h" |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
| 12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "components/policy/core/common/schema_map.h" | 13 #include "components/policy/core/common/schema_map.h" |
| 14 #include "components/policy/policy_export.h" |
| 14 | 15 |
| 15 namespace base { | 16 namespace base { |
| 16 class SequencedTaskRunner; | 17 class SequencedTaskRunner; |
| 17 } | 18 } |
| 18 | 19 |
| 19 namespace policy { | 20 namespace policy { |
| 20 | 21 |
| 21 class PolicyBundle; | 22 class PolicyBundle; |
| 22 | 23 |
| 23 // Base implementation for platform-specific policy loaders. Together with the | 24 // Base implementation for platform-specific policy loaders. Together with the |
| 24 // AsyncPolicyProvider, this base implementation takes care of the initial load, | 25 // AsyncPolicyProvider, this base implementation takes care of the initial load, |
| 25 // periodic reloads, watching file changes, refreshing policies and object | 26 // periodic reloads, watching file changes, refreshing policies and object |
| 26 // lifetime. | 27 // lifetime. |
| 27 // | 28 // |
| 28 // All methods are invoked on the background |task_runner_|, including the | 29 // All methods are invoked on the background |task_runner_|, including the |
| 29 // destructor. The only exceptions are the constructor (which may be called on | 30 // destructor. The only exceptions are the constructor (which may be called on |
| 30 // any thread), and the initial Load() which is called on the thread that owns | 31 // any thread), and the initial Load() which is called on the thread that owns |
| 31 // the provider. | 32 // the provider. |
| 32 // LastModificationTime() is also invoked once on that thread at startup. | 33 // LastModificationTime() is also invoked once on that thread at startup. |
| 33 class AsyncPolicyLoader { | 34 class POLICY_EXPORT AsyncPolicyLoader { |
| 34 public: | 35 public: |
| 35 explicit AsyncPolicyLoader( | 36 explicit AsyncPolicyLoader( |
| 36 scoped_refptr<base::SequencedTaskRunner> task_runner); | 37 scoped_refptr<base::SequencedTaskRunner> task_runner); |
| 37 virtual ~AsyncPolicyLoader(); | 38 virtual ~AsyncPolicyLoader(); |
| 38 | 39 |
| 39 // Gets a SequencedTaskRunner backed by the background thread. | 40 // Gets a SequencedTaskRunner backed by the background thread. |
| 40 base::SequencedTaskRunner* task_runner() const { return task_runner_.get(); } | 41 base::SequencedTaskRunner* task_runner() const { return task_runner_.get(); } |
| 41 | 42 |
| 42 // Returns the currently configured policies. Load() is always invoked on | 43 // Returns the currently configured policies. Load() is always invoked on |
| 43 // the background thread, except for the initial Load() at startup which is | 44 // the background thread, except for the initial Load() at startup which is |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 base::Time last_modification_clock_; | 112 base::Time last_modification_clock_; |
| 112 | 113 |
| 113 // The current policy schemas that this provider should load. | 114 // The current policy schemas that this provider should load. |
| 114 scoped_refptr<SchemaMap> schema_map_; | 115 scoped_refptr<SchemaMap> schema_map_; |
| 115 | 116 |
| 116 DISALLOW_COPY_AND_ASSIGN(AsyncPolicyLoader); | 117 DISALLOW_COPY_AND_ASSIGN(AsyncPolicyLoader); |
| 117 }; | 118 }; |
| 118 | 119 |
| 119 } // namespace policy | 120 } // namespace policy |
| 120 | 121 |
| 121 #endif // CHROME_BROWSER_POLICY_ASYNC_POLICY_LOADER_H_ | 122 #endif // COMPONENTS_POLICY_CORE_COMMON_ASYNC_POLICY_LOADER_H_ |
| OLD | NEW |