| 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/chromeos/login/inline_login_handler_chromeos.h
" | 5 #include "chrome/browser/ui/webui/chromeos/login/inline_login_handler_chromeos.h
" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "chrome/browser/chromeos/login/signin/oauth2_token_fetcher.h" | 10 #include "chrome/browser/chromeos/login/signin/oauth2_token_fetcher.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 InlineLoginHandlerChromeOS::~InlineLoginHandlerChromeOS() {} | 69 InlineLoginHandlerChromeOS::~InlineLoginHandlerChromeOS() {} |
| 70 | 70 |
| 71 void InlineLoginHandlerChromeOS::CompleteLogin(const base::ListValue* args) { | 71 void InlineLoginHandlerChromeOS::CompleteLogin(const base::ListValue* args) { |
| 72 Profile* profile = Profile::FromWebUI(web_ui()); | 72 Profile* profile = Profile::FromWebUI(web_ui()); |
| 73 | 73 |
| 74 const base::DictionaryValue* dict = NULL; | 74 const base::DictionaryValue* dict = NULL; |
| 75 args->GetDictionary(0, &dict); | 75 args->GetDictionary(0, &dict); |
| 76 | 76 |
| 77 std::string session_index; | 77 std::string session_index; |
| 78 dict->GetString("sessionIndex", &session_index); | 78 dict->GetString("sessionIndex", &session_index); |
| 79 CHECK(!session_index.empty()) << "Session index is empty."; | 79 // Session index is empty. |
| 80 CHECK(!session_index.empty()); |
| 80 | 81 |
| 81 std::string email; | 82 std::string email; |
| 82 dict->GetString("email", &email); | 83 dict->GetString("email", &email); |
| 83 CHECK(!email.empty()) << "Email is empty."; | 84 // Email is empty. |
| 85 CHECK(!email.empty()); |
| 84 | 86 |
| 85 std::string gaia_id; | 87 std::string gaia_id; |
| 86 dict->GetString("gaiaId", &gaia_id); | 88 dict->GetString("gaiaId", &gaia_id); |
| 87 CHECK(!gaia_id.empty()) << "Gaia ID is empty."; | 89 // Gaia ID is empty. |
| 90 CHECK(!gaia_id.empty()); |
| 88 | 91 |
| 89 AccountTrackerService* account_tracker = | 92 AccountTrackerService* account_tracker = |
| 90 AccountTrackerServiceFactory::GetForProfile(profile); | 93 AccountTrackerServiceFactory::GetForProfile(profile); |
| 91 account_tracker->SeedAccountInfo(gaia_id, email); | 94 account_tracker->SeedAccountInfo(gaia_id, email); |
| 92 | 95 |
| 93 const std::string account_id = | 96 const std::string account_id = |
| 94 account_tracker->PickAccountIdForAccount(gaia_id, email); | 97 account_tracker->PickAccountIdForAccount(gaia_id, email); |
| 95 oauth2_delegate_.reset(new InlineLoginUIOAuth2Delegate(web_ui(), account_id)); | 98 oauth2_delegate_.reset(new InlineLoginUIOAuth2Delegate(web_ui(), account_id)); |
| 96 net::URLRequestContextGetter* request_context = | 99 net::URLRequestContextGetter* request_context = |
| 97 content::BrowserContext::GetStoragePartitionForSite( | 100 content::BrowserContext::GetStoragePartitionForSite( |
| 98 profile, GURL(chrome::kChromeUIChromeSigninURL)) | 101 profile, GURL(chrome::kChromeUIChromeSigninURL)) |
| 99 ->GetURLRequestContext(); | 102 ->GetURLRequestContext(); |
| 100 oauth2_token_fetcher_.reset( | 103 oauth2_token_fetcher_.reset( |
| 101 new OAuth2TokenFetcher(oauth2_delegate_.get(), request_context)); | 104 new OAuth2TokenFetcher(oauth2_delegate_.get(), request_context)); |
| 102 SigninClient* signin_client = | 105 SigninClient* signin_client = |
| 103 ChromeSigninClientFactory::GetForProfile(profile); | 106 ChromeSigninClientFactory::GetForProfile(profile); |
| 104 std::string signin_scoped_device_id = | 107 std::string signin_scoped_device_id = |
| 105 signin_client->GetSigninScopedDeviceId(); | 108 signin_client->GetSigninScopedDeviceId(); |
| 106 oauth2_token_fetcher_->StartExchangeFromCookies(session_index, | 109 oauth2_token_fetcher_->StartExchangeFromCookies(session_index, |
| 107 signin_scoped_device_id); | 110 signin_scoped_device_id); |
| 108 } | 111 } |
| 109 | 112 |
| 110 } // namespace chromeos | 113 } // namespace chromeos |
| OLD | NEW |