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

Side by Side Diff: chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h

Issue 751703003: Implemented consumer management unenrollment. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@dcpm
Patch Set: Rebase. Created 5 years, 11 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_OWNERSHIP_OWNER_SETTINGS_SERVICE_CHROMEOS_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_OWNERSHIP_OWNER_SETTINGS_SERVICE_CHROMEOS_H_
6 #define CHROME_BROWSER_CHROMEOS_OWNERSHIP_OWNER_SETTINGS_SERVICE_CHROMEOS_H_ 6 #define CHROME_BROWSER_CHROMEOS_OWNERSHIP_OWNER_SETTINGS_SERVICE_CHROMEOS_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 16 matching lines...) Expand all
27 namespace content { 27 namespace content {
28 class WebUI; 28 class WebUI;
29 } 29 }
30 30
31 namespace ownership { 31 namespace ownership {
32 class OwnerKeyUtil; 32 class OwnerKeyUtil;
33 } 33 }
34 34
35 namespace chromeos { 35 namespace chromeos {
36 36
37 class FakeOwnerSettingsService;
38
37 // The class is a profile-keyed service which holds public/private 39 // The class is a profile-keyed service which holds public/private
38 // keypair corresponds to a profile. The keypair is reloaded automatically when 40 // keypair corresponds to a profile. The keypair is reloaded automatically when
39 // profile is created and TPM token is ready. Note that the private part of a 41 // profile is created and TPM token is ready. Note that the private part of a
40 // key can be loaded only for the owner. 42 // key can be loaded only for the owner.
41 // 43 //
42 // TODO (ygorshenin@): move write path for device settings here 44 // TODO (ygorshenin@): move write path for device settings here
43 // (crbug.com/230018). 45 // (crbug.com/230018).
44 class OwnerSettingsServiceChromeOS : public ownership::OwnerSettingsService, 46 class OwnerSettingsServiceChromeOS : public ownership::OwnerSettingsService,
45 public content::NotificationObserver, 47 public content::NotificationObserver,
46 public SessionManagerClient::Observer, 48 public SessionManagerClient::Observer,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 82
81 // SessionManagerClient::Observer: 83 // SessionManagerClient::Observer:
82 void OwnerKeySet(bool success) override; 84 void OwnerKeySet(bool success) override;
83 85
84 // DeviceSettingsService::Observer: 86 // DeviceSettingsService::Observer:
85 void OwnershipStatusChanged() override; 87 void OwnershipStatusChanged() override;
86 void DeviceSettingsUpdated() override; 88 void DeviceSettingsUpdated() override;
87 void OnDeviceSettingsServiceShutdown() override; 89 void OnDeviceSettingsServiceShutdown() override;
88 90
89 // Sets the management related settings. 91 // Sets the management related settings.
90 void SetManagementSettings(const ManagementSettings& settings, 92 virtual void SetManagementSettings(
91 const OnManagementSettingsSetCallback& callback); 93 const ManagementSettings& settings,
94 const OnManagementSettingsSetCallback& callback);
92 95
93 // Checks if the user is the device owner, without the user profile having to 96 // Checks if the user is the device owner, without the user profile having to
94 // been initialized. Should be used only if login state is in safe mode. 97 // been initialized. Should be used only if login state is in safe mode.
95 static void IsOwnerForSafeModeAsync( 98 static void IsOwnerForSafeModeAsync(
96 const std::string& user_hash, 99 const std::string& user_hash,
97 const scoped_refptr<ownership::OwnerKeyUtil>& owner_key_util, 100 const scoped_refptr<ownership::OwnerKeyUtil>& owner_key_util,
98 const IsOwnerCallback& callback); 101 const IsOwnerCallback& callback);
99 102
100 // Assembles PolicyData based on |settings|, |policy_data| and 103 // Assembles PolicyData based on |settings|, |policy_data| and
101 // |user_id|. 104 // |user_id|.
102 static scoped_ptr<enterprise_management::PolicyData> AssemblePolicy( 105 static scoped_ptr<enterprise_management::PolicyData> AssemblePolicy(
103 const std::string& user_id, 106 const std::string& user_id,
104 const enterprise_management::PolicyData* policy_data, 107 const enterprise_management::PolicyData* policy_data,
105 const enterprise_management::ChromeDeviceSettingsProto* settings); 108 const enterprise_management::ChromeDeviceSettingsProto* settings);
106 109
107 // Updates device |settings|. 110 // Updates device |settings|.
108 static void UpdateDeviceSettings( 111 static void UpdateDeviceSettings(
109 const std::string& path, 112 const std::string& path,
110 const base::Value& value, 113 const base::Value& value,
111 enterprise_management::ChromeDeviceSettingsProto& settings); 114 enterprise_management::ChromeDeviceSettingsProto& settings);
112 115
113 bool has_pending_changes() const { 116 bool has_pending_changes() const {
114 return !pending_changes_.empty() || tentative_settings_.get() || 117 return !pending_changes_.empty() || tentative_settings_.get() ||
115 has_pending_management_settings_; 118 has_pending_management_settings_;
116 } 119 }
117 120
118 private: 121 protected:
119 friend class OwnerSettingsServiceChromeOSFactory;
120
121 OwnerSettingsServiceChromeOS( 122 OwnerSettingsServiceChromeOS(
122 DeviceSettingsService* device_settings_service, 123 DeviceSettingsService* device_settings_service,
123 Profile* profile, 124 Profile* profile,
124 const scoped_refptr<ownership::OwnerKeyUtil>& owner_key_util); 125 const scoped_refptr<ownership::OwnerKeyUtil>& owner_key_util);
125 126
127 private:
128 friend class OwnerSettingsServiceChromeOSFactory;
129
126 // OwnerSettingsService protected interface overrides: 130 // OwnerSettingsService protected interface overrides:
127 131
128 // Reloads private key from profile's NSS slots, responds via |callback|. 132 // Reloads private key from profile's NSS slots, responds via |callback|.
129 void ReloadKeypairImpl(const base::Callback< 133 void ReloadKeypairImpl(const base::Callback<
130 void(const scoped_refptr<ownership::PublicKey>& public_key, 134 void(const scoped_refptr<ownership::PublicKey>& public_key,
131 const scoped_refptr<ownership::PrivateKey>& private_key)>& callback) 135 const scoped_refptr<ownership::PrivateKey>& private_key)>& callback)
132 override; 136 override;
133 137
134 // Possibly notifies DeviceSettingsService that owner's keypair is loaded. 138 // Possibly notifies DeviceSettingsService that owner's keypair is loaded.
135 void OnPostKeypairLoadedActions() override; 139 void OnPostKeypairLoadedActions() override;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 base::WeakPtrFactory<OwnerSettingsServiceChromeOS> weak_factory_; 191 base::WeakPtrFactory<OwnerSettingsServiceChromeOS> weak_factory_;
188 192
189 base::WeakPtrFactory<OwnerSettingsServiceChromeOS> store_settings_factory_; 193 base::WeakPtrFactory<OwnerSettingsServiceChromeOS> store_settings_factory_;
190 194
191 DISALLOW_COPY_AND_ASSIGN(OwnerSettingsServiceChromeOS); 195 DISALLOW_COPY_AND_ASSIGN(OwnerSettingsServiceChromeOS);
192 }; 196 };
193 197
194 } // namespace chromeos 198 } // namespace chromeos
195 199
196 #endif // CHROME_BROWSER_CHROMEOS_OWNERSHIP_OWNER_SETTINGS_SERVICE_CHROMEOS_H_ 200 #endif // CHROME_BROWSER_CHROMEOS_OWNERSHIP_OWNER_SETTINGS_SERVICE_CHROMEOS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698