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

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

Powered by Google App Engine
This is Rietveld 408576698