| 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_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" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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, |
| 51 chromeos::SignedSettingsHelper* signed_settings_helper); | 51 chromeos::SignedSettingsHelper* signed_settings_helper); |
| 52 | 52 |
| 53 // CloudPolicyCacheBase implementation: | 53 // CloudPolicyCacheBase implementation: |
| 54 virtual bool DecodePolicyData( | 54 virtual bool DecodePolicyData( |
| 55 const enterprise_management::PolicyData& policy_data, | 55 const enterprise_management::PolicyData& policy_data, |
| 56 PolicyMap* mandatory, | 56 PolicyMap* policies) OVERRIDE; |
| 57 PolicyMap* recommended) OVERRIDE; | |
| 58 | 57 |
| 59 void PolicyStoreOpCompleted(chromeos::SignedSettings::ReturnCode code); | 58 void PolicyStoreOpCompleted(chromeos::SignedSettings::ReturnCode code); |
| 60 | 59 |
| 61 // Checks with immutable attributes whether this is an enterprise device and | 60 // Checks with immutable attributes whether this is an enterprise device and |
| 62 // read the registration user if this is the case. | 61 // read the registration user if this is the case. |
| 63 void CheckImmutableAttributes(); | 62 void CheckImmutableAttributes(); |
| 64 | 63 |
| 65 // Tries to install the initial device policy retrieved from signed settings. | 64 // Tries to install the initial device policy retrieved from signed settings. |
| 66 // Fills in |device_token| if it could be extracted from the loaded protobuf. | 65 // Fills in |device_token| if it could be extracted from the loaded protobuf. |
| 67 void InstallInitialPolicy( | 66 void InstallInitialPolicy( |
| 68 chromeos::SignedSettings::ReturnCode code, | 67 chromeos::SignedSettings::ReturnCode code, |
| 69 const enterprise_management::PolicyFetchResponse& policy, | 68 const enterprise_management::PolicyFetchResponse& policy, |
| 70 std::string* device_token); | 69 std::string* device_token); |
| 71 | 70 |
| 72 static void DecodeDevicePolicy( | 71 static void DecodeDevicePolicy( |
| 73 const enterprise_management::ChromeDeviceSettingsProto& policy, | 72 const enterprise_management::ChromeDeviceSettingsProto& policy, |
| 74 PolicyMap* mandatory, | 73 PolicyMap* policies); |
| 75 PolicyMap* recommended); | |
| 76 | 74 |
| 77 CloudPolicyDataStore* data_store_; | 75 CloudPolicyDataStore* data_store_; |
| 78 EnterpriseInstallAttributes* install_attributes_; | 76 EnterpriseInstallAttributes* install_attributes_; |
| 79 | 77 |
| 80 chromeos::SignedSettingsHelper* signed_settings_helper_; | 78 chromeos::SignedSettingsHelper* signed_settings_helper_; |
| 81 | 79 |
| 82 base::WeakPtrFactory<DevicePolicyCache> weak_ptr_factory_; | 80 base::WeakPtrFactory<DevicePolicyCache> weak_ptr_factory_; |
| 83 | 81 |
| 84 DISALLOW_COPY_AND_ASSIGN(DevicePolicyCache); | 82 DISALLOW_COPY_AND_ASSIGN(DevicePolicyCache); |
| 85 }; | 83 }; |
| 86 | 84 |
| 87 } // namespace policy | 85 } // namespace policy |
| 88 | 86 |
| 89 #endif // CHROME_BROWSER_POLICY_DEVICE_POLICY_CACHE_H_ | 87 #endif // CHROME_BROWSER_POLICY_DEVICE_POLICY_CACHE_H_ |
| OLD | NEW |