| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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/ui/webui/signin/inline_login_handler_impl.h" | 5 #include "chrome/browser/ui/webui/signin/inline_login_handler_impl.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 email, password_, refresh_token, | 142 email, password_, refresh_token, |
| 143 OneClickSigninHelper::AUTO_ACCEPT_EXPLICIT, | 143 OneClickSigninHelper::AUTO_ACCEPT_EXPLICIT, |
| 144 source, start_mode, | 144 source, start_mode, |
| 145 base::Bind(&InlineLoginHandlerImpl::SyncStarterCallback, | 145 base::Bind(&InlineLoginHandlerImpl::SyncStarterCallback, |
| 146 handler_)); | 146 handler_)); |
| 147 } | 147 } |
| 148 | 148 |
| 149 if (start_signin) { | 149 if (start_signin) { |
| 150 // Call OneClickSigninSyncStarter to exchange oauth code for tokens. | 150 // Call OneClickSigninSyncStarter to exchange oauth code for tokens. |
| 151 // OneClickSigninSyncStarter will delete itself once the job is done. | 151 // OneClickSigninSyncStarter will delete itself once the job is done. |
| 152 std::string continue_url_str; |
| 153 net::GetValueForKeyInQuery(current_url_, "continueUrl", |
| 154 &continue_url_str); |
| 155 GURL continue_url = GURL(continue_url_str); |
| 156 if (!continue_url.is_valid()) |
| 157 continue_url = GURL(); |
| 158 |
| 152 new OneClickSigninSyncStarter( | 159 new OneClickSigninSyncStarter( |
| 153 profile_, browser, | 160 profile_, browser, |
| 154 email, password_, refresh_token, | 161 email, password_, refresh_token, |
| 155 start_mode, | 162 start_mode, |
| 156 contents, | 163 contents, |
| 157 confirmation_required, | 164 confirmation_required, |
| 165 continue_url, |
| 158 base::Bind(&InlineLoginHandlerImpl::SyncStarterCallback, handler_)); | 166 base::Bind(&InlineLoginHandlerImpl::SyncStarterCallback, handler_)); |
| 159 } | 167 } |
| 160 } | 168 } |
| 161 | 169 |
| 162 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 170 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
| 163 } | 171 } |
| 164 | 172 |
| 165 void InlineSigninHelper::OnSigninOAuthInformationFailure( | 173 void InlineSigninHelper::OnSigninOAuthInformationFailure( |
| 166 const GoogleServiceAuthError& error) { | 174 const GoogleServiceAuthError& error) { |
| 167 if (handler_) | 175 if (handler_) |
| (...skipping 24 matching lines...) Expand all Loading... |
| 192 params.SetInteger("authMode", InlineLoginHandler::kDesktopAuthMode); | 200 params.SetInteger("authMode", InlineLoginHandler::kDesktopAuthMode); |
| 193 | 201 |
| 194 const GURL& current_url = web_ui()->GetWebContents()->GetURL(); | 202 const GURL& current_url = web_ui()->GetWebContents()->GetURL(); |
| 195 signin::Source source = signin::GetSourceForPromoURL(current_url); | 203 signin::Source source = signin::GetSourceForPromoURL(current_url); |
| 196 DCHECK(source != signin::SOURCE_UNKNOWN); | 204 DCHECK(source != signin::SOURCE_UNKNOWN); |
| 197 if (source == signin::SOURCE_AVATAR_BUBBLE_ADD_ACCOUNT || | 205 if (source == signin::SOURCE_AVATAR_BUBBLE_ADD_ACCOUNT || |
| 198 source == signin::SOURCE_AVATAR_BUBBLE_SIGN_IN) { | 206 source == signin::SOURCE_AVATAR_BUBBLE_SIGN_IN) { |
| 199 // Drop the leading slash in the path. | 207 // Drop the leading slash in the path. |
| 200 params.SetString("gaiaPath", | 208 params.SetString("gaiaPath", |
| 201 GaiaUrls::GetInstance()->embedded_signin_url().path().substr(1)); | 209 GaiaUrls::GetInstance()->embedded_signin_url().path().substr(1)); |
| 202 } | 210 } |
| 203 | 211 |
| 204 params.SetString("service", "chromiumsync"); | 212 params.SetString("service", "chromiumsync"); |
| 205 params.SetString("continueUrl", | 213 params.SetString("continueUrl", |
| 206 signin::GetLandingURL("source", static_cast<int>(source)).spec()); | 214 signin::GetLandingURL("source", static_cast<int>(source)).spec()); |
| 207 | 215 |
| 208 std::string default_email; | 216 std::string default_email; |
| 209 if (source != signin::SOURCE_AVATAR_BUBBLE_ADD_ACCOUNT) { | 217 if (source != signin::SOURCE_AVATAR_BUBBLE_ADD_ACCOUNT) { |
| 210 default_email = Profile::FromWebUI(web_ui())->GetPrefs()-> | 218 default_email = Profile::FromWebUI(web_ui())->GetPrefs()-> |
| 211 GetString(prefs::kGoogleServicesLastUsername); | 219 GetString(prefs::kGoogleServicesLastUsername); |
| 212 } else { | 220 } else { |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 410 TabStripModel* tab_strip_model = browser->tab_strip_model(); | 418 TabStripModel* tab_strip_model = browser->tab_strip_model(); |
| 411 if (tab_strip_model) { | 419 if (tab_strip_model) { |
| 412 int index = tab_strip_model->GetIndexOfWebContents(tab); | 420 int index = tab_strip_model->GetIndexOfWebContents(tab); |
| 413 if (index != TabStripModel::kNoTab) { | 421 if (index != TabStripModel::kNoTab) { |
| 414 tab_strip_model->ExecuteContextMenuCommand( | 422 tab_strip_model->ExecuteContextMenuCommand( |
| 415 index, TabStripModel::CommandCloseTab); | 423 index, TabStripModel::CommandCloseTab); |
| 416 } | 424 } |
| 417 } | 425 } |
| 418 } | 426 } |
| 419 } | 427 } |
| OLD | NEW |