| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/remoting/setup_flow_login_step.h" | 5 #include "chrome/browser/remoting/setup_flow_login_step.h" |
| 6 | 6 |
| 7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
| 8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 GaiaAuthFetcher::HostedAccountsAllowed); | 88 GaiaAuthFetcher::HostedAccountsAllowed); |
| 89 } | 89 } |
| 90 | 90 |
| 91 void SetupFlowLoginStep::OnClientLoginSuccess( | 91 void SetupFlowLoginStep::OnClientLoginSuccess( |
| 92 const GaiaAuthConsumer::ClientLoginResult& credentials) { | 92 const GaiaAuthConsumer::ClientLoginResult& credentials) { |
| 93 // Save the token for remoting. | 93 // Save the token for remoting. |
| 94 flow()->context()->remoting_token = credentials.token; | 94 flow()->context()->remoting_token = credentials.token; |
| 95 | 95 |
| 96 // After login has succeeded try to fetch the token for sync. | 96 // After login has succeeded try to fetch the token for sync. |
| 97 // We need the token for sync to connect to the talk network. | 97 // We need the token for sync to connect to the talk network. |
| 98 authenticator_->StartIssueAuthToken(credentials.sid, credentials.lsid, | 98 authenticator_->StartIssueAuthToken(credentials, GaiaConstants::kSyncService); |
| 99 GaiaConstants::kSyncService); | |
| 100 } | 99 } |
| 101 | 100 |
| 102 void SetupFlowLoginStep::OnClientLoginFailure( | 101 void SetupFlowLoginStep::OnClientLoginFailure( |
| 103 const GoogleServiceAuthError& error) { | 102 const GoogleServiceAuthError& error) { |
| 104 ShowGaiaFailed(error); | 103 ShowGaiaFailed(error); |
| 105 authenticator_.reset(); | 104 authenticator_.reset(); |
| 106 } | 105 } |
| 107 | 106 |
| 108 void SetupFlowLoginStep::OnIssueAuthTokenSuccess( | 107 void SetupFlowLoginStep::OnIssueAuthTokenSuccess( |
| 109 const std::string& service, const std::string& auth_token) { | 108 const std::string& service, const std::string& auth_token) { |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 | 144 |
| 146 void SetupFlowLoginStep::ShowGaiaFailed(const GoogleServiceAuthError& error) { | 145 void SetupFlowLoginStep::ShowGaiaFailed(const GoogleServiceAuthError& error) { |
| 147 DictionaryValue args; | 146 DictionaryValue args; |
| 148 args.SetInteger("error", error.state()); | 147 args.SetInteger("error", error.state()); |
| 149 args.SetBoolean("editable_user", true); | 148 args.SetBoolean("editable_user", true); |
| 150 args.SetString("captchaUrl", error.captcha().image_url.spec()); | 149 args.SetString("captchaUrl", error.captcha().image_url.spec()); |
| 151 ShowGaiaLogin(args); | 150 ShowGaiaLogin(args); |
| 152 } | 151 } |
| 153 | 152 |
| 154 } // namespace remoting | 153 } // namespace remoting |
| OLD | NEW |