OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_POLICY_DEVICE_POLICY_CACHE_H_ | |
6 #define CHROME_BROWSER_POLICY_DEVICE_POLICY_CACHE_H_ | |
7 | |
8 #include <string> | |
9 | |
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" | |
13 #include "chrome/browser/policy/proto/chrome_device_policy.pb.h" | |
14 | |
15 namespace policy { | |
16 | |
17 class PolicyMap; | |
18 | |
19 namespace em = enterprise_management; | |
20 | |
21 // CloudPolicyCacheBase implementation that persists policy information | |
22 // to ChromeOS' session manager (via SignedSettingsHelper). | |
23 class DevicePolicyCache : public CloudPolicyCacheBase, | |
24 public chromeos::SignedSettingsHelper::Callback { | |
25 public: | |
26 DevicePolicyCache(); | |
27 virtual ~DevicePolicyCache(); | |
28 | |
29 // CloudPolicyCacheBase implementation: | |
30 virtual void Load(); | |
Mattias Nissler (ping if slow)
2011/03/24 18:55:57
Consider adding OVERRIDE declarations.
Jakob Kummerow
2011/03/28 13:53:53
Done.
| |
31 virtual void SetPolicy(const em::PolicyFetchResponse& policy); | |
32 virtual void SetUnmanaged(); | |
33 | |
34 // SignedSettingsHelper::Callback implementation | |
35 virtual void OnStorePolicyCompleted( | |
36 chromeos::SignedSettings::ReturnCode code); | |
37 virtual void OnRetrievePolicyCompleted( | |
38 chromeos::SignedSettings::ReturnCode code, | |
39 const std::string& value); | |
40 | |
41 private: | |
42 friend class DevicePolicyCacheTest; | |
43 | |
44 // Alternate c'tor allowing tests to mock out the SignedSettingsHelper | |
45 // singleton. | |
46 explicit DevicePolicyCache( | |
47 chromeos::SignedSettingsHelper* signed_settings_helper); | |
48 | |
49 virtual bool DecodePolicyData(const em::PolicyData& policy_data, | |
50 PolicyMap* mandatory, | |
51 PolicyMap* recommended); | |
52 | |
53 static void DecodeDevicePolicy(const em::ChromeDeviceSettingsProto& policy, | |
54 PolicyMap* mandatory, | |
55 PolicyMap* recommended); | |
56 | |
57 chromeos::SignedSettingsHelper* signed_settings_helper_; | |
58 | |
59 DISALLOW_COPY_AND_ASSIGN(DevicePolicyCache); | |
60 }; | |
61 | |
62 } // namespace policy | |
63 | |
64 #endif // CHROME_BROWSER_POLICY_DEVICE_POLICY_CACHE_H_ | |
OLD | NEW |