| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/chrome_browser_main_chromeos.h" | 5 #include "chrome/browser/chromeos/chrome_browser_main_chromeos.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 // The instance will be deleted upon success or failure. | 139 // The instance will be deleted upon success or failure. |
| 140 class StubLogin : public LoginStatusConsumer, | 140 class StubLogin : public LoginStatusConsumer, |
| 141 public LoginUtils::Delegate { | 141 public LoginUtils::Delegate { |
| 142 public: | 142 public: |
| 143 StubLogin(std::string username, std::string password) | 143 StubLogin(std::string username, std::string password) |
| 144 : pending_requests_(false), | 144 : pending_requests_(false), |
| 145 profile_prepared_(false) { | 145 profile_prepared_(false) { |
| 146 authenticator_ = LoginUtils::Get()->CreateAuthenticator(this); | 146 authenticator_ = LoginUtils::Get()->CreateAuthenticator(this); |
| 147 authenticator_.get()->AuthenticateToLogin( | 147 authenticator_.get()->AuthenticateToLogin( |
| 148 g_browser_process->profile_manager()->GetDefaultProfile(), | 148 g_browser_process->profile_manager()->GetDefaultProfile(), |
| 149 username, | 149 UserCredentials(username, |
| 150 password, | 150 password, |
| 151 std::string(), | 151 std::string()), // auth_code |
| 152 std::string()); | 152 std::string(), // login_token |
| 153 std::string()); // login_captcha |
| 153 } | 154 } |
| 154 | 155 |
| 155 virtual ~StubLogin() { | 156 virtual ~StubLogin() { |
| 156 LoginUtils::Get()->DelegateDeleted(this); | 157 LoginUtils::Get()->DelegateDeleted(this); |
| 157 } | 158 } |
| 158 | 159 |
| 159 virtual void OnLoginFailure(const LoginFailure& error) OVERRIDE { | 160 virtual void OnLoginFailure(const LoginFailure& error) OVERRIDE { |
| 160 LOG(ERROR) << "Login Failure: " << error.GetErrorString(); | 161 LOG(ERROR) << "Login Failure: " << error.GetErrorString(); |
| 161 delete this; | 162 delete this; |
| 162 } | 163 } |
| 163 | 164 |
| 164 virtual void OnLoginSuccess(const std::string& username, | 165 virtual void OnLoginSuccess(const UserCredentials& credentials, |
| 165 const std::string& password, | |
| 166 bool pending_requests, | 166 bool pending_requests, |
| 167 bool using_oauth) OVERRIDE { | 167 bool using_oauth) OVERRIDE { |
| 168 pending_requests_ = pending_requests; | 168 pending_requests_ = pending_requests; |
| 169 if (!profile_prepared_) { | 169 if (!profile_prepared_) { |
| 170 // Will call OnProfilePrepared in the end. | 170 // Will call OnProfilePrepared in the end. |
| 171 LoginUtils::Get()->PrepareProfile(username, | 171 LoginUtils::Get()->PrepareProfile(credentials, |
| 172 std::string(), | 172 std::string(), // display_email |
| 173 password, | |
| 174 using_oauth, | 173 using_oauth, |
| 175 false, | 174 false, // has_cookies |
| 176 this); | 175 this); |
| 177 } else if (!pending_requests) { | 176 } else if (!pending_requests) { |
| 178 delete this; | 177 delete this; |
| 179 } | 178 } |
| 180 } | 179 } |
| 181 | 180 |
| 182 // LoginUtils::Delegate implementation: | 181 // LoginUtils::Delegate implementation: |
| 183 virtual void OnProfilePrepared(Profile* profile) OVERRIDE { | 182 virtual void OnProfilePrepared(Profile* profile) OVERRIDE { |
| 184 profile_prepared_ = true; | 183 profile_prepared_ = true; |
| 185 LoginUtils::Get()->DoBrowserLaunch(profile, NULL); | 184 LoginUtils::Get()->DoBrowserLaunch(profile, NULL); |
| (...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 861 return; | 860 return; |
| 862 | 861 |
| 863 // If failed to launch, go back to login screen. | 862 // If failed to launch, go back to login screen. |
| 864 LOG(ERROR) << "Failed to launch kiosk app. Fall back to login screen"; | 863 LOG(ERROR) << "Failed to launch kiosk app. Fall back to login screen"; |
| 865 OptionallyRunChromeOSLoginManager(parsed_command_line(), profile()); | 864 OptionallyRunChromeOSLoginManager(parsed_command_line(), profile()); |
| 866 | 865 |
| 867 // TODO(xiyuan): Show error message. | 866 // TODO(xiyuan): Show error message. |
| 868 } | 867 } |
| 869 | 868 |
| 870 } // namespace chromeos | 869 } // namespace chromeos |
| OLD | NEW |