| 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_FILE_BASED_POLICY_PROVIDER_H_ | 5 #ifndef CHROME_BROWSER_POLICY_FILE_BASED_POLICY_PROVIDER_H_ |
| 6 #define CHROME_BROWSER_POLICY_FILE_BASED_POLICY_PROVIDER_H_ | 6 #define CHROME_BROWSER_POLICY_FILE_BASED_POLICY_PROVIDER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/time.h" | 10 #include "base/time.h" |
| 11 #include "chrome/browser/policy/asynchronous_policy_provider.h" | 11 #include "chrome/browser/policy/asynchronous_policy_provider.h" |
| 12 | 12 |
| 13 namespace policy { | 13 namespace policy { |
| 14 | 14 |
| 15 // File based policy provider that coordinates watching and reloading policy | 15 // File based policy provider that coordinates watching and reloading policy |
| 16 // information from the configuration path. Actual logic for loading policy | 16 // information from the configuration path. Actual logic for loading policy |
| 17 // information is handled by a delegate passed at construction time. | 17 // information is handled by a delegate passed at construction time. |
| 18 class FileBasedPolicyProvider : public AsynchronousPolicyProvider { | 18 class FileBasedPolicyProvider : public AsynchronousPolicyProvider { |
| 19 public: | 19 public: |
| 20 | 20 |
| 21 // Delegate interface for actual policy loading from the system. | 21 // Delegate interface for actual policy loading from the system. |
| 22 class ProviderDelegate : public AsynchronousPolicyProvider::Delegate { | 22 class ProviderDelegate : public AsynchronousPolicyProvider::Delegate { |
| 23 public: | 23 public: |
| 24 explicit ProviderDelegate(const FilePath& config_file_path); | 24 explicit ProviderDelegate(const FilePath& config_file_path); |
| 25 virtual ~ProviderDelegate(); | 25 virtual ~ProviderDelegate(); |
| 26 | 26 |
| 27 // AsynchronousPolicyProvider::Delegate implementation: | 27 // AsynchronousPolicyProvider::Delegate implementation: |
| 28 virtual PolicyMap* Load() = 0; | 28 virtual scoped_ptr<PolicyBundle> Load() = 0; |
| 29 | 29 |
| 30 // Gets the last modification timestamp for the policy information from the | 30 // Gets the last modification timestamp for the policy information from the |
| 31 // filesystem. Returns base::Time() if the information is not present, in | 31 // filesystem. Returns base::Time() if the information is not present, in |
| 32 // which case Load() should return an empty dictionary. | 32 // which case Load() should return an empty dictionary. |
| 33 virtual base::Time GetLastModification() = 0; | 33 virtual base::Time GetLastModification() = 0; |
| 34 | 34 |
| 35 const FilePath& config_file_path() { return config_file_path_; } | 35 const FilePath& config_file_path() { return config_file_path_; } |
| 36 | 36 |
| 37 private: | 37 private: |
| 38 const FilePath config_file_path_; | 38 const FilePath config_file_path_; |
| 39 | 39 |
| 40 DISALLOW_COPY_AND_ASSIGN(ProviderDelegate); | 40 DISALLOW_COPY_AND_ASSIGN(ProviderDelegate); |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 // Assumes ownership of |delegate|. | 43 // Assumes ownership of |delegate|. |
| 44 FileBasedPolicyProvider(const PolicyDefinitionList* policy_list, | 44 FileBasedPolicyProvider(const PolicyDefinitionList* policy_list, |
| 45 ProviderDelegate* delegate); | 45 ProviderDelegate* delegate); |
| 46 virtual ~FileBasedPolicyProvider() {} | 46 virtual ~FileBasedPolicyProvider() {} |
| 47 | 47 |
| 48 private: | 48 private: |
| 49 DISALLOW_COPY_AND_ASSIGN(FileBasedPolicyProvider); | 49 DISALLOW_COPY_AND_ASSIGN(FileBasedPolicyProvider); |
| 50 }; | 50 }; |
| 51 | 51 |
| 52 } // namespace policy | 52 } // namespace policy |
| 53 | 53 |
| 54 #endif // CHROME_BROWSER_POLICY_FILE_BASED_POLICY_PROVIDER_H_ | 54 #endif // CHROME_BROWSER_POLICY_FILE_BASED_POLICY_PROVIDER_H_ |
| OLD | NEW |