| OLD | NEW |
| 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 Loading... |
| 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 CrosSettings; |
| 37 class FakeOwnerSettingsService; | 38 class FakeOwnerSettingsService; |
| 38 | 39 |
| 39 // The class is a profile-keyed service which holds public/private | 40 // The class is a profile-keyed service which holds public/private |
| 40 // keypair corresponds to a profile. The keypair is reloaded automatically when | 41 // keypair corresponds to a profile. The keypair is reloaded automatically when |
| 41 // profile is created and TPM token is ready. Note that the private part of a | 42 // profile is created and TPM token is ready. Note that the private part of a |
| 42 // key can be loaded only for the owner. | 43 // key can be loaded only for the owner. |
| 43 // | 44 // |
| 44 // TODO (ygorshenin@): move write path for device settings here | 45 // TODO (ygorshenin@): move write path for device settings here |
| 45 // (crbug.com/230018). | 46 // (crbug.com/230018). |
| 46 class OwnerSettingsServiceChromeOS : public ownership::OwnerSettingsService, | 47 class OwnerSettingsServiceChromeOS : public ownership::OwnerSettingsService, |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 enterprise_management::ChromeDeviceSettingsProto& settings); | 115 enterprise_management::ChromeDeviceSettingsProto& settings); |
| 115 | 116 |
| 116 bool has_pending_changes() const { | 117 bool has_pending_changes() const { |
| 117 return !pending_changes_.empty() || tentative_settings_.get() || | 118 return !pending_changes_.empty() || tentative_settings_.get() || |
| 118 has_pending_management_settings_; | 119 has_pending_management_settings_; |
| 119 } | 120 } |
| 120 | 121 |
| 121 protected: | 122 protected: |
| 122 OwnerSettingsServiceChromeOS( | 123 OwnerSettingsServiceChromeOS( |
| 123 DeviceSettingsService* device_settings_service, | 124 DeviceSettingsService* device_settings_service, |
| 125 CrosSettings* cros_settings, |
| 124 Profile* profile, | 126 Profile* profile, |
| 125 const scoped_refptr<ownership::OwnerKeyUtil>& owner_key_util); | 127 const scoped_refptr<ownership::OwnerKeyUtil>& owner_key_util); |
| 126 | 128 |
| 127 private: | 129 private: |
| 128 friend class OwnerSettingsServiceChromeOSFactory; | 130 friend class OwnerSettingsServiceChromeOSFactory; |
| 129 | 131 |
| 130 // OwnerSettingsService protected interface overrides: | 132 // OwnerSettingsService protected interface overrides: |
| 131 | 133 |
| 132 // Reloads private key from profile's NSS slots, responds via |callback|. | 134 // Reloads private key from profile's NSS slots, responds via |callback|. |
| 133 void ReloadKeypairImpl(const base::Callback< | 135 void ReloadKeypairImpl(const base::Callback< |
| 134 void(const scoped_refptr<ownership::PublicKey>& public_key, | 136 void(const scoped_refptr<ownership::PublicKey>& public_key, |
| 135 const scoped_refptr<ownership::PrivateKey>& private_key)>& callback) | 137 const scoped_refptr<ownership::PrivateKey>& private_key)>& callback) |
| 136 override; | 138 override; |
| 137 | 139 |
| 138 // Possibly notifies DeviceSettingsService that owner's keypair is loaded. | 140 // Possibly notifies DeviceSettingsService that owner's keypair is loaded. |
| 139 void OnPostKeypairLoadedActions() override; | 141 void OnPostKeypairLoadedActions() override; |
| 140 | 142 |
| 143 // Once trusted settings are loaded, ensures that the Owner's user_id_ is |
| 144 // on the user account whitelist. |
| 145 void FixupLocalOwnerPolicy(); |
| 146 |
| 141 // Tries to apply recent changes to device settings proto, sign it and store. | 147 // Tries to apply recent changes to device settings proto, sign it and store. |
| 142 void StorePendingChanges(); | 148 void StorePendingChanges(); |
| 143 | 149 |
| 144 // Called when current device settings are successfully signed. | 150 // Called when current device settings are successfully signed. |
| 145 // Sends signed settings for storage. | 151 // Sends signed settings for storage. |
| 146 void OnPolicyAssembledAndSigned( | 152 void OnPolicyAssembledAndSigned( |
| 147 scoped_ptr<enterprise_management::PolicyFetchResponse> policy_response); | 153 scoped_ptr<enterprise_management::PolicyFetchResponse> policy_response); |
| 148 | 154 |
| 149 // Called by DeviceSettingsService when modified and signed device | 155 // Called by DeviceSettingsService when modified and signed device |
| 150 // settings are stored. | 156 // settings are stored. |
| 151 void OnSignedPolicyStored(bool success); | 157 void OnSignedPolicyStored(bool success); |
| 152 | 158 |
| 153 // Report status to observers and tries to continue storing pending chages to | 159 // Report status to observers and tries to continue storing pending chages to |
| 154 // device settings. | 160 // device settings. |
| 155 void ReportStatusAndContinueStoring(bool success); | 161 void ReportStatusAndContinueStoring(bool success); |
| 156 | 162 |
| 157 DeviceSettingsService* device_settings_service_; | 163 DeviceSettingsService* device_settings_service_; |
| 158 | 164 |
| 165 CrosSettings* cros_settings_; |
| 166 |
| 159 // Profile this service instance belongs to. | 167 // Profile this service instance belongs to. |
| 160 Profile* profile_; | 168 Profile* profile_; |
| 161 | 169 |
| 162 // User ID this service instance belongs to. | 170 // User ID this service instance belongs to. |
| 163 std::string user_id_; | 171 std::string user_id_; |
| 164 | 172 |
| 165 // Whether profile still needs to be initialized. | 173 // Whether profile still needs to be initialized. |
| 166 bool waiting_for_profile_creation_; | 174 bool waiting_for_profile_creation_; |
| 167 | 175 |
| 168 // Whether TPM token still needs to be initialized. | 176 // Whether TPM token still needs to be initialized. |
| (...skipping 22 matching lines...) Expand all Loading... |
| 191 base::WeakPtrFactory<OwnerSettingsServiceChromeOS> weak_factory_; | 199 base::WeakPtrFactory<OwnerSettingsServiceChromeOS> weak_factory_; |
| 192 | 200 |
| 193 base::WeakPtrFactory<OwnerSettingsServiceChromeOS> store_settings_factory_; | 201 base::WeakPtrFactory<OwnerSettingsServiceChromeOS> store_settings_factory_; |
| 194 | 202 |
| 195 DISALLOW_COPY_AND_ASSIGN(OwnerSettingsServiceChromeOS); | 203 DISALLOW_COPY_AND_ASSIGN(OwnerSettingsServiceChromeOS); |
| 196 }; | 204 }; |
| 197 | 205 |
| 198 } // namespace chromeos | 206 } // namespace chromeos |
| 199 | 207 |
| 200 #endif // CHROME_BROWSER_CHROMEOS_OWNERSHIP_OWNER_SETTINGS_SERVICE_CHROMEOS_H_ | 208 #endif // CHROME_BROWSER_CHROMEOS_OWNERSHIP_OWNER_SETTINGS_SERVICE_CHROMEOS_H_ |
| OLD | NEW |