Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(60)

Side by Side Diff: chrome/browser/policy/device_policy_cache.h

Issue 9911029: Refactored the CloudPolicyProvider so that it becomes initialized once and stays initialized. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Updated expectations in failing browser_tests Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "chrome/browser/policy/cloud_policy_cache_base.h" 11 #include "chrome/browser/policy/cloud_policy_cache_base.h"
12 #include "chrome/browser/policy/proto/chrome_device_policy.pb.h" 12 #include "chrome/browser/policy/proto/chrome_device_policy.pb.h"
13 13
14 namespace chromeos { 14 namespace chromeos {
15 class SignedSettingsHelper; 15 class SignedSettingsHelper;
16 } // namespace chromeos 16 } // namespace chromeos
17 17
18 namespace policy { 18 namespace policy {
19 19
20 class CloudPolicyDataStore; 20 class CloudPolicyDataStore;
21 class EnterpriseInstallAttributes; 21 class EnterpriseInstallAttributes;
22 class PolicyMap; 22 class PolicyMap;
23 23
24 // CloudPolicyCacheBase implementation that persists policy information 24 // CloudPolicyCacheBase implementation that persists policy information
25 // to ChromeOS' session manager (via SignedSettingsHelper). 25 // to ChromeOS' session manager (via SignedSettingsHelper).
26 class DevicePolicyCache : public CloudPolicyCacheBase { 26 class DevicePolicyCache : public CloudPolicyCacheBase {
27 public: 27 public:
28 DevicePolicyCache(CloudPolicyDataStore* data_store, 28 DevicePolicyCache(CloudPolicyDataStore* data_store,
29 EnterpriseInstallAttributes* install_attributes); 29 EnterpriseInstallAttributes* install_attributes,
30 chromeos::SignedSettingsHelper* signed_settings_helper);
30 virtual ~DevicePolicyCache(); 31 virtual ~DevicePolicyCache();
31 32
32 // CloudPolicyCacheBase implementation: 33 // CloudPolicyCacheBase implementation:
33 virtual void Load() OVERRIDE; 34 virtual void Load() OVERRIDE;
34 virtual bool SetPolicy( 35 virtual bool SetPolicy(
35 const enterprise_management::PolicyFetchResponse& policy) OVERRIDE; 36 const enterprise_management::PolicyFetchResponse& policy) OVERRIDE;
36 virtual void SetUnmanaged() OVERRIDE; 37 virtual void SetUnmanaged() OVERRIDE;
37 38
38 void OnRetrievePolicyCompleted( 39 void OnRetrievePolicyCompleted(
39 chromeos::SignedSettings::ReturnCode code, 40 chromeos::SignedSettings::ReturnCode code,
40 const enterprise_management::PolicyFetchResponse& policy); 41 const enterprise_management::PolicyFetchResponse& policy);
41 42
42 private: 43 private:
43 friend class DevicePolicyCacheTest;
44 friend class DevicePolicyCacheTestHelper;
45
46 // Alternate c'tor allowing tests to mock out the SignedSettingsHelper
47 // singleton.
48 DevicePolicyCache(
49 CloudPolicyDataStore* data_store,
50 EnterpriseInstallAttributes* install_attributes,
51 chromeos::SignedSettingsHelper* signed_settings_helper);
52
53 // CloudPolicyCacheBase implementation: 44 // CloudPolicyCacheBase implementation:
54 virtual bool DecodePolicyData( 45 virtual bool DecodePolicyData(
55 const enterprise_management::PolicyData& policy_data, 46 const enterprise_management::PolicyData& policy_data,
56 PolicyMap* policies) OVERRIDE; 47 PolicyMap* policies) OVERRIDE;
57 48
58 void PolicyStoreOpCompleted(chromeos::SignedSettings::ReturnCode code); 49 void PolicyStoreOpCompleted(chromeos::SignedSettings::ReturnCode code);
59 50
60 // Checks with immutable attributes whether this is an enterprise device and 51 // Checks with immutable attributes whether this is an enterprise device and
61 // read the registration user if this is the case. 52 // read the registration user if this is the case.
62 void CheckImmutableAttributes(); 53 void CheckImmutableAttributes();
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 chromeos::SignedSettingsHelper* signed_settings_helper_; 92 chromeos::SignedSettingsHelper* signed_settings_helper_;
102 93
103 base::WeakPtrFactory<DevicePolicyCache> weak_ptr_factory_; 94 base::WeakPtrFactory<DevicePolicyCache> weak_ptr_factory_;
104 95
105 DISALLOW_COPY_AND_ASSIGN(DevicePolicyCache); 96 DISALLOW_COPY_AND_ASSIGN(DevicePolicyCache);
106 }; 97 };
107 98
108 } // namespace policy 99 } // namespace policy
109 100
110 #endif // CHROME_BROWSER_POLICY_DEVICE_POLICY_CACHE_H_ 101 #endif // CHROME_BROWSER_POLICY_DEVICE_POLICY_CACHE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698