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

Side by Side Diff: chrome/browser/chromeos/policy/device_cloud_policy_initializer.h

Issue 2371213002: Refactor: Inject StatisticsProvider as a dependency of DeviceCloudPolicyInitializer. (Closed)
Patch Set: Inject StatisticsProvider as a dependency of DeviceCloudPolicyInitializer. Created 4 years, 2 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_CHROMEOS_POLICY_DEVICE_CLOUD_POLICY_INITIALIZER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_CLOUD_POLICY_INITIALIZER_H_
6 #define CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_CLOUD_POLICY_INITIALIZER_H_ 6 #define CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_CLOUD_POLICY_INITIALIZER_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <string> 9 #include <string>
10 10
(...skipping 11 matching lines...) Expand all
22 class PrefService; 22 class PrefService;
23 23
24 namespace base { 24 namespace base {
25 class SequencedTaskRunner; 25 class SequencedTaskRunner;
26 } 26 }
27 27
28 namespace chromeos { 28 namespace chromeos {
29 namespace attestation { 29 namespace attestation {
30 class AttestationFlow; 30 class AttestationFlow;
31 } 31 }
32 namespace system {
33 class StatisticsProvider;
34 }
32 } 35 }
33 36
34 namespace cryptohome { 37 namespace cryptohome {
35 class AsyncMethodCaller; 38 class AsyncMethodCaller;
36 } 39 }
37 40
38 namespace policy { 41 namespace policy {
39 42
40 class DeviceCloudPolicyManagerChromeOS; 43 class DeviceCloudPolicyManagerChromeOS;
41 class DeviceCloudPolicyStoreChromeOS; 44 class DeviceCloudPolicyStoreChromeOS;
(...skipping 13 matching lines...) Expand all
55 // that may involve file I/O. 58 // that may involve file I/O.
56 DeviceCloudPolicyInitializer( 59 DeviceCloudPolicyInitializer(
57 PrefService* local_state, 60 PrefService* local_state,
58 DeviceManagementService* enterprise_service, 61 DeviceManagementService* enterprise_service,
59 const scoped_refptr<base::SequencedTaskRunner>& background_task_runner, 62 const scoped_refptr<base::SequencedTaskRunner>& background_task_runner,
60 EnterpriseInstallAttributes* install_attributes, 63 EnterpriseInstallAttributes* install_attributes,
61 ServerBackedStateKeysBroker* state_keys_broker, 64 ServerBackedStateKeysBroker* state_keys_broker,
62 DeviceCloudPolicyStoreChromeOS* device_store, 65 DeviceCloudPolicyStoreChromeOS* device_store,
63 DeviceCloudPolicyManagerChromeOS* manager, 66 DeviceCloudPolicyManagerChromeOS* manager,
64 cryptohome::AsyncMethodCaller* async_method_caller, 67 cryptohome::AsyncMethodCaller* async_method_caller,
65 std::unique_ptr<chromeos::attestation::AttestationFlow> attestation_flow); 68 std::unique_ptr<chromeos::attestation::AttestationFlow> attestation_flow,
69 chromeos::system::StatisticsProvider* statistics_provider);
66 70
67 ~DeviceCloudPolicyInitializer() override; 71 ~DeviceCloudPolicyInitializer() override;
68 72
69 virtual void Init(); 73 virtual void Init();
70 virtual void Shutdown(); 74 virtual void Shutdown();
71 75
72 // Starts enrollment or re-enrollment. Once the enrollment process completes, 76 // Starts enrollment or re-enrollment. Once the enrollment process completes,
73 // |enrollment_callback| is invoked and gets passed the status of the 77 // |enrollment_callback| is invoked and gets passed the status of the
74 // operation. 78 // operation.
75 virtual void StartEnrollment( 79 virtual void StartEnrollment(
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 void EnrollmentCompleted(const EnrollmentCallback& enrollment_callback, 129 void EnrollmentCompleted(const EnrollmentCallback& enrollment_callback,
126 EnrollmentStatus status); 130 EnrollmentStatus status);
127 131
128 // Creates a new CloudPolicyClient. 132 // Creates a new CloudPolicyClient.
129 std::unique_ptr<CloudPolicyClient> CreateClient( 133 std::unique_ptr<CloudPolicyClient> CreateClient(
130 DeviceManagementService* device_management_service); 134 DeviceManagementService* device_management_service);
131 135
132 void TryToCreateClient(); 136 void TryToCreateClient();
133 void StartConnection(std::unique_ptr<CloudPolicyClient> client); 137 void StartConnection(std::unique_ptr<CloudPolicyClient> client);
134 138
139 // Get a machine flag from |statistics_provider_|, returning the given
140 // |default_value| if not present.
141 bool GetMachineFlag(const std::string& key, bool default_value) const;
142
135 PrefService* local_state_; 143 PrefService* local_state_;
136 DeviceManagementService* enterprise_service_; 144 DeviceManagementService* enterprise_service_;
137 scoped_refptr<base::SequencedTaskRunner> background_task_runner_; 145 scoped_refptr<base::SequencedTaskRunner> background_task_runner_;
138 EnterpriseInstallAttributes* install_attributes_; 146 EnterpriseInstallAttributes* install_attributes_;
139 ServerBackedStateKeysBroker* state_keys_broker_; 147 ServerBackedStateKeysBroker* state_keys_broker_;
140 DeviceCloudPolicyStoreChromeOS* device_store_; 148 DeviceCloudPolicyStoreChromeOS* device_store_;
141 DeviceCloudPolicyManagerChromeOS* manager_; 149 DeviceCloudPolicyManagerChromeOS* manager_;
142 std::unique_ptr<chromeos::attestation::AttestationFlow> attestation_flow_; 150 std::unique_ptr<chromeos::attestation::AttestationFlow> attestation_flow_;
151 chromeos::system::StatisticsProvider* statistics_provider_;
143 bool is_initialized_ = false; 152 bool is_initialized_ = false;
144 153
145 // Non-NULL if there is an enrollment operation pending. 154 // Non-NULL if there is an enrollment operation pending.
146 std::unique_ptr<EnrollmentHandlerChromeOS> enrollment_handler_; 155 std::unique_ptr<EnrollmentHandlerChromeOS> enrollment_handler_;
147 156
148 ServerBackedStateKeysBroker::Subscription state_keys_update_subscription_; 157 ServerBackedStateKeysBroker::Subscription state_keys_update_subscription_;
149 158
150 // Our signing service. 159 // Our signing service.
151 std::unique_ptr<SigningService> signing_service_; 160 std::unique_ptr<SigningService> signing_service_;
152 161
153 DISALLOW_COPY_AND_ASSIGN(DeviceCloudPolicyInitializer); 162 DISALLOW_COPY_AND_ASSIGN(DeviceCloudPolicyInitializer);
154 }; 163 };
155 164
156 } // namespace policy 165 } // namespace policy
157 166
158 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_CLOUD_POLICY_INITIALIZER_H_ 167 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_CLOUD_POLICY_INITIALIZER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698