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

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

Issue 985093002: Fix up Owner settings on first load (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: modify protobuf directly Created 5 years, 9 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 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 const OnManagementSettingsSetCallback& callback); 94 const OnManagementSettingsSetCallback& callback);
95 95
96 // 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
97 // 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.
98 static void IsOwnerForSafeModeAsync( 98 static void IsOwnerForSafeModeAsync(
99 const std::string& user_hash, 99 const std::string& user_hash,
100 const scoped_refptr<ownership::OwnerKeyUtil>& owner_key_util, 100 const scoped_refptr<ownership::OwnerKeyUtil>& owner_key_util,
101 const IsOwnerCallback& callback); 101 const IsOwnerCallback& callback);
102 102
103 // Assembles PolicyData based on |settings|, |policy_data| and 103 // Assembles PolicyData based on |settings|, |policy_data| and
104 // |user_id|. 104 // |user_id|. Applies local-owner policy fixups if needed.
105 static scoped_ptr<enterprise_management::PolicyData> AssemblePolicy( 105 static scoped_ptr<enterprise_management::PolicyData> AssemblePolicy(
106 const std::string& user_id, 106 const std::string& user_id,
107 const enterprise_management::PolicyData* policy_data, 107 const enterprise_management::PolicyData* policy_data,
108 const enterprise_management::ChromeDeviceSettingsProto* settings); 108 enterprise_management::ChromeDeviceSettingsProto* settings);
109 109
110 // Updates device |settings|. 110 // Updates device |settings|.
111 static void UpdateDeviceSettings( 111 static void UpdateDeviceSettings(
112 const std::string& path, 112 const std::string& path,
113 const base::Value& value, 113 const base::Value& value,
114 enterprise_management::ChromeDeviceSettingsProto& settings); 114 enterprise_management::ChromeDeviceSettingsProto& settings);
115 115
116 bool has_pending_changes() const { 116 bool has_pending_changes() const {
117 return !pending_changes_.empty() || tentative_settings_.get() || 117 return !pending_changes_.empty() || tentative_settings_.get() ||
118 has_pending_management_settings_; 118 has_pending_management_settings_;
119 } 119 }
120 120
121 protected: 121 protected:
122 OwnerSettingsServiceChromeOS( 122 OwnerSettingsServiceChromeOS(
123 DeviceSettingsService* device_settings_service, 123 DeviceSettingsService* device_settings_service,
124 Profile* profile, 124 Profile* profile,
125 const scoped_refptr<ownership::OwnerKeyUtil>& owner_key_util); 125 const scoped_refptr<ownership::OwnerKeyUtil>& owner_key_util);
126 126
127 private: 127 private:
128 friend class OwnerSettingsServiceChromeOSFactory; 128 friend class OwnerSettingsServiceChromeOSFactory;
129 129
130 // Ensures that the user_id is on the user account whitelist.
131 static void FixupLocalOwnerPolicy(
132 const std::string& user_id,
133 enterprise_management::ChromeDeviceSettingsProto* settings);
134
130 // OwnerSettingsService protected interface overrides: 135 // OwnerSettingsService protected interface overrides:
131 136
132 // Reloads private key from profile's NSS slots, responds via |callback|. 137 // Reloads private key from profile's NSS slots, responds via |callback|.
133 void ReloadKeypairImpl(const base::Callback< 138 void ReloadKeypairImpl(const base::Callback<
134 void(const scoped_refptr<ownership::PublicKey>& public_key, 139 void(const scoped_refptr<ownership::PublicKey>& public_key,
135 const scoped_refptr<ownership::PrivateKey>& private_key)>& callback) 140 const scoped_refptr<ownership::PrivateKey>& private_key)>& callback)
136 override; 141 override;
137 142
138 // Possibly notifies DeviceSettingsService that owner's keypair is loaded. 143 // Possibly notifies DeviceSettingsService that owner's keypair is loaded.
139 void OnPostKeypairLoadedActions() override; 144 void OnPostKeypairLoadedActions() override;
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 base::WeakPtrFactory<OwnerSettingsServiceChromeOS> weak_factory_; 196 base::WeakPtrFactory<OwnerSettingsServiceChromeOS> weak_factory_;
192 197
193 base::WeakPtrFactory<OwnerSettingsServiceChromeOS> store_settings_factory_; 198 base::WeakPtrFactory<OwnerSettingsServiceChromeOS> store_settings_factory_;
194 199
195 DISALLOW_COPY_AND_ASSIGN(OwnerSettingsServiceChromeOS); 200 DISALLOW_COPY_AND_ASSIGN(OwnerSettingsServiceChromeOS);
196 }; 201 };
197 202
198 } // namespace chromeos 203 } // namespace chromeos
199 204
200 #endif // CHROME_BROWSER_CHROMEOS_OWNERSHIP_OWNER_SETTINGS_SERVICE_CHROMEOS_H_ 205 #endif // CHROME_BROWSER_CHROMEOS_OWNERSHIP_OWNER_SETTINGS_SERVICE_CHROMEOS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698