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

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

Issue 2977033002: Mixed Licenses Enrollment (Closed)
Patch Set: Fix CloudPolicyClientTest Created 3 years, 4 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 <map>
8 #include <memory> 9 #include <memory>
9 #include <string> 10 #include <string>
10 11
11 #include "base/callback_forward.h" 12 #include "base/callback_forward.h"
12 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
13 #include "base/gtest_prod_util.h" 14 #include "base/gtest_prod_util.h"
14 #include "base/macros.h" 15 #include "base/macros.h"
15 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
16 #include "chrome/browser/chromeos/policy/server_backed_state_keys_broker.h" 17 #include "chrome/browser/chromeos/policy/server_backed_state_keys_broker.h"
17 #include "components/policy/core/common/cloud/cloud_policy_client.h" 18 #include "components/policy/core/common/cloud/cloud_policy_client.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 class DeviceCloudPolicyStoreChromeOS; 50 class DeviceCloudPolicyStoreChromeOS;
50 class DeviceManagementService; 51 class DeviceManagementService;
51 struct EnrollmentConfig; 52 struct EnrollmentConfig;
52 class EnrollmentHandlerChromeOS; 53 class EnrollmentHandlerChromeOS;
53 class EnrollmentStatus; 54 class EnrollmentStatus;
54 55
55 // This class connects DCPM to the correct device management service, and 56 // This class connects DCPM to the correct device management service, and
56 // handles the enrollment process. 57 // handles the enrollment process.
57 class DeviceCloudPolicyInitializer : public CloudPolicyStore::Observer { 58 class DeviceCloudPolicyInitializer : public CloudPolicyStore::Observer {
58 public: 59 public:
60 using EnrollmentLicenseMap = std::map<LicenseType, int>;
61
59 typedef base::Callback<void(EnrollmentStatus)> EnrollmentCallback; 62 typedef base::Callback<void(EnrollmentStatus)> EnrollmentCallback;
63 typedef base::Callback<void(const EnrollmentLicenseMap&)>
achuithb 2017/07/31 21:03:23 We prefer using to typedef, and switch EnrollmentC
Denis Kuznetsov (DE-MUC) 2017/08/01 10:50:54 Done.
64 AvailableLicensesCallback;
60 65
61 // |background_task_runner| is used to execute long-running background tasks 66 // |background_task_runner| is used to execute long-running background tasks
62 // that may involve file I/O. 67 // that may involve file I/O.
63 DeviceCloudPolicyInitializer( 68 DeviceCloudPolicyInitializer(
64 PrefService* local_state, 69 PrefService* local_state,
65 DeviceManagementService* enterprise_service, 70 DeviceManagementService* enterprise_service,
66 const scoped_refptr<base::SequencedTaskRunner>& background_task_runner, 71 const scoped_refptr<base::SequencedTaskRunner>& background_task_runner,
67 chromeos::InstallAttributes* install_attributes, 72 chromeos::InstallAttributes* install_attributes,
68 ServerBackedStateKeysBroker* state_keys_broker, 73 ServerBackedStateKeysBroker* state_keys_broker,
69 DeviceCloudPolicyStoreChromeOS* device_store, 74 DeviceCloudPolicyStoreChromeOS* device_store,
70 DeviceCloudPolicyManagerChromeOS* manager, 75 DeviceCloudPolicyManagerChromeOS* manager,
71 cryptohome::AsyncMethodCaller* async_method_caller, 76 cryptohome::AsyncMethodCaller* async_method_caller,
72 std::unique_ptr<chromeos::attestation::AttestationFlow> attestation_flow, 77 std::unique_ptr<chromeos::attestation::AttestationFlow> attestation_flow,
73 chromeos::system::StatisticsProvider* statistics_provider); 78 chromeos::system::StatisticsProvider* statistics_provider);
74 79
75 ~DeviceCloudPolicyInitializer() override; 80 ~DeviceCloudPolicyInitializer() override;
76 81
77 virtual void Init(); 82 virtual void Init();
78 virtual void Shutdown(); 83 virtual void Shutdown();
79 84
80 // Starts enrollment or re-enrollment. Once the enrollment process completes, 85 // Prepares enrollment or re-enrollment. Enrollment should be started by
81 // |enrollment_callback| is invoked and gets passed the status of the 86 // either calling StartEnrollment or CheckAvailableLicenses /
82 // operation. 87 // StartEnrollmentWithLicense. Once the enrollment process
83 virtual void StartEnrollment( 88 // completes, |enrollment_callback| is invoked and gets passed the status of
89 // the operation.
90 virtual void PrepareEnrollment(
84 DeviceManagementService* device_management_service, 91 DeviceManagementService* device_management_service,
85 chromeos::ActiveDirectoryJoinDelegate* ad_join_delegate, 92 chromeos::ActiveDirectoryJoinDelegate* ad_join_delegate,
86 const EnrollmentConfig& enrollment_config, 93 const EnrollmentConfig& enrollment_config,
87 const std::string& auth_token, 94 const std::string& auth_token,
88 const EnrollmentCallback& enrollment_callback); 95 const EnrollmentCallback& enrollment_callback);
89 96
97 // Starts enrollment using server-based license type selection.
98 virtual void StartEnrollment();
99
100 // Queries server about available license types and their count.
101 virtual void CheckAvailableLicenses(
102 const AvailableLicensesCallback& callback);
103
104 // Starts enrollment using user-selected license type.
105 virtual void StartEnrollmentWithLicense(policy::LicenseType license_type);
106
90 // Get the enrollment configuration that has been set up via signals such as 107 // Get the enrollment configuration that has been set up via signals such as
91 // device requisition, OEM manifest, pre-existing installation-time attributes 108 // device requisition, OEM manifest, pre-existing installation-time attributes
92 // or server-backed state retrieval. The configuration is stored in |config|, 109 // or server-backed state retrieval. The configuration is stored in |config|,
93 // |config.mode| will be MODE_NONE if there is no prescribed configuration. 110 // |config.mode| will be MODE_NONE if there is no prescribed configuration.
94 // |config.management_domain| will contain the domain the device is supposed 111 // |config.management_domain| will contain the domain the device is supposed
95 // to be enrolled to as decided by factors such as forced re-enrollment, 112 // to be enrolled to as decided by factors such as forced re-enrollment,
96 // enrollment recovery, or already-present install attributes. Note that 113 // enrollment recovery, or already-present install attributes. Note that
97 // |config.management_domain| may be non-empty even if |config.mode| is 114 // |config.management_domain| may be non-empty even if |config.mode| is
98 // MODE_NONE. 115 // MODE_NONE.
99 EnrollmentConfig GetPrescribedEnrollmentConfig() const; 116 EnrollmentConfig GetPrescribedEnrollmentConfig() const;
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 180
164 // Our signing service. 181 // Our signing service.
165 std::unique_ptr<SigningService> signing_service_; 182 std::unique_ptr<SigningService> signing_service_;
166 183
167 DISALLOW_COPY_AND_ASSIGN(DeviceCloudPolicyInitializer); 184 DISALLOW_COPY_AND_ASSIGN(DeviceCloudPolicyInitializer);
168 }; 185 };
169 186
170 } // namespace policy 187 } // namespace policy
171 188
172 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_CLOUD_POLICY_INITIALIZER_H_ 189 #endif // CHROME_BROWSER_CHROMEOS_POLICY_DEVICE_CLOUD_POLICY_INITIALIZER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698