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/policy/enrollment_handler_chromeos.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/policy/enrollment_handler_chromeos.h" 5 #include "chrome/browser/chromeos/policy/enrollment_handler_chromeos.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"
13 #include "base/threading/thread_task_runner_handle.h"
12 #include "chrome/browser/browser_process.h" 14 #include "chrome/browser/browser_process.h"
13 #include "chrome/browser/chromeos/login/enrollment/auto_enrollment_controller.h" 15 #include "chrome/browser/chromeos/login/enrollment/auto_enrollment_controller.h"
14 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h" 16 #include "chrome/browser/chromeos/ownership/owner_settings_service_chromeos.h"
15 #include "chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.h" 17 #include "chrome/browser/chromeos/policy/device_cloud_policy_store_chromeos.h"
16 #include "chrome/browser/chromeos/policy/enrollment_status_chromeos.h" 18 #include "chrome/browser/chromeos/policy/enrollment_status_chromeos.h"
17 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" 19 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h"
18 #include "chrome/browser/chromeos/policy/server_backed_state_keys_broker.h" 20 #include "chrome/browser/chromeos/policy/server_backed_state_keys_broker.h"
19 #include "chrome/browser/chromeos/profiles/profile_helper.h" 21 #include "chrome/browser/chromeos/profiles/profile_helper.h"
20 #include "chrome/browser/chromeos/settings/device_oauth2_token_service.h" 22 #include "chrome/browser/chromeos/settings/device_oauth2_token_service.h"
21 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h " 23 #include "chrome/browser/chromeos/settings/device_oauth2_token_service_factory.h "
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 case EnterpriseInstallAttributes::LOCK_SUCCESS: 409 case EnterpriseInstallAttributes::LOCK_SUCCESS:
408 StartStoreRobotAuth(); 410 StartStoreRobotAuth();
409 break; 411 break;
410 case EnterpriseInstallAttributes::LOCK_NOT_READY: 412 case EnterpriseInstallAttributes::LOCK_NOT_READY:
411 // We wait up to |kLockRetryTimeoutMs| milliseconds and if it hasn't 413 // We wait up to |kLockRetryTimeoutMs| milliseconds and if it hasn't
412 // succeeded by then show an error to the user and stop the enrollment. 414 // succeeded by then show an error to the user and stop the enrollment.
413 if (lockbox_init_duration_ < kLockRetryTimeoutMs) { 415 if (lockbox_init_duration_ < kLockRetryTimeoutMs) {
414 // InstallAttributes not ready yet, retry later. 416 // InstallAttributes not ready yet, retry later.
415 LOG(WARNING) << "Install Attributes not ready yet will retry in " 417 LOG(WARNING) << "Install Attributes not ready yet will retry in "
416 << kLockRetryIntervalMs << "ms."; 418 << kLockRetryIntervalMs << "ms.";
417 base::MessageLoop::current()->PostDelayedTask( 419 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
418 FROM_HERE, 420 FROM_HERE, base::Bind(&EnrollmentHandlerChromeOS::StartLockDevice,
419 base::Bind(&EnrollmentHandlerChromeOS::StartLockDevice, 421 weak_ptr_factory_.GetWeakPtr()),
420 weak_ptr_factory_.GetWeakPtr()),
421 base::TimeDelta::FromMilliseconds(kLockRetryIntervalMs)); 422 base::TimeDelta::FromMilliseconds(kLockRetryIntervalMs));
422 lockbox_init_duration_ += kLockRetryIntervalMs; 423 lockbox_init_duration_ += kLockRetryIntervalMs;
423 } else { 424 } else {
424 HandleLockDeviceResult(EnterpriseInstallAttributes::LOCK_TIMEOUT); 425 HandleLockDeviceResult(EnterpriseInstallAttributes::LOCK_TIMEOUT);
425 } 426 }
426 break; 427 break;
427 case EnterpriseInstallAttributes::LOCK_TIMEOUT: 428 case EnterpriseInstallAttributes::LOCK_TIMEOUT:
428 case EnterpriseInstallAttributes::LOCK_BACKEND_INVALID: 429 case EnterpriseInstallAttributes::LOCK_BACKEND_INVALID:
429 case EnterpriseInstallAttributes::LOCK_ALREADY_LOCKED: 430 case EnterpriseInstallAttributes::LOCK_ALREADY_LOCKED:
430 case EnterpriseInstallAttributes::LOCK_SET_ERROR: 431 case EnterpriseInstallAttributes::LOCK_SET_ERROR:
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
490 << ", validation: " << status.validation_status() 491 << ", validation: " << status.validation_status()
491 << ", store: " << status.store_status() 492 << ", store: " << status.store_status()
492 << ", lock: " << status.lock_status(); 493 << ", lock: " << status.lock_status();
493 } 494 }
494 495
495 if (!callback.is_null()) 496 if (!callback.is_null())
496 callback.Run(status); 497 callback.Run(status);
497 } 498 }
498 499
499 } // namespace policy 500 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698