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

Side by Side Diff: chrome/browser/chromeos/ownership/owner_settings_service_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: rebase 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 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 bool HasPendingChanges() const; 68 bool HasPendingChanges() const;
69 69
70 // ownership::OwnerSettingsService implementation: 70 // ownership::OwnerSettingsService implementation:
71 bool HandlesSetting(const std::string& setting) override; 71 bool HandlesSetting(const std::string& setting) override;
72 bool Set(const std::string& setting, const base::Value& value) override; 72 bool Set(const std::string& setting, const base::Value& value) override;
73 bool AppendToList(const std::string& setting, 73 bool AppendToList(const std::string& setting,
74 const base::Value& value) override; 74 const base::Value& value) override;
75 bool RemoveFromList(const std::string& setting, 75 bool RemoveFromList(const std::string& setting,
76 const base::Value& value) override; 76 const base::Value& value) override;
77 bool CommitTentativeDeviceSettings( 77 bool CommitTentativeDeviceSettings(
78 scoped_ptr<enterprise_management::PolicyData> policy) override; 78 std::unique_ptr<enterprise_management::PolicyData> policy) override;
79 79
80 // NotificationObserver implementation: 80 // NotificationObserver implementation:
81 void Observe(int type, 81 void Observe(int type,
82 const content::NotificationSource& source, 82 const content::NotificationSource& source,
83 const content::NotificationDetails& details) override; 83 const content::NotificationDetails& details) override;
84 84
85 // SessionManagerClient::Observer: 85 // SessionManagerClient::Observer:
86 void OwnerKeySet(bool success) override; 86 void OwnerKeySet(bool success) override;
87 87
88 // DeviceSettingsService::Observer: 88 // DeviceSettingsService::Observer:
89 void OwnershipStatusChanged() override; 89 void OwnershipStatusChanged() override;
90 void DeviceSettingsUpdated() override; 90 void DeviceSettingsUpdated() override;
91 void OnDeviceSettingsServiceShutdown() override; 91 void OnDeviceSettingsServiceShutdown() override;
92 92
93 // Sets the management related settings. 93 // Sets the management related settings.
94 virtual void SetManagementSettings( 94 virtual void SetManagementSettings(
95 const ManagementSettings& settings, 95 const ManagementSettings& settings,
96 const OnManagementSettingsSetCallback& callback); 96 const OnManagementSettingsSetCallback& callback);
97 97
98 // Checks if the user is the device owner, without the user profile having to 98 // Checks if the user is the device owner, without the user profile having to
99 // been initialized. Should be used only if login state is in safe mode. 99 // been initialized. Should be used only if login state is in safe mode.
100 static void IsOwnerForSafeModeAsync( 100 static void IsOwnerForSafeModeAsync(
101 const std::string& user_hash, 101 const std::string& user_hash,
102 const scoped_refptr<ownership::OwnerKeyUtil>& owner_key_util, 102 const scoped_refptr<ownership::OwnerKeyUtil>& owner_key_util,
103 const IsOwnerCallback& callback); 103 const IsOwnerCallback& callback);
104 104
105 // Assembles PolicyData based on |settings|, |policy_data|, |user_id| and 105 // Assembles PolicyData based on |settings|, |policy_data|, |user_id| and
106 // |pending_management_settings|. Applies local-owner policy fixups if needed. 106 // |pending_management_settings|. Applies local-owner policy fixups if needed.
107 static scoped_ptr<enterprise_management::PolicyData> AssemblePolicy( 107 static std::unique_ptr<enterprise_management::PolicyData> AssemblePolicy(
108 const std::string& user_id, 108 const std::string& user_id,
109 const enterprise_management::PolicyData* policy_data, 109 const enterprise_management::PolicyData* policy_data,
110 bool apply_pending_mangement_settings, 110 bool apply_pending_mangement_settings,
111 const ManagementSettings& pending_management_settings, 111 const ManagementSettings& pending_management_settings,
112 enterprise_management::ChromeDeviceSettingsProto* settings); 112 enterprise_management::ChromeDeviceSettingsProto* settings);
113 113
114 // Updates device |settings|. 114 // Updates device |settings|.
115 static void UpdateDeviceSettings( 115 static void UpdateDeviceSettings(
116 const std::string& path, 116 const std::string& path,
117 const base::Value& value, 117 const base::Value& value,
(...skipping 27 matching lines...) Expand all
145 145
146 // Possibly notifies DeviceSettingsService that owner's keypair is loaded. 146 // Possibly notifies DeviceSettingsService that owner's keypair is loaded.
147 void OnPostKeypairLoadedActions() override; 147 void OnPostKeypairLoadedActions() override;
148 148
149 // Tries to apply recent changes to device settings proto, sign it and store. 149 // Tries to apply recent changes to device settings proto, sign it and store.
150 void StorePendingChanges(); 150 void StorePendingChanges();
151 151
152 // Called when current device settings are successfully signed. 152 // Called when current device settings are successfully signed.
153 // Sends signed settings for storage. 153 // Sends signed settings for storage.
154 void OnPolicyAssembledAndSigned( 154 void OnPolicyAssembledAndSigned(
155 scoped_ptr<enterprise_management::PolicyFetchResponse> policy_response); 155 std::unique_ptr<enterprise_management::PolicyFetchResponse>
156 policy_response);
156 157
157 // Called by DeviceSettingsService when modified and signed device 158 // Called by DeviceSettingsService when modified and signed device
158 // settings are stored. 159 // settings are stored.
159 void OnSignedPolicyStored(bool success); 160 void OnSignedPolicyStored(bool success);
160 161
161 // Report status to observers and tries to continue storing pending chages to 162 // Report status to observers and tries to continue storing pending chages to
162 // device settings. 163 // device settings.
163 void ReportStatusAndContinueStoring(bool success); 164 void ReportStatusAndContinueStoring(bool success);
164 165
165 DeviceSettingsService* device_settings_service_; 166 DeviceSettingsService* device_settings_service_;
166 167
167 // Profile this service instance belongs to. 168 // Profile this service instance belongs to.
168 Profile* profile_; 169 Profile* profile_;
169 170
170 // User ID this service instance belongs to. 171 // User ID this service instance belongs to.
171 std::string user_id_; 172 std::string user_id_;
172 173
173 // Whether profile still needs to be initialized. 174 // Whether profile still needs to be initialized.
174 bool waiting_for_profile_creation_; 175 bool waiting_for_profile_creation_;
175 176
176 // Whether TPM token still needs to be initialized. 177 // Whether TPM token still needs to be initialized.
177 bool waiting_for_tpm_token_; 178 bool waiting_for_tpm_token_;
178 179
179 // True if local-owner policy fixups are still pending. 180 // True if local-owner policy fixups are still pending.
180 bool has_pending_fixups_; 181 bool has_pending_fixups_;
181 182
182 // A set of pending changes to device settings. 183 // A set of pending changes to device settings.
183 base::ScopedPtrHashMap<std::string, scoped_ptr<base::Value>> pending_changes_; 184 base::ScopedPtrHashMap<std::string, std::unique_ptr<base::Value>>
185 pending_changes_;
184 186
185 // True if there're pending changes to management settings. 187 // True if there're pending changes to management settings.
186 bool has_pending_management_settings_; 188 bool has_pending_management_settings_;
187 189
188 // A set of pending changes to management settings. 190 // A set of pending changes to management settings.
189 ManagementSettings pending_management_settings_; 191 ManagementSettings pending_management_settings_;
190 192
191 // A set of callbacks that need to be run after management settings 193 // A set of callbacks that need to be run after management settings
192 // are set and policy is stored. 194 // are set and policy is stored.
193 std::vector<OnManagementSettingsSetCallback> 195 std::vector<OnManagementSettingsSetCallback>
194 pending_management_settings_callbacks_; 196 pending_management_settings_callbacks_;
195 197
196 // A protobuf containing pending changes to device settings. 198 // A protobuf containing pending changes to device settings.
197 scoped_ptr<enterprise_management::ChromeDeviceSettingsProto> 199 std::unique_ptr<enterprise_management::ChromeDeviceSettingsProto>
198 tentative_settings_; 200 tentative_settings_;
199 201
200 content::NotificationRegistrar registrar_; 202 content::NotificationRegistrar registrar_;
201 203
202 base::WeakPtrFactory<OwnerSettingsServiceChromeOS> weak_factory_; 204 base::WeakPtrFactory<OwnerSettingsServiceChromeOS> weak_factory_;
203 205
204 base::WeakPtrFactory<OwnerSettingsServiceChromeOS> store_settings_factory_; 206 base::WeakPtrFactory<OwnerSettingsServiceChromeOS> store_settings_factory_;
205 207
206 DISALLOW_COPY_AND_ASSIGN(OwnerSettingsServiceChromeOS); 208 DISALLOW_COPY_AND_ASSIGN(OwnerSettingsServiceChromeOS);
207 }; 209 };
208 210
209 } // namespace chromeos 211 } // namespace chromeos
210 212
211 #endif // CHROME_BROWSER_CHROMEOS_OWNERSHIP_OWNER_SETTINGS_SERVICE_CHROMEOS_H_ 213 #endif // CHROME_BROWSER_CHROMEOS_OWNERSHIP_OWNER_SETTINGS_SERVICE_CHROMEOS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698