OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_FILE_BASED_POLICY_LOADER_H_ | 5 #ifndef CHROME_BROWSER_POLICY_FILE_BASED_POLICY_LOADER_H_ |
6 #define CHROME_BROWSER_POLICY_FILE_BASED_POLICY_LOADER_H_ | 6 #define CHROME_BROWSER_POLICY_FILE_BASED_POLICY_LOADER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "chrome/browser/policy/asynchronous_policy_loader.h" | 9 #include "chrome/browser/policy/asynchronous_policy_loader.h" |
10 #include "chrome/browser/policy/file_based_policy_provider.h" | 10 #include "chrome/browser/policy/file_based_policy_provider.h" |
11 #include "content/common/file_path_watcher/file_path_watcher.h" | 11 #include "content/common/file_path_watcher/file_path_watcher.h" |
12 | 12 |
13 namespace policy { | 13 namespace policy { |
14 | 14 |
15 // A customized asynchronous policy loader that handles loading policy from a | 15 // A customized asynchronous policy loader that handles loading policy from a |
16 // file using a FilePathWatcher. The loader creates a fallback task to load | 16 // file using a FilePathWatcher. The loader creates a fallback task to load |
17 // policy periodically in case the watcher fails and retries policy loads when | 17 // policy periodically in case the watcher fails and retries policy loads when |
18 // the watched file is in flux. | 18 // the watched file is in flux. |
19 class FileBasedPolicyLoader : public AsynchronousPolicyLoader { | 19 class FileBasedPolicyLoader : public AsynchronousPolicyLoader { |
20 public: | 20 public: |
21 FileBasedPolicyLoader( | 21 FileBasedPolicyLoader( |
22 FileBasedPolicyProvider::ProviderDelegate* provider_delegate); | 22 FileBasedPolicyProvider::ProviderDelegate* provider_delegate); |
23 | 23 |
24 // AsynchronousPolicyLoader overrides: | 24 // AsynchronousPolicyLoader overrides: |
25 virtual void Reload(); | 25 virtual void Reload(); |
26 | 26 |
27 void OnFilePathChanged(const FilePath& path); | 27 void OnFilePathChanged(const FilePath& path); |
28 void OnError(); | 28 void OnFilePathError(const FilePath& path); |
29 | 29 |
30 protected: | 30 protected: |
31 // FileBasedPolicyLoader objects should only be deleted by | 31 // FileBasedPolicyLoader objects should only be deleted by |
32 // RefCountedThreadSafe. | 32 // RefCountedThreadSafe. |
33 friend class base::RefCountedThreadSafe<AsynchronousPolicyLoader>; | 33 friend class base::RefCountedThreadSafe<AsynchronousPolicyLoader>; |
34 virtual ~FileBasedPolicyLoader(); | 34 virtual ~FileBasedPolicyLoader(); |
35 | 35 |
36 const FilePath& config_file_path() { return config_file_path_; } | 36 const FilePath& config_file_path() { return config_file_path_; } |
37 | 37 |
38 // AsynchronousPolicyLoader overrides: | 38 // AsynchronousPolicyLoader overrides: |
(...skipping 30 matching lines...) Expand all Loading... |
69 // wall clock times come from the same source, just in case there is some | 69 // wall clock times come from the same source, just in case there is some |
70 // non-local filesystem involved. | 70 // non-local filesystem involved. |
71 base::Time last_modification_clock_; | 71 base::Time last_modification_clock_; |
72 | 72 |
73 DISALLOW_COPY_AND_ASSIGN(FileBasedPolicyLoader); | 73 DISALLOW_COPY_AND_ASSIGN(FileBasedPolicyLoader); |
74 }; | 74 }; |
75 | 75 |
76 } // namespace policy | 76 } // namespace policy |
77 | 77 |
78 #endif // CHROME_BROWSER_POLICY_FILE_BASED_POLICY_LOADER_H_ | 78 #endif // CHROME_BROWSER_POLICY_FILE_BASED_POLICY_LOADER_H_ |
OLD | NEW |