| 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/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 | 9 |
| 10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
| 11 #include "base/stl_util-inl.h" | 11 #include "base/stl_util-inl.h" |
| 12 #include "base/utf_string_conversions.h" | 12 #include "base/utf_string_conversions.h" |
| 13 #include "chrome/browser/chromeos/cros/cros_library.h" | 13 #include "chrome/browser/chromeos/cros/cros_library.h" |
| 14 #include "chrome/browser/chromeos/cros/login_library.h" | 14 #include "chrome/browser/chromeos/cros/login_library.h" |
| 15 #include "chrome/browser/chromeos/login/authenticator.h" | 15 #include "chrome/browser/chromeos/login/authenticator.h" |
| 16 #include "chrome/browser/chromeos/login/background_view.h" | 16 #include "chrome/browser/chromeos/login/background_view.h" |
| 17 #include "chrome/browser/chromeos/login/utils.h" | 17 #include "chrome/browser/chromeos/login/login_utils.h" |
| 18 #include "chrome/browser/chromeos/login/wizard_controller.h" | 18 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 19 #include "chrome/browser/chromeos/wm_ipc.h" | 19 #include "chrome/browser/chromeos/wm_ipc.h" |
| 20 #include "views/screen.h" | 20 #include "views/screen.h" |
| 21 #include "views/widget/widget.h" | 21 #include "views/widget/widget.h" |
| 22 | 22 |
| 23 namespace chromeos { | 23 namespace chromeos { |
| 24 | 24 |
| 25 namespace { | 25 namespace { |
| 26 | 26 |
| 27 // Max number of users we'll show. The true max is the min of this and the | 27 // Max number of users we'll show. The true max is the min of this and the |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 &ExistingUserController::Delete); | 111 &ExistingUserController::Delete); |
| 112 } | 112 } |
| 113 | 113 |
| 114 void ExistingUserController::Login(UserController* source, | 114 void ExistingUserController::Login(UserController* source, |
| 115 const string16& password) { | 115 const string16& password) { |
| 116 std::vector<UserController*>::const_iterator i = | 116 std::vector<UserController*>::const_iterator i = |
| 117 std::find(controllers_.begin(), controllers_.end(), source); | 117 std::find(controllers_.begin(), controllers_.end(), source); |
| 118 DCHECK(i != controllers_.end()); | 118 DCHECK(i != controllers_.end()); |
| 119 index_of_view_logging_in_ = i - controllers_.begin(); | 119 index_of_view_logging_in_ = i - controllers_.begin(); |
| 120 | 120 |
| 121 authenticator_.reset(login_utils::CreateAuthenticator(this)); | 121 authenticator_.reset(LoginUtils::Get()->CreateAuthenticator(this)); |
| 122 authenticator_->Authenticate( | 122 authenticator_->Authenticate( |
| 123 controllers_[index_of_view_logging_in_]->user().email(), | 123 controllers_[index_of_view_logging_in_]->user().email(), |
| 124 UTF16ToUTF8(password)); | 124 UTF16ToUTF8(password)); |
| 125 | 125 |
| 126 // Disable clicking on other windows. | 126 // Disable clicking on other windows. |
| 127 chromeos::WmIpc::Message message( | 127 chromeos::WmIpc::Message message( |
| 128 chromeos::WmIpc::Message::WM_SET_LOGIN_STATE); | 128 chromeos::WmIpc::Message::WM_SET_LOGIN_STATE); |
| 129 message.set_param(0, 0); | 129 message.set_param(0, 0); |
| 130 chromeos::WmIpc::instance()->SendMessage(message); | 130 chromeos::WmIpc::instance()->SendMessage(message); |
| 131 } | 131 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 144 chromeos::WmIpc::instance()->SendMessage(message); | 144 chromeos::WmIpc::instance()->SendMessage(message); |
| 145 } | 145 } |
| 146 | 146 |
| 147 void ExistingUserController::OnLoginSuccess(const std::string username, | 147 void ExistingUserController::OnLoginSuccess(const std::string username, |
| 148 std::vector<std::string> cookies) { | 148 std::vector<std::string> cookies) { |
| 149 // Hide the login windows now. | 149 // Hide the login windows now. |
| 150 STLDeleteElements(&controllers_); | 150 STLDeleteElements(&controllers_); |
| 151 | 151 |
| 152 background_window_->Close(); | 152 background_window_->Close(); |
| 153 | 153 |
| 154 chromeos::login_utils::CompleteLogin(username, cookies); | 154 chromeos::LoginUtils::Get()->CompleteLogin(username, cookies); |
| 155 | 155 |
| 156 // Delay deletion as we're on the stack. | 156 // Delay deletion as we're on the stack. |
| 157 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 157 MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
| 158 } | 158 } |
| 159 | 159 |
| 160 } // namespace chromeos | 160 } // namespace chromeos |
| OLD | NEW |