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