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

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: 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 83
82 // SessionManagerClient::Observer: 84 // SessionManagerClient::Observer:
83 virtual void OwnerKeySet(bool success) override; 85 virtual void OwnerKeySet(bool success) override;
84 86
85 // DeviceSettingsService::Observer: 87 // DeviceSettingsService::Observer:
86 virtual void OwnershipStatusChanged() override; 88 virtual void OwnershipStatusChanged() override;
87 virtual void DeviceSettingsUpdated() override; 89 virtual void DeviceSettingsUpdated() override;
88 virtual void OnDeviceSettingsServiceShutdown() override; 90 virtual void OnDeviceSettingsServiceShutdown() override;
89 91
90 // Sets the management related settings. 92 // Sets the management related settings.
91 void SetManagementSettings(const ManagementSettings& settings, 93 virtual void SetManagementSettings(
92 const OnManagementSettingsSetCallback& callback); 94 const ManagementSettings& settings,
95 const OnManagementSettingsSetCallback& callback);
93 96
94 // Checks if the user is the device owner, without the user profile having to 97 // Checks if the user is the device owner, without the user profile having to
95 // been initialized. Should be used only if login state is in safe mode. 98 // been initialized. Should be used only if login state is in safe mode.
96 static void IsOwnerForSafeModeAsync( 99 static void IsOwnerForSafeModeAsync(
97 const std::string& user_hash, 100 const std::string& user_hash,
98 const scoped_refptr<ownership::OwnerKeyUtil>& owner_key_util, 101 const scoped_refptr<ownership::OwnerKeyUtil>& owner_key_util,
99 const IsOwnerCallback& callback); 102 const IsOwnerCallback& callback);
100 103
101 // Assembles PolicyData based on |settings|, |policy_data| and 104 // Assembles PolicyData based on |settings|, |policy_data| and
102 // |user_id|. 105 // |user_id|.
103 static scoped_ptr<enterprise_management::PolicyData> AssemblePolicy( 106 static scoped_ptr<enterprise_management::PolicyData> AssemblePolicy(
104 const std::string& user_id, 107 const std::string& user_id,
105 const enterprise_management::PolicyData* policy_data, 108 const enterprise_management::PolicyData* policy_data,
106 const enterprise_management::ChromeDeviceSettingsProto* settings); 109 const enterprise_management::ChromeDeviceSettingsProto* settings);
107 110
108 // Updates device |settings|. 111 // Updates device |settings|.
109 static void UpdateDeviceSettings( 112 static void UpdateDeviceSettings(
110 const std::string& path, 113 const std::string& path,
111 const base::Value& value, 114 const base::Value& value,
112 enterprise_management::ChromeDeviceSettingsProto& settings); 115 enterprise_management::ChromeDeviceSettingsProto& settings);
113 116
114 bool has_pending_changes() const { 117 bool has_pending_changes() const {
115 return !pending_changes_.empty() || tentative_settings_.get() || 118 return !pending_changes_.empty() || tentative_settings_.get() ||
116 has_pending_management_settings_; 119 has_pending_management_settings_;
117 } 120 }
118 121
119 private: 122 private:
123 friend class FakeOwnerSettingsService;
ygorshenin1 2015/01/12 10:08:55 Why do you need this friend declaration?
davidyu 2015/01/13 05:43:52 For the constructor.
ygorshenin1 2015/01/13 11:56:38 Ah, I see. Feel free to mark constructor as protec
120 friend class OwnerSettingsServiceChromeOSFactory; 124 friend class OwnerSettingsServiceChromeOSFactory;
121 125
122 OwnerSettingsServiceChromeOS( 126 OwnerSettingsServiceChromeOS(
123 DeviceSettingsService* device_settings_service, 127 DeviceSettingsService* device_settings_service,
124 Profile* profile, 128 Profile* profile,
125 const scoped_refptr<ownership::OwnerKeyUtil>& owner_key_util); 129 const scoped_refptr<ownership::OwnerKeyUtil>& owner_key_util);
126 130
127 // OwnerSettingsService protected interface overrides: 131 // OwnerSettingsService protected interface overrides:
128 132
129 // Reloads private key from profile's NSS slots, responds via |callback|. 133 // Reloads private key from profile's NSS slots, responds via |callback|.
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 base::WeakPtrFactory<OwnerSettingsServiceChromeOS> weak_factory_; 192 base::WeakPtrFactory<OwnerSettingsServiceChromeOS> weak_factory_;
189 193
190 base::WeakPtrFactory<OwnerSettingsServiceChromeOS> store_settings_factory_; 194 base::WeakPtrFactory<OwnerSettingsServiceChromeOS> store_settings_factory_;
191 195
192 DISALLOW_COPY_AND_ASSIGN(OwnerSettingsServiceChromeOS); 196 DISALLOW_COPY_AND_ASSIGN(OwnerSettingsServiceChromeOS);
193 }; 197 };
194 198
195 } // namespace chromeos 199 } // namespace chromeos
196 200
197 #endif // CHROME_BROWSER_CHROMEOS_OWNERSHIP_OWNER_SETTINGS_SERVICE_CHROMEOS_H_ 201 #endif // CHROME_BROWSER_CHROMEOS_OWNERSHIP_OWNER_SETTINGS_SERVICE_CHROMEOS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698