Chromium Code Reviews| OLD | NEW |
|---|---|
| 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/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 "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
|
Joao da Silva
2013/01/11 16:45:07
Not needed
zel
2013/01/11 19:51:16
Done.
| |
| 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 "base/threading/thread_restrictions.h" | 14 #include "base/threading/thread_restrictions.h" |
| 15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
| 16 #include "chrome/browser/browser_process.h" | 16 #include "chrome/browser/browser_process.h" |
| 17 #include "chrome/browser/chromeos/boot_times_loader.h" | 17 #include "chrome/browser/chromeos/boot_times_loader.h" |
| 18 #include "chrome/browser/chromeos/login/login_utils.h" | 18 #include "chrome/browser/chromeos/login/login_utils.h" |
| 19 #include "chrome/browser/chromeos/login/screen_locker.h" | 19 #include "chrome/browser/chromeos/login/screen_locker.h" |
| 20 #include "chrome/browser/chromeos/settings/cros_settings.h" | 20 #include "chrome/browser/chromeos/settings/cros_settings.h" |
| 21 #include "chrome/browser/chromeos/settings/cros_settings_names.h" | 21 #include "chrome/browser/chromeos/settings/cros_settings_names.h" |
| 22 #include "chrome/browser/policy/browser_policy_connector.h" | 22 #include "chrome/browser/policy/browser_policy_connector.h" |
| 23 #include "chrome/browser/policy/device_local_account_policy_service.h" | 23 #include "chrome/browser/policy/device_local_account_policy_service.h" |
| 24 #include "chrome/browser/prefs/pref_service.h" | 24 #include "chrome/browser/prefs/pref_service.h" |
| 25 #include "chrome/browser/profiles/profile.h" | 25 #include "chrome/browser/profiles/profile.h" |
| 26 #include "chrome/browser/profiles/profile_manager.h" | 26 #include "chrome/browser/profiles/profile_manager.h" |
| 27 #include "chrome/common/chrome_notification_types.h" | 27 #include "chrome/common/chrome_notification_types.h" |
| 28 #include "chrome/common/chrome_switches.h" | 28 #include "chrome/common/chrome_switches.h" |
|
Joao da Silva
2013/01/11 16:45:07
Not needed
zel
2013/01/11 19:51:16
Done.
| |
| 29 #include "chrome/common/pref_names.h" | 29 #include "chrome/common/pref_names.h" |
| 30 #include "chromeos/dbus/dbus_thread_manager.h" | 30 #include "chromeos/dbus/dbus_thread_manager.h" |
| 31 #include "chromeos/dbus/session_manager_client.h" | 31 #include "chromeos/dbus/session_manager_client.h" |
| 32 #include "content/public/browser/browser_thread.h" | 32 #include "content/public/browser/browser_thread.h" |
| 33 #include "content/public/browser/notification_service.h" | 33 #include "content/public/browser/notification_service.h" |
| 34 #include "content/public/browser/notification_types.h" | 34 #include "content/public/browser/notification_types.h" |
| 35 #include "content/public/browser/user_metrics.h" | 35 #include "content/public/browser/user_metrics.h" |
| 36 #include "google_apis/gaia/gaia_auth_util.h" | 36 #include "google_apis/gaia/gaia_auth_util.h" |
| 37 #include "grit/generated_resources.h" | 37 #include "grit/generated_resources.h" |
| 38 #include "net/cookies/cookie_monster.h" | 38 #include "net/cookies/cookie_monster.h" |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 53 | 53 |
| 54 LoginPerformer::LoginPerformer(Delegate* delegate) | 54 LoginPerformer::LoginPerformer(Delegate* delegate) |
| 55 : ALLOW_THIS_IN_INITIALIZER_LIST(online_attempt_host_(this)), | 55 : ALLOW_THIS_IN_INITIALIZER_LIST(online_attempt_host_(this)), |
| 56 last_login_failure_(LoginFailure::None()), | 56 last_login_failure_(LoginFailure::None()), |
| 57 delegate_(delegate), | 57 delegate_(delegate), |
| 58 password_changed_(false), | 58 password_changed_(false), |
| 59 password_changed_callback_count_(0), | 59 password_changed_callback_count_(0), |
| 60 screen_lock_requested_(false), | 60 screen_lock_requested_(false), |
| 61 initial_online_auth_pending_(false), | 61 initial_online_auth_pending_(false), |
| 62 auth_mode_(AUTH_MODE_INTERNAL), | 62 auth_mode_(AUTH_MODE_INTERNAL), |
| 63 using_oauth_( | |
| 64 !CommandLine::ForCurrentProcess()->HasSwitch( | |
| 65 switches::kSkipOAuthLogin)), | |
| 66 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { | 63 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) { |
| 67 DCHECK(default_performer_ == NULL) | 64 DCHECK(default_performer_ == NULL) |
| 68 << "LoginPerformer should have only one instance."; | 65 << "LoginPerformer should have only one instance."; |
| 69 default_performer_ = this; | 66 default_performer_ = this; |
| 70 } | 67 } |
| 71 | 68 |
| 72 LoginPerformer::~LoginPerformer() { | 69 LoginPerformer::~LoginPerformer() { |
| 73 DVLOG(1) << "Deleting LoginPerformer"; | 70 DVLOG(1) << "Deleting LoginPerformer"; |
| 74 DCHECK(default_performer_ != NULL) << "Default instance should exist."; | 71 DCHECK(default_performer_ != NULL) << "Default instance should exist."; |
| 75 default_performer_ = NULL; | 72 default_performer_ = NULL; |
| (...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 183 case Profile::CREATE_STATUS_INITIALIZED: | 180 case Profile::CREATE_STATUS_INITIALIZED: |
| 184 break; | 181 break; |
| 185 case Profile::CREATE_STATUS_CREATED: | 182 case Profile::CREATE_STATUS_CREATED: |
| 186 return; | 183 return; |
| 187 case Profile::CREATE_STATUS_FAIL: | 184 case Profile::CREATE_STATUS_FAIL: |
| 188 default: | 185 default: |
| 189 NOTREACHED(); | 186 NOTREACHED(); |
| 190 return; | 187 return; |
| 191 } | 188 } |
| 192 | 189 |
| 193 if (using_oauth_) | 190 // TODO(zelidrag): Figure out when this needs to run. |
| 194 LoginUtils::Get()->StartTokenServices(profile); | 191 LoginUtils::Get()->StartTokenServices(profile); |
|
Joao da Silva
2013/01/11 16:45:07
AFAICT this method is dead code.
It's only used a
zel
2013/01/11 19:51:16
I suspect this might have something to do with scr
Nikita (slow)
2013/01/11 22:02:03
Yes, this method could be removed.
zel
2013/01/12 02:07:36
Removed LoginPerformer::OnProfileCreated(), branch
| |
| 195 | 192 |
| 196 // Don't unlock screen if it was locked while we're waiting | 193 // Don't unlock screen if it was locked while we're waiting |
| 197 // for initial online auth. | 194 // for initial online auth. |
| 198 if (ScreenLocker::default_screen_locker() && | 195 if (ScreenLocker::default_screen_locker() && |
| 199 !initial_online_auth_pending_) { | 196 !initial_online_auth_pending_) { |
| 200 DVLOG(1) << "Online login OK - unlocking screen."; | 197 DVLOG(1) << "Online login OK - unlocking screen."; |
| 201 RequestScreenUnlock(); | 198 RequestScreenUnlock(); |
| 202 // Do not delete itself just yet, wait for unlock. | 199 // Do not delete itself just yet, wait for unlock. |
| 203 // See ResolveScreenUnlocked(). | 200 // See ResolveScreenUnlocked(). |
| 204 return; | 201 return; |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 559 profile, | 556 profile, |
| 560 username_, | 557 username_, |
| 561 password_, | 558 password_, |
| 562 std::string(), | 559 std::string(), |
| 563 std::string())); | 560 std::string())); |
| 564 } | 561 } |
| 565 password_.clear(); | 562 password_.clear(); |
| 566 } | 563 } |
| 567 | 564 |
| 568 } // namespace chromeos | 565 } // namespace chromeos |
| OLD | NEW |