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

Side by Side Diff: chrome/browser/chromeos/settings/device_settings_service.cc

Issue 20130002: Call crypto::InitializeTPMToken on the IO thread (Take 2) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 7 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "chrome/browser/chromeos/settings/device_settings_service.h" 5 #include "chrome/browser/chromeos/settings/device_settings_service.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/stl_util.h" 10 #include "base/stl_util.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 DeviceSettingsService* DeviceSettingsService::Get() { 68 DeviceSettingsService* DeviceSettingsService::Get() {
69 CHECK(g_device_settings_service); 69 CHECK(g_device_settings_service);
70 return g_device_settings_service; 70 return g_device_settings_service;
71 } 71 }
72 72
73 DeviceSettingsService::DeviceSettingsService() 73 DeviceSettingsService::DeviceSettingsService()
74 : session_manager_client_(NULL), 74 : session_manager_client_(NULL),
75 weak_factory_(this), 75 weak_factory_(this),
76 store_status_(STORE_SUCCESS), 76 store_status_(STORE_SUCCESS),
77 load_retries_left_(kMaxLoadRetries) { 77 load_retries_left_(kMaxLoadRetries) {
78 if (CertLoader::IsInitialized())
79 CertLoader::Get()->AddObserver(this);
78 } 80 }
79 81
80 DeviceSettingsService::~DeviceSettingsService() { 82 DeviceSettingsService::~DeviceSettingsService() {
81 DCHECK(pending_operations_.empty()); 83 DCHECK(pending_operations_.empty());
84 if (CertLoader::IsInitialized())
85 CertLoader::Get()->RemoveObserver(this);
82 } 86 }
83 87
84 void DeviceSettingsService::SetSessionManager( 88 void DeviceSettingsService::SetSessionManager(
85 SessionManagerClient* session_manager_client, 89 SessionManagerClient* session_manager_client,
86 scoped_refptr<OwnerKeyUtil> owner_key_util) { 90 scoped_refptr<OwnerKeyUtil> owner_key_util) {
87 DCHECK(session_manager_client); 91 DCHECK(session_manager_client);
88 DCHECK(owner_key_util.get()); 92 DCHECK(owner_key_util.get());
89 DCHECK(!session_manager_client_); 93 DCHECK(!session_manager_client_);
90 DCHECK(!owner_key_util_.get()); 94 DCHECK(!owner_key_util_.get());
91 95
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 205
202 void DeviceSettingsService::PropertyChangeComplete(bool success) { 206 void DeviceSettingsService::PropertyChangeComplete(bool success) {
203 if (!success) { 207 if (!success) {
204 LOG(ERROR) << "Policy update failed."; 208 LOG(ERROR) << "Policy update failed.";
205 return; 209 return;
206 } 210 }
207 211
208 EnsureReload(false); 212 EnsureReload(false);
209 } 213 }
210 214
215 void DeviceSettingsService::OnCertificatesLoaded(
216 const net::CertificateList& cert_list,
217 bool initial_load) {
218 // CertLoader initializes the TPM and NSS database which is necessary to
219 // determine ownership. Force a reload once we know these are initialized.
220 EnsureReload(true);
221 }
222
211 void DeviceSettingsService::Enqueue(SessionManagerOperation* operation) { 223 void DeviceSettingsService::Enqueue(SessionManagerOperation* operation) {
212 pending_operations_.push_back(operation); 224 pending_operations_.push_back(operation);
213 if (pending_operations_.front() == operation) 225 if (pending_operations_.front() == operation)
214 StartNextOperation(); 226 StartNextOperation();
215 } 227 }
216 228
217 void DeviceSettingsService::EnqueueLoad(bool force_key_load) { 229 void DeviceSettingsService::EnqueueLoad(bool force_key_load) {
218 SessionManagerOperation* operation = 230 SessionManagerOperation* operation =
219 new LoadSettingsOperation( 231 new LoadSettingsOperation(
220 base::Bind(&DeviceSettingsService::HandleCompletedOperation, 232 base::Bind(&DeviceSettingsService::HandleCompletedOperation,
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 329
318 ScopedTestDeviceSettingsService::ScopedTestDeviceSettingsService() { 330 ScopedTestDeviceSettingsService::ScopedTestDeviceSettingsService() {
319 DeviceSettingsService::Initialize(); 331 DeviceSettingsService::Initialize();
320 } 332 }
321 333
322 ScopedTestDeviceSettingsService::~ScopedTestDeviceSettingsService() { 334 ScopedTestDeviceSettingsService::~ScopedTestDeviceSettingsService() {
323 DeviceSettingsService::Shutdown(); 335 DeviceSettingsService::Shutdown();
324 } 336 }
325 337
326 } // namespace chromeos 338 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698