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

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

Powered by Google App Engine
This is Rietveld 408576698