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

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

Issue 10928036: Implement Chrome OS device enrollment on the new cloud policy stack. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 | Annotate | Revision Log
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_CLOUD_POLICY_MANAGER_CHROMEOS_H_ 5 #ifndef CHROME_BROWSER_POLICY_DEVICE_CLOUD_POLICY_MANAGER_CHROMEOS_H_
6 #define CHROME_BROWSER_POLICY_DEVICE_CLOUD_POLICY_MANAGER_CHROMEOS_H_ 6 #define CHROME_BROWSER_POLICY_DEVICE_CLOUD_POLICY_MANAGER_CHROMEOS_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "chrome/browser/policy/cloud_policy_constants.h" 14 #include "chrome/browser/policy/cloud_policy_constants.h"
15 #include "chrome/browser/policy/cloud_policy_manager.h" 15 #include "chrome/browser/policy/cloud_policy_manager.h"
16 #include "chrome/browser/policy/cloud_policy_store.h" 16 #include "chrome/browser/policy/cloud_policy_store.h"
17 #include "chrome/browser/policy/cloud_policy_validator.h" 17 #include "chrome/browser/policy/cloud_policy_validator.h"
18 18
19 class PrefService; 19 class PrefService;
20 20
21 namespace policy { 21 namespace policy {
22 22
23 class CloudPolicyClient; 23 class CloudPolicyClient;
24 class DeviceCloudPolicyStoreChromeOS; 24 class DeviceCloudPolicyStoreChromeOS;
25 class DeviceManagementService; 25 class DeviceManagementService;
26 class EnrollmentHandlerChromeOS;
26 class EnterpriseInstallAttributes; 27 class EnterpriseInstallAttributes;
27 28
28 // CloudPolicyManager specialization for device policy on Chrome OS. 29 // CloudPolicyManager specialization for device policy on Chrome OS. The most
30 // significant addition is support for device enrollment.
29 class DeviceCloudPolicyManagerChromeOS : public CloudPolicyManager { 31 class DeviceCloudPolicyManagerChromeOS : public CloudPolicyManager {
30 public: 32 public:
33 typedef base::Callback<void(EnrollmentStatus,
34 DeviceManagementStatus,
35 CloudPolicyValidatorBase::Status,
36 CloudPolicyStore::Status)>
37 EnrollmentCallback;
38
31 DeviceCloudPolicyManagerChromeOS( 39 DeviceCloudPolicyManagerChromeOS(
32 scoped_ptr<DeviceCloudPolicyStoreChromeOS> store, 40 scoped_ptr<DeviceCloudPolicyStoreChromeOS> store,
33 EnterpriseInstallAttributes* install_attributes); 41 EnterpriseInstallAttributes* install_attributes);
34 virtual ~DeviceCloudPolicyManagerChromeOS(); 42 virtual ~DeviceCloudPolicyManagerChromeOS();
35 43
36 // Initializes the cloud connection. 44 // Initializes the cloud connection.
37 void Initialize(PrefService* local_state, 45 void Initialize(PrefService* local_state,
38 DeviceManagementService* device_management_service); 46 DeviceManagementService* device_management_service);
39 47
40 // Shuts down the cloud connection. 48 // Shuts down the cloud connection.
41 void Shutdown(); 49 void Shutdown();
42 50
51 // Starts enrollment or re-enrollment. Once the enrollment process completes,
52 // |callback| is invoked, indicating success.
Joao da Silva 2012/09/07 14:01:42 "indicating success" is a bit misleading, since th
Mattias Nissler (ping if slow) 2012/10/23 15:30:41 Done.
53 void StartEnrollment(const std::string& auth_token,
54 const EnrollmentCallback& callback);
55
56 // Cancels a pending enrollment operation, if any.
57 void CancelEnrollment();
58
43 // CloudPolicyStore::Observer: 59 // CloudPolicyStore::Observer:
44 virtual void OnStoreLoaded(CloudPolicyStore* store) OVERRIDE; 60 virtual void OnStoreLoaded(CloudPolicyStore* store) OVERRIDE;
45 61
46 // Returns the device serial number, or an empty string if not available. 62 // Returns the device serial number, or an empty string if not available.
47 static std::string GetMachineID(); 63 static std::string GetMachineID();
48 64
49 // Returns the machine model, or an empty string if not available. 65 // Returns the machine model, or an empty string if not available.
50 static std::string GetMachineModel(); 66 static std::string GetMachineModel();
51 67
52 private: 68 private:
53 // Creates a new CloudPolicyClient. 69 // Creates a new CloudPolicyClient.
54 scoped_ptr<CloudPolicyClient> CreateClient(); 70 scoped_ptr<CloudPolicyClient> CreateClient();
55 71
56 // Starts regular operation if |store_| has policy and is initialized. 72 // Starts regular operation if |store_| has policy and is initialized.
57 void StartIfInitialized(); 73 void StartIfInitialized();
58 74
75 // Handles completion signaled by |enrollment_handler_|.
76 void EnrollmentCompleted(const EnrollmentCallback& callback,
77 EnrollmentStatus status,
78 DeviceManagementStatus dm_status,
79 CloudPolicyValidatorBase::Status validator_status,
80 CloudPolicyStore::Status store_status);
81
59 // Points to the same object as the base CloudPolicyManager::store(), but with 82 // Points to the same object as the base CloudPolicyManager::store(), but with
60 // actual device policy specific type. 83 // actual device policy specific type.
61 DeviceCloudPolicyStoreChromeOS* device_store_; 84 DeviceCloudPolicyStoreChromeOS* device_store_;
62 EnterpriseInstallAttributes* install_attributes_; 85 EnterpriseInstallAttributes* install_attributes_;
63 86
64 DeviceManagementService* device_management_service_; 87 DeviceManagementService* device_management_service_;
65 88
66 // PrefService instance to read the policy refresh rate from. 89 // PrefService instance to read the policy refresh rate from.
67 PrefService* local_state_; 90 PrefService* local_state_;
68 91
92 // Non-null if there is an enrollment operation pending.
93 scoped_ptr<EnrollmentHandlerChromeOS> enrollment_handler_;
94
69 DISALLOW_COPY_AND_ASSIGN(DeviceCloudPolicyManagerChromeOS); 95 DISALLOW_COPY_AND_ASSIGN(DeviceCloudPolicyManagerChromeOS);
70 }; 96 };
71 97
72 } // namespace policy 98 } // namespace policy
73 99
74 #endif // CHROME_BROWSER_POLICY_DEVICE_CLOUD_POLICY_MANAGER_CHROMEOS_H_ 100 #endif // CHROME_BROWSER_POLICY_DEVICE_CLOUD_POLICY_MANAGER_CHROMEOS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698