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_DEVICE_POLICY_CACHE_H_ | 5 #ifndef CHROME_BROWSER_POLICY_DEVICE_POLICY_CACHE_H_ |
6 #define CHROME_BROWSER_POLICY_DEVICE_POLICY_CACHE_H_ | 6 #define CHROME_BROWSER_POLICY_DEVICE_POLICY_CACHE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "chrome/browser/chromeos/login/signed_settings.h" | 10 #include "chrome/browser/chromeos/login/signed_settings.h" |
11 #include "chrome/browser/chromeos/login/signed_settings_helper.h" | |
12 #include "chrome/browser/policy/cloud_policy_cache_base.h" | 11 #include "chrome/browser/policy/cloud_policy_cache_base.h" |
13 #include "chrome/browser/policy/proto/chrome_device_policy.pb.h" | 12 #include "chrome/browser/policy/proto/chrome_device_policy.pb.h" |
14 | 13 |
| 14 namespace chromeos { |
| 15 class SignedSettingsHelper; |
| 16 } // namespace chromeos |
| 17 |
15 namespace policy { | 18 namespace policy { |
16 | 19 |
17 class CloudPolicyDataStore; | 20 class CloudPolicyDataStore; |
18 class EnterpriseInstallAttributes; | 21 class EnterpriseInstallAttributes; |
19 class PolicyMap; | 22 class PolicyMap; |
20 | 23 |
21 namespace em = enterprise_management; | 24 namespace em = enterprise_management; |
22 | 25 |
23 // CloudPolicyCacheBase implementation that persists policy information | 26 // CloudPolicyCacheBase implementation that persists policy information |
24 // to ChromeOS' session manager (via SignedSettingsHelper). | 27 // to ChromeOS' session manager (via SignedSettingsHelper). |
25 class DevicePolicyCache : public CloudPolicyCacheBase, | 28 class DevicePolicyCache : public CloudPolicyCacheBase { |
26 public chromeos::SignedSettingsHelper::Callback { | |
27 public: | 29 public: |
28 DevicePolicyCache(CloudPolicyDataStore* data_store, | 30 DevicePolicyCache(CloudPolicyDataStore* data_store, |
29 EnterpriseInstallAttributes* install_attributes); | 31 EnterpriseInstallAttributes* install_attributes); |
30 virtual ~DevicePolicyCache(); | 32 virtual ~DevicePolicyCache(); |
31 | 33 |
32 // CloudPolicyCacheBase implementation: | 34 // CloudPolicyCacheBase implementation: |
33 virtual void Load() OVERRIDE; | 35 virtual void Load() OVERRIDE; |
34 virtual void SetPolicy(const em::PolicyFetchResponse& policy) OVERRIDE; | 36 virtual void SetPolicy(const em::PolicyFetchResponse& policy) OVERRIDE; |
35 virtual void SetUnmanaged() OVERRIDE; | 37 virtual void SetUnmanaged() OVERRIDE; |
36 | 38 |
37 // SignedSettingsHelper::Callback implementation: | 39 void OnRetrievePolicyCompleted(chromeos::SignedSettings::ReturnCode code, |
38 virtual void OnRetrievePolicyCompleted( | 40 const em::PolicyFetchResponse& policy); |
39 chromeos::SignedSettings::ReturnCode code, | |
40 const em::PolicyFetchResponse& policy) OVERRIDE; | |
41 | 41 |
42 private: | 42 private: |
43 friend class DevicePolicyCacheTest; | 43 friend class DevicePolicyCacheTest; |
44 friend class DevicePolicyCacheTestHelper; | 44 friend class DevicePolicyCacheTestHelper; |
45 | 45 |
46 // Alternate c'tor allowing tests to mock out the SignedSettingsHelper | 46 // Alternate c'tor allowing tests to mock out the SignedSettingsHelper |
47 // singleton. | 47 // singleton. |
48 DevicePolicyCache( | 48 DevicePolicyCache( |
49 CloudPolicyDataStore* data_store, | 49 CloudPolicyDataStore* data_store, |
50 EnterpriseInstallAttributes* install_attributes, | 50 EnterpriseInstallAttributes* install_attributes, |
(...skipping 26 matching lines...) Expand all Loading... |
77 chromeos::SignedSettingsHelper* signed_settings_helper_; | 77 chromeos::SignedSettingsHelper* signed_settings_helper_; |
78 | 78 |
79 base::WeakPtrFactory<DevicePolicyCache> weak_ptr_factory_; | 79 base::WeakPtrFactory<DevicePolicyCache> weak_ptr_factory_; |
80 | 80 |
81 DISALLOW_COPY_AND_ASSIGN(DevicePolicyCache); | 81 DISALLOW_COPY_AND_ASSIGN(DevicePolicyCache); |
82 }; | 82 }; |
83 | 83 |
84 } // namespace policy | 84 } // namespace policy |
85 | 85 |
86 #endif // CHROME_BROWSER_POLICY_DEVICE_POLICY_CACHE_H_ | 86 #endif // CHROME_BROWSER_POLICY_DEVICE_POLICY_CACHE_H_ |
OLD | NEW |