| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/login/login_performer.h" | 5 #include "chrome/browser/chromeos/login/login_performer.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
| 10 #include "app/resource_bundle.h" | 10 #include "app/resource_bundle.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/message_loop.h" | 12 #include "base/message_loop.h" |
| 13 #include "base/metrics/histogram.h" | 13 #include "base/metrics/histogram.h" |
| 14 #include "chrome/browser/browser_process.h" | 14 #include "chrome/browser/browser_process.h" |
| 15 #include "chrome/browser/browser_thread.h" | 15 #include "chrome/browser/browser_thread.h" |
| 16 #include "chrome/browser/chromeos/boot_times_loader.h" | 16 #include "chrome/browser/chromeos/boot_times_loader.h" |
| 17 #include "chrome/browser/chromeos/cros/cros_library.h" | 17 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 18 #include "chrome/browser/chromeos/cros/screen_lock_library.h" | 18 #include "chrome/browser/chromeos/cros/screen_lock_library.h" |
| 19 #include "chrome/browser/chromeos/login/login_utils.h" | 19 #include "chrome/browser/chromeos/login/login_utils.h" |
| 20 #include "chrome/browser/chromeos/login/screen_locker.h" | 20 #include "chrome/browser/chromeos/login/screen_locker.h" |
| 21 #include "chrome/browser/chromeos/user_cros_settings_provider.h" | 21 #include "chrome/browser/chromeos/user_cros_settings_provider.h" |
| 22 #include "chrome/browser/metrics/user_metrics.h" | 22 #include "chrome/browser/metrics/user_metrics.h" |
| 23 #include "chrome/browser/profiles/profile.h" |
| 24 #include "chrome/browser/profiles/profile_manager.h" |
| 23 #include "chrome/common/notification_service.h" | 25 #include "chrome/common/notification_service.h" |
| 24 #include "chrome/common/notification_type.h" | 26 #include "chrome/common/notification_type.h" |
| 25 #include "chrome/browser/profiles/profile.h" | |
| 26 #include "chrome/browser/profiles/profile_manager.h" | |
| 27 #include "grit/generated_resources.h" | 27 #include "grit/generated_resources.h" |
| 28 | 28 |
| 29 namespace chromeos { | 29 namespace chromeos { |
| 30 | 30 |
| 31 // Initialize default LoginPerformer. | 31 // Initialize default LoginPerformer. |
| 32 // static | 32 // static |
| 33 LoginPerformer* LoginPerformer::default_performer_ = NULL; | 33 LoginPerformer* LoginPerformer::default_performer_ = NULL; |
| 34 | 34 |
| 35 LoginPerformer::LoginPerformer(Delegate* delegate) | 35 LoginPerformer::LoginPerformer(Delegate* delegate) |
| 36 : last_login_failure_(LoginFailure::None()), | 36 : last_login_failure_(LoginFailure::None()), |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 // LoginPerformer ownership. LP now manages it's lifetime on its own. | 120 // LoginPerformer ownership. LP now manages it's lifetime on its own. |
| 121 // 2 things could make it exist longer: | 121 // 2 things could make it exist longer: |
| 122 // 1. ScreenLock active (pending correct new password input) | 122 // 1. ScreenLock active (pending correct new password input) |
| 123 // 2. Pending online auth request. | 123 // 2. Pending online auth request. |
| 124 if (!pending_requests) | 124 if (!pending_requests) |
| 125 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 125 MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
| 126 } else { | 126 } else { |
| 127 DCHECK(!pending_requests) | 127 DCHECK(!pending_requests) |
| 128 << "Pending request w/o delegate_ should not happen!"; | 128 << "Pending request w/o delegate_ should not happen!"; |
| 129 // Online login has succeeded. | 129 // Online login has succeeded. |
| 130 // TODO(nkostylev): Execute CookieFetcher->AttemptFetch() here once | 130 Profile* profile = |
| 131 // async login is implemented. | 131 g_browser_process->profile_manager()->GetDefaultProfile(); |
| 132 // http://crosbug.com/9814 | 132 LoginUtils::Get()->FetchCookies(profile, credentials); |
| 133 LoginUtils::Get()->FetchTokens(profile, credentials); |
| 134 |
| 133 if (ScreenLocker::default_screen_locker()) { | 135 if (ScreenLocker::default_screen_locker()) { |
| 134 DVLOG(1) << "Online login OK - unlocking screen."; | 136 DVLOG(1) << "Online login OK - unlocking screen."; |
| 135 RequestScreenUnlock(); | 137 RequestScreenUnlock(); |
| 136 // Do not delete itself just yet, wait for unlock. | 138 // Do not delete itself just yet, wait for unlock. |
| 137 // See ResolveScreenUnlocked(). | 139 // See ResolveScreenUnlocked(). |
| 138 return; | 140 return; |
| 139 } | 141 } |
| 140 // There's nothing else that's holding LP from deleting itself - | 142 // There's nothing else that's holding LP from deleting itself - |
| 141 // no ScreenLock, no pending requests. | 143 // no ScreenLock, no pending requests. |
| 142 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 144 MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
| (...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 profile, | 445 profile, |
| 444 username_, | 446 username_, |
| 445 password_, | 447 password_, |
| 446 captcha_token_, | 448 captcha_token_, |
| 447 captcha_)); | 449 captcha_)); |
| 448 } | 450 } |
| 449 password_.clear(); | 451 password_.clear(); |
| 450 } | 452 } |
| 451 | 453 |
| 452 } // namespace chromeos | 454 } // namespace chromeos |
| OLD | NEW |