| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/app_mode/kiosk_profile_loader.h" | 5 #include "chrome/browser/chromeos/app_mode/kiosk_profile_loader.h" |
| 6 | 6 |
| 7 #include "base/location.h" |
| 7 #include "base/logging.h" | 8 #include "base/logging.h" |
| 8 #include "base/macros.h" | 9 #include "base/macros.h" |
| 9 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
| 10 #include "base/message_loop/message_loop.h" | 11 #include "base/single_thread_task_runner.h" |
| 11 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
| 12 #include "base/sys_info.h" | 13 #include "base/sys_info.h" |
| 14 #include "base/threading/thread_task_runner_handle.h" |
| 13 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" | 15 #include "chrome/browser/chromeos/app_mode/kiosk_app_manager.h" |
| 14 #include "chrome/browser/chromeos/login/auth/chrome_login_performer.h" | 16 #include "chrome/browser/chromeos/login/auth/chrome_login_performer.h" |
| 15 #include "chrome/browser/chromeos/login/demo_mode/demo_app_launcher.h" | 17 #include "chrome/browser/chromeos/login/demo_mode/demo_app_launcher.h" |
| 16 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" | 18 #include "chrome/browser/chromeos/login/ui/login_display_host_impl.h" |
| 17 #include "chrome/browser/chromeos/settings/cros_settings.h" | 19 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 18 #include "chrome/browser/lifetime/application_lifetime.h" | 20 #include "chrome/browser/lifetime/application_lifetime.h" |
| 19 #include "chromeos/cryptohome/async_method_caller.h" | 21 #include "chromeos/cryptohome/async_method_caller.h" |
| 20 #include "chromeos/dbus/cryptohome_client.h" | 22 #include "chromeos/dbus/cryptohome_client.h" |
| 21 #include "chromeos/dbus/dbus_thread_manager.h" | 23 #include "chromeos/dbus/dbus_thread_manager.h" |
| 22 #include "chromeos/login/auth/auth_status_consumer.h" | 24 #include "chromeos/login/auth/auth_status_consumer.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 void Retry() { | 79 void Retry() { |
| 78 const int kMaxRetryTimes = 5; | 80 const int kMaxRetryTimes = 5; |
| 79 ++retry_count_; | 81 ++retry_count_; |
| 80 if (retry_count_ > kMaxRetryTimes) { | 82 if (retry_count_ > kMaxRetryTimes) { |
| 81 LOG(ERROR) << "Could not talk to cryptohomed for launching kiosk app."; | 83 LOG(ERROR) << "Could not talk to cryptohomed for launching kiosk app."; |
| 82 ReportCheckResult(KioskAppLaunchError::CRYPTOHOMED_NOT_RUNNING); | 84 ReportCheckResult(KioskAppLaunchError::CRYPTOHOMED_NOT_RUNNING); |
| 83 return; | 85 return; |
| 84 } | 86 } |
| 85 | 87 |
| 86 const int retry_delay_in_milliseconds = 500 * (1 << retry_count_); | 88 const int retry_delay_in_milliseconds = 500 * (1 << retry_count_); |
| 87 base::MessageLoop::current()->PostDelayedTask( | 89 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 88 FROM_HERE, base::Bind(&CryptohomedChecker::StartCheck, AsWeakPtr()), | 90 FROM_HERE, base::Bind(&CryptohomedChecker::StartCheck, AsWeakPtr()), |
| 89 base::TimeDelta::FromMilliseconds(retry_delay_in_milliseconds)); | 91 base::TimeDelta::FromMilliseconds(retry_delay_in_milliseconds)); |
| 90 } | 92 } |
| 91 | 93 |
| 92 void OnServiceAvailibityChecked(bool service_is_ready) { | 94 void OnServiceAvailibityChecked(bool service_is_ready) { |
| 93 if (!service_is_ready) { | 95 if (!service_is_ready) { |
| 94 Retry(); | 96 Retry(); |
| 95 return; | 97 return; |
| 96 } | 98 } |
| 97 | 99 |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 bool browser_launched) { | 204 bool browser_launched) { |
| 203 // This object could be deleted any time after successfully reporting | 205 // This object could be deleted any time after successfully reporting |
| 204 // a profile load, so invalidate the delegate now. | 206 // a profile load, so invalidate the delegate now. |
| 205 UserSessionManager::GetInstance()->DelegateDeleted(this); | 207 UserSessionManager::GetInstance()->DelegateDeleted(this); |
| 206 | 208 |
| 207 delegate_->OnProfileLoaded(profile); | 209 delegate_->OnProfileLoaded(profile); |
| 208 ReportLaunchResult(KioskAppLaunchError::NONE); | 210 ReportLaunchResult(KioskAppLaunchError::NONE); |
| 209 } | 211 } |
| 210 | 212 |
| 211 } // namespace chromeos | 213 } // namespace chromeos |
| OLD | NEW |