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

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

Issue 2033753002: Remove use of deprecated MessageLoop methods in chrome/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: manual change Created 4 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
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 <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/location.h"
10 #include "base/logging.h" 11 #include "base/logging.h"
11 #include "base/message_loop/message_loop.h" 12 #include "base/single_thread_task_runner.h"
12 #include "base/stl_util.h" 13 #include "base/stl_util.h"
14 #include "base/threading/thread_task_runner_handle.h"
13 #include "base/time/time.h" 15 #include "base/time/time.h"
14 #include "chrome/browser/chrome_notification_types.h" 16 #include "chrome/browser/chrome_notification_types.h"
15 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h" 17 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h"
16 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" 18 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h"
17 #include "chrome/browser/chromeos/settings/session_manager_operation.h" 19 #include "chrome/browser/chromeos/settings/session_manager_operation.h"
18 #include "components/ownership/owner_key_util.h" 20 #include "components/ownership/owner_key_util.h"
19 #include "components/policy/core/common/cloud/cloud_policy_constants.h" 21 #include "components/policy/core/common/cloud/cloud_policy_constants.h"
20 #include "content/public/browser/browser_thread.h" 22 #include "content/public/browser/browser_thread.h"
21 #include "content/public/browser/notification_service.h" 23 #include "content/public/browser/notification_service.h"
22 #include "content/public/browser/notification_source.h" 24 #include "content/public/browser/notification_source.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
128 DeviceSettingsService::GetOwnershipStatus() { 130 DeviceSettingsService::GetOwnershipStatus() {
129 if (public_key_.get()) 131 if (public_key_.get())
130 return public_key_->is_loaded() ? OWNERSHIP_TAKEN : OWNERSHIP_NONE; 132 return public_key_->is_loaded() ? OWNERSHIP_TAKEN : OWNERSHIP_NONE;
131 return OWNERSHIP_UNKNOWN; 133 return OWNERSHIP_UNKNOWN;
132 } 134 }
133 135
134 void DeviceSettingsService::GetOwnershipStatusAsync( 136 void DeviceSettingsService::GetOwnershipStatusAsync(
135 const OwnershipStatusCallback& callback) { 137 const OwnershipStatusCallback& callback) {
136 if (public_key_.get()) { 138 if (public_key_.get()) {
137 // If there is a key, report status immediately. 139 // If there is a key, report status immediately.
138 base::MessageLoop::current()->PostTask( 140 base::ThreadTaskRunnerHandle::Get()->PostTask(
139 FROM_HERE, base::Bind(callback, GetOwnershipStatus())); 141 FROM_HERE, base::Bind(callback, GetOwnershipStatus()));
140 } else { 142 } else {
141 // If the key hasn't been loaded yet, enqueue the callback to be fired when 143 // If the key hasn't been loaded yet, enqueue the callback to be fired when
142 // the next SessionManagerOperation completes. If no operation is pending, 144 // the next SessionManagerOperation completes. If no operation is pending,
143 // start a load operation to fetch the key and report the result. 145 // start a load operation to fetch the key and report the result.
144 pending_ownership_status_callbacks_.push_back(callback); 146 pending_ownership_status_callbacks_.push_back(callback);
145 if (pending_operations_.empty()) 147 if (pending_operations_.empty())
146 EnqueueLoad(false); 148 EnqueueLoad(false);
147 } 149 }
148 } 150 }
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 DeviceSettingsService::Initialize(); 327 DeviceSettingsService::Initialize();
326 } 328 }
327 329
328 ScopedTestDeviceSettingsService::~ScopedTestDeviceSettingsService() { 330 ScopedTestDeviceSettingsService::~ScopedTestDeviceSettingsService() {
329 // Clean pending operations. 331 // Clean pending operations.
330 DeviceSettingsService::Get()->UnsetSessionManager(); 332 DeviceSettingsService::Get()->UnsetSessionManager();
331 DeviceSettingsService::Shutdown(); 333 DeviceSettingsService::Shutdown();
332 } 334 }
333 335
334 } // namespace chromeos 336 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698