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

Side by Side Diff: chrome/browser/chromeos/login/existing_user_controller.cc

Issue 4980005: Allow sync with 2-factor StrongAuth accounts in ChromeOS. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Refactored 2-factor error passing Created 10 years, 1 month 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 | Annotate | Revision Log
OLDNEW
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/existing_user_controller.h" 5 #include "chrome/browser/chromeos/login/existing_user_controller.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 #include <map> 9 #include <map>
10 10
(...skipping 12 matching lines...) Expand all
23 #include "chrome/browser/chromeos/login/background_view.h" 23 #include "chrome/browser/chromeos/login/background_view.h"
24 #include "chrome/browser/chromeos/login/help_app_launcher.h" 24 #include "chrome/browser/chromeos/login/help_app_launcher.h"
25 #include "chrome/browser/chromeos/login/helper.h" 25 #include "chrome/browser/chromeos/login/helper.h"
26 #include "chrome/browser/chromeos/login/login_utils.h" 26 #include "chrome/browser/chromeos/login/login_utils.h"
27 #include "chrome/browser/chromeos/login/message_bubble.h" 27 #include "chrome/browser/chromeos/login/message_bubble.h"
28 #include "chrome/browser/chromeos/login/wizard_controller.h" 28 #include "chrome/browser/chromeos/login/wizard_controller.h"
29 #include "chrome/browser/chromeos/status/status_area_view.h" 29 #include "chrome/browser/chromeos/status/status_area_view.h"
30 #include "chrome/browser/chromeos/user_cros_settings_provider.h" 30 #include "chrome/browser/chromeos/user_cros_settings_provider.h"
31 #include "chrome/browser/chromeos/view_ids.h" 31 #include "chrome/browser/chromeos/view_ids.h"
32 #include "chrome/browser/chromeos/wm_ipc.h" 32 #include "chrome/browser/chromeos/wm_ipc.h"
33 #include "chrome/browser/profile_manager.h"
33 #include "chrome/browser/views/window.h" 34 #include "chrome/browser/views/window.h"
34 #include "chrome/common/chrome_switches.h" 35 #include "chrome/common/chrome_switches.h"
35 #include "chrome/common/net/gaia/google_service_auth_error.h" 36 #include "chrome/common/net/gaia/google_service_auth_error.h"
36 #include "gfx/native_widget_types.h" 37 #include "gfx/native_widget_types.h"
37 #include "grit/chromium_strings.h" 38 #include "grit/chromium_strings.h"
38 #include "grit/generated_resources.h" 39 #include "grit/generated_resources.h"
39 #include "grit/theme_resources.h" 40 #include "grit/theme_resources.h"
40 #include "views/screen.h" 41 #include "views/screen.h"
41 #include "views/widget/widget_gtk.h" 42 #include "views/widget/widget_gtk.h"
42 #include "views/window/window.h" 43 #include "views/window/window.h"
43 44
44 namespace chromeos { 45 namespace chromeos {
45 46
46 namespace { 47 namespace {
47 48
48 // Max number of users we'll show. The true max is the min of this and the 49 // Max number of users we'll show. The true max is the min of this and the
49 // number of windows that fit on the screen. 50 // number of windows that fit on the screen.
50 const size_t kMaxUsers = 5; 51 const size_t kMaxUsers = 5;
51 52
52 // Used to indicate no user has been selected. 53 // Used to indicate no user has been selected.
53 const size_t kNotSelected = -1; 54 const size_t kNotSelected = -1;
54 55
55 // Offset of cursor in first position from edit left side. It's used to position 56 // Offset of cursor in first position from edit left side. It's used to position
56 // info bubble arrow to cursor. 57 // info bubble arrow to cursor.
57 const int kCursorOffset = 5; 58 const int kCursorOffset = 5;
58 59
60 // Url for setting up sync authentication.
61 const char kSettingsSyncLoginUrl[] = "chrome://settings/personal";
62
59 // Used to handle the asynchronous response of deleting a cryptohome directory. 63 // Used to handle the asynchronous response of deleting a cryptohome directory.
60 class RemoveAttempt : public CryptohomeLibrary::Delegate { 64 class RemoveAttempt : public CryptohomeLibrary::Delegate {
61 public: 65 public:
62 explicit RemoveAttempt(const std::string& user_email) 66 explicit RemoveAttempt(const std::string& user_email)
63 : user_email_(user_email) { 67 : user_email_(user_email) {
64 if (CrosLibrary::Get()->EnsureLoaded()) { 68 if (CrosLibrary::Get()->EnsureLoaded()) {
65 CrosLibrary::Get()->GetCryptohomeLibrary()->AsyncRemove( 69 CrosLibrary::Get()->GetCryptohomeLibrary()->AsyncRemove(
66 user_email_, this); 70 user_email_, this);
67 } 71 }
68 } 72 }
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 const GaiaAuthConsumer::ClientLoginResult& credentials, 483 const GaiaAuthConsumer::ClientLoginResult& credentials,
480 bool pending_requests) { 484 bool pending_requests) {
481 // LoginPerformer instance will delete itself once online auth result is OK. 485 // LoginPerformer instance will delete itself once online auth result is OK.
482 // In case of failure it'll bring up ScreenLock and ask for 486 // In case of failure it'll bring up ScreenLock and ask for
483 // correct password/display error message. 487 // correct password/display error message.
484 // Even in case when following online,offline protocol and returning 488 // Even in case when following online,offline protocol and returning
485 // requests_pending = false, let LoginPerformer delete itself. 489 // requests_pending = false, let LoginPerformer delete itself.
486 login_performer_->set_delegate(NULL); 490 login_performer_->set_delegate(NULL);
487 LoginPerformer* performer = login_performer_.release(); 491 LoginPerformer* performer = login_performer_.release();
488 performer = NULL; 492 performer = NULL;
493 bool known_user = UserManager::Get()->IsKnownUser(username);
494 if (credentials.two_factor && !known_user && !start_url_.is_valid()) {
495 // If we have a two factor error and and this is a new user and we are not
496 // already directing the user to a start url (e.g. a help page),
497 // direct them to the personal settings page.
498 // TODO(stevenjb): direct the user to a lightweight sync login page.
499 start_url_ = GURL(kSettingsSyncLoginUrl);
500 }
489 AppendStartUrlToCmdline(); 501 AppendStartUrlToCmdline();
490 if (selected_view_index_ + 1 == controllers_.size() && 502 if (selected_view_index_ + 1 == controllers_.size() && !known_user) {
491 !UserManager::Get()->IsKnownUser(username)) {
492 // For new user login don't launch browser until we pass image screen. 503 // For new user login don't launch browser until we pass image screen.
493 LoginUtils::Get()->EnableBrowserLaunch(false); 504 LoginUtils::Get()->EnableBrowserLaunch(false);
494 LoginUtils::Get()->CompleteLogin(username, password, credentials); 505 LoginUtils::Get()->CompleteLogin(username, password, credentials);
495 ActivateWizard(WizardController::IsDeviceRegistered() ? 506 ActivateWizard(WizardController::IsDeviceRegistered() ?
496 WizardController::kUserImageScreenName : 507 WizardController::kUserImageScreenName :
497 WizardController::kRegistrationScreenName); 508 WizardController::kRegistrationScreenName);
498 } else { 509 } else {
499 // Hide the login windows now. 510 // Hide the login windows now.
500 WmIpc::Message message(WM_IPC_MESSAGE_WM_HIDE_LOGIN); 511 WmIpc::Message message(WM_IPC_MESSAGE_WM_HIDE_LOGIN);
501 WmIpc::instance()->SendMessage(message); 512 WmIpc::instance()->SendMessage(message);
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
570 void ExistingUserController::RecoverEncryptedData( 581 void ExistingUserController::RecoverEncryptedData(
571 const std::string& old_password) { 582 const std::string& old_password) {
572 login_performer_->RecoverEncryptedData(old_password); 583 login_performer_->RecoverEncryptedData(old_password);
573 } 584 }
574 585
575 void ExistingUserController::ResyncEncryptedData() { 586 void ExistingUserController::ResyncEncryptedData() {
576 login_performer_->ResyncEncryptedData(); 587 login_performer_->ResyncEncryptedData();
577 } 588 }
578 589
579 } // namespace chromeos 590 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698