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

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

Issue 1870793002: Convert //chrome/browser/chromeos from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: iwyu fixes Created 4 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_CHROMEOS_POLICY_ENROLLMENT_HANDLER_CHROMEOS_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_HANDLER_CHROMEOS_H_
6 #define CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_HANDLER_CHROMEOS_H_ 6 #define CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_HANDLER_CHROMEOS_H_
7 7
8 #include <memory>
8 #include <string> 9 #include <string>
9 10
10 #include "base/compiler_specific.h" 11 #include "base/compiler_specific.h"
11 #include "base/macros.h" 12 #include "base/macros.h"
12 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/memory/weak_ptr.h" 14 #include "base/memory/weak_ptr.h"
15 #include "chrome/browser/chromeos/policy/device_cloud_policy_initializer.h" 15 #include "chrome/browser/chromeos/policy/device_cloud_policy_initializer.h"
16 #include "chrome/browser/chromeos/policy/device_cloud_policy_validator.h" 16 #include "chrome/browser/chromeos/policy/device_cloud_policy_validator.h"
17 #include "chrome/browser/chromeos/policy/enrollment_config.h" 17 #include "chrome/browser/chromeos/policy/enrollment_config.h"
18 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h" 18 #include "chrome/browser/chromeos/policy/enterprise_install_attributes.h"
19 #include "components/policy/core/common/cloud/cloud_policy_client.h" 19 #include "components/policy/core/common/cloud/cloud_policy_client.h"
20 #include "components/policy/core/common/cloud/cloud_policy_constants.h" 20 #include "components/policy/core/common/cloud/cloud_policy_constants.h"
21 #include "components/policy/core/common/cloud/cloud_policy_store.h" 21 #include "components/policy/core/common/cloud/cloud_policy_store.h"
22 #include "google_apis/gaia/gaia_oauth_client.h" 22 #include "google_apis/gaia/gaia_oauth_client.h"
23 #include "policy/proto/device_management_backend.pb.h" 23 #include "policy/proto/device_management_backend.pb.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 // enrollment handler. |allowed_device_modes| determines what device modes 59 // enrollment handler. |allowed_device_modes| determines what device modes
60 // are acceptable. If the mode specified by the server is not acceptable, 60 // are acceptable. If the mode specified by the server is not acceptable,
61 // enrollment will fail with an EnrollmentStatus indicating 61 // enrollment will fail with an EnrollmentStatus indicating
62 // STATUS_REGISTRATION_BAD_MODE. 62 // STATUS_REGISTRATION_BAD_MODE.
63 // |management_mode| should be either ENTERPRISE_MANAGED or CONSUMER_MANAGED. 63 // |management_mode| should be either ENTERPRISE_MANAGED or CONSUMER_MANAGED.
64 EnrollmentHandlerChromeOS( 64 EnrollmentHandlerChromeOS(
65 DeviceCloudPolicyStoreChromeOS* store, 65 DeviceCloudPolicyStoreChromeOS* store,
66 EnterpriseInstallAttributes* install_attributes, 66 EnterpriseInstallAttributes* install_attributes,
67 ServerBackedStateKeysBroker* state_keys_broker, 67 ServerBackedStateKeysBroker* state_keys_broker,
68 chromeos::OwnerSettingsServiceChromeOS* owner_settings_service, 68 chromeos::OwnerSettingsServiceChromeOS* owner_settings_service,
69 scoped_ptr<CloudPolicyClient> client, 69 std::unique_ptr<CloudPolicyClient> client,
70 scoped_refptr<base::SequencedTaskRunner> background_task_runner, 70 scoped_refptr<base::SequencedTaskRunner> background_task_runner,
71 const EnrollmentConfig& enrollment_config, 71 const EnrollmentConfig& enrollment_config,
72 const std::string& auth_token, 72 const std::string& auth_token,
73 const std::string& client_id, 73 const std::string& client_id,
74 const std::string& requisition, 74 const std::string& requisition,
75 const AllowedDeviceModes& allowed_device_modes, 75 const AllowedDeviceModes& allowed_device_modes,
76 ManagementMode management_mode, 76 ManagementMode management_mode,
77 const EnrollmentCallback& completion_callback); 77 const EnrollmentCallback& completion_callback);
78 ~EnrollmentHandlerChromeOS() override; 78 ~EnrollmentHandlerChromeOS() override;
79 79
80 // Starts the enrollment process and reports the result to 80 // Starts the enrollment process and reports the result to
81 // |completion_callback_|. 81 // |completion_callback_|.
82 void StartEnrollment(); 82 void StartEnrollment();
83 83
84 // Releases the client. 84 // Releases the client.
85 scoped_ptr<CloudPolicyClient> ReleaseClient(); 85 std::unique_ptr<CloudPolicyClient> ReleaseClient();
86 86
87 // CloudPolicyClient::Observer: 87 // CloudPolicyClient::Observer:
88 void OnPolicyFetched(CloudPolicyClient* client) override; 88 void OnPolicyFetched(CloudPolicyClient* client) override;
89 void OnRegistrationStateChanged(CloudPolicyClient* client) override; 89 void OnRegistrationStateChanged(CloudPolicyClient* client) override;
90 void OnRobotAuthCodesFetched(CloudPolicyClient* client) override; 90 void OnRobotAuthCodesFetched(CloudPolicyClient* client) override;
91 void OnClientError(CloudPolicyClient* client) override; 91 void OnClientError(CloudPolicyClient* client) override;
92 92
93 // CloudPolicyStore::Observer: 93 // CloudPolicyStore::Observer:
94 void OnStoreLoaded(CloudPolicyStore* store) override; 94 void OnStoreLoaded(CloudPolicyStore* store) override;
95 void OnStoreError(CloudPolicyStore* store) override; 95 void OnStoreError(CloudPolicyStore* store) override;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 // Drops any ongoing actions. 154 // Drops any ongoing actions.
155 void Stop(); 155 void Stop();
156 156
157 // Reports the result of the enrollment process to the initiator. 157 // Reports the result of the enrollment process to the initiator.
158 void ReportResult(EnrollmentStatus status); 158 void ReportResult(EnrollmentStatus status);
159 159
160 DeviceCloudPolicyStoreChromeOS* store_; 160 DeviceCloudPolicyStoreChromeOS* store_;
161 EnterpriseInstallAttributes* install_attributes_; 161 EnterpriseInstallAttributes* install_attributes_;
162 ServerBackedStateKeysBroker* state_keys_broker_; 162 ServerBackedStateKeysBroker* state_keys_broker_;
163 chromeos::OwnerSettingsServiceChromeOS* owner_settings_service_; 163 chromeos::OwnerSettingsServiceChromeOS* owner_settings_service_;
164 scoped_ptr<CloudPolicyClient> client_; 164 std::unique_ptr<CloudPolicyClient> client_;
165 scoped_refptr<base::SequencedTaskRunner> background_task_runner_; 165 scoped_refptr<base::SequencedTaskRunner> background_task_runner_;
166 scoped_ptr<gaia::GaiaOAuthClient> gaia_oauth_client_; 166 std::unique_ptr<gaia::GaiaOAuthClient> gaia_oauth_client_;
167 167
168 EnrollmentConfig enrollment_config_; 168 EnrollmentConfig enrollment_config_;
169 std::string auth_token_; 169 std::string auth_token_;
170 std::string client_id_; 170 std::string client_id_;
171 std::string requisition_; 171 std::string requisition_;
172 AllowedDeviceModes allowed_device_modes_; 172 AllowedDeviceModes allowed_device_modes_;
173 ManagementMode management_mode_; 173 ManagementMode management_mode_;
174 EnrollmentCallback completion_callback_; 174 EnrollmentCallback completion_callback_;
175 175
176 // The current state key provided by |state_keys_broker_|. 176 // The current state key provided by |state_keys_broker_|.
177 std::string current_state_key_; 177 std::string current_state_key_;
178 178
179 // The device mode as received in the registration request. 179 // The device mode as received in the registration request.
180 DeviceMode device_mode_; 180 DeviceMode device_mode_;
181 181
182 // Whether the server signaled to skip robot auth setup. 182 // Whether the server signaled to skip robot auth setup.
183 bool skip_robot_auth_; 183 bool skip_robot_auth_;
184 184
185 // The robot account refresh token. 185 // The robot account refresh token.
186 std::string robot_refresh_token_; 186 std::string robot_refresh_token_;
187 187
188 // The validated policy response info to be installed in the store. 188 // The validated policy response info to be installed in the store.
189 scoped_ptr<enterprise_management::PolicyFetchResponse> policy_; 189 std::unique_ptr<enterprise_management::PolicyFetchResponse> policy_;
190 std::string username_; 190 std::string username_;
191 std::string device_id_; 191 std::string device_id_;
192 std::string request_token_; 192 std::string request_token_;
193 193
194 // Current enrollment step. 194 // Current enrollment step.
195 EnrollmentStep enrollment_step_; 195 EnrollmentStep enrollment_step_;
196 196
197 // Total amount of time in milliseconds spent waiting for lockbox 197 // Total amount of time in milliseconds spent waiting for lockbox
198 // initialization. 198 // initialization.
199 int lockbox_init_duration_; 199 int lockbox_init_duration_;
200 200
201 base::WeakPtrFactory<EnrollmentHandlerChromeOS> weak_ptr_factory_; 201 base::WeakPtrFactory<EnrollmentHandlerChromeOS> weak_ptr_factory_;
202 202
203 DISALLOW_COPY_AND_ASSIGN(EnrollmentHandlerChromeOS); 203 DISALLOW_COPY_AND_ASSIGN(EnrollmentHandlerChromeOS);
204 }; 204 };
205 205
206 } // namespace policy 206 } // namespace policy
207 207
208 #endif // CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_HANDLER_CHROMEOS_H_ 208 #endif // CHROME_BROWSER_CHROMEOS_POLICY_ENROLLMENT_HANDLER_CHROMEOS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698