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

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

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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/file_util.h" 8 #include "base/file_util.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 if (owner_key_.get()) 144 if (owner_key_.get())
145 return owner_key_->public_key() ? OWNERSHIP_TAKEN : OWNERSHIP_NONE; 145 return owner_key_->public_key() ? OWNERSHIP_TAKEN : OWNERSHIP_NONE;
146 146
147 return OWNERSHIP_UNKNOWN; 147 return OWNERSHIP_UNKNOWN;
148 } 148 }
149 149
150 void DeviceSettingsService::GetOwnershipStatusAsync( 150 void DeviceSettingsService::GetOwnershipStatusAsync(
151 const OwnershipStatusCallback& callback) { 151 const OwnershipStatusCallback& callback) {
152 if (owner_key_.get()) { 152 if (owner_key_.get()) {
153 // If there is a key, report status immediately. 153 // If there is a key, report status immediately.
154 MessageLoop::current()->PostTask( 154 base::MessageLoop::current()->PostTask(
155 FROM_HERE, 155 FROM_HERE,
156 base::Bind(callback, 156 base::Bind(callback,
157 owner_key_->public_key() ? OWNERSHIP_TAKEN : OWNERSHIP_NONE, 157 owner_key_->public_key() ? OWNERSHIP_TAKEN : OWNERSHIP_NONE,
158 owner_key_->private_key() != NULL)); 158 owner_key_->private_key() != NULL));
159 } else { 159 } else {
160 // If the key hasn't been loaded yet, enqueue the callback to be fired when 160 // If the key hasn't been loaded yet, enqueue the callback to be fired when
161 // the next SessionManagerOperation completes. If no operation is pending, 161 // the next SessionManagerOperation completes. If no operation is pending,
162 // start a load operation to fetch the key and report the result. 162 // start a load operation to fetch the key and report the result.
163 pending_ownership_status_callbacks_.push_back(callback); 163 pending_ownership_status_callbacks_.push_back(callback);
164 if (pending_operations_.empty()) 164 if (pending_operations_.empty())
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
318 318
319 ScopedTestDeviceSettingsService::ScopedTestDeviceSettingsService() { 319 ScopedTestDeviceSettingsService::ScopedTestDeviceSettingsService() {
320 DeviceSettingsService::Initialize(); 320 DeviceSettingsService::Initialize();
321 } 321 }
322 322
323 ScopedTestDeviceSettingsService::~ScopedTestDeviceSettingsService() { 323 ScopedTestDeviceSettingsService::~ScopedTestDeviceSettingsService() {
324 DeviceSettingsService::Shutdown(); 324 DeviceSettingsService::Shutdown();
325 } 325 }
326 326
327 } // namespace chromeos 327 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698