| OLD | NEW | 
|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/authenticated_user_email_retrie
    ver.h" | 5 #include "chrome/browser/ui/webui/chromeos/login/authenticated_user_email_retrie
    ver.h" | 
| 6 | 6 | 
| 7 #include <utility> | 7 #include <utility> | 
| 8 #include <vector> | 8 #include <vector> | 
| 9 | 9 | 
| 10 #include "google_apis/gaia/gaia_auth_util.h" | 10 #include "google_apis/gaia/gaia_auth_util.h" | 
| (...skipping 11 matching lines...) Expand all  Loading... | 
| 22                          GaiaConstants::kChromeSource, | 22                          GaiaConstants::kChromeSource, | 
| 23                          url_request_context_getter.get()) { | 23                          url_request_context_getter.get()) { | 
| 24   gaia_auth_fetcher_.StartListAccounts(); | 24   gaia_auth_fetcher_.StartListAccounts(); | 
| 25 } | 25 } | 
| 26 | 26 | 
| 27 AuthenticatedUserEmailRetriever::~AuthenticatedUserEmailRetriever() { | 27 AuthenticatedUserEmailRetriever::~AuthenticatedUserEmailRetriever() { | 
| 28 } | 28 } | 
| 29 | 29 | 
| 30 void AuthenticatedUserEmailRetriever::OnListAccountsSuccess( | 30 void AuthenticatedUserEmailRetriever::OnListAccountsSuccess( | 
| 31     const std::string& data) { | 31     const std::string& data) { | 
| 32   std::vector<std::pair<std::string, bool> > accounts; | 32   std::vector<gaia::ListedAccount> accounts; | 
| 33   gaia::ParseListAccountsData(data, &accounts); | 33   gaia::ParseListAccountsData(data, &accounts); | 
| 34   if (accounts.size() != 1) | 34   if (accounts.size() != 1) | 
| 35     callback_.Run(std::string()); | 35     callback_.Run(std::string()); | 
| 36   else | 36   else | 
| 37     callback_.Run(accounts.front().first); | 37     callback_.Run(accounts.front().email); | 
| 38 } | 38 } | 
| 39 | 39 | 
| 40 void AuthenticatedUserEmailRetriever::OnListAccountsFailure( | 40 void AuthenticatedUserEmailRetriever::OnListAccountsFailure( | 
| 41     const GoogleServiceAuthError& error) { | 41     const GoogleServiceAuthError& error) { | 
| 42   callback_.Run(std::string()); | 42   callback_.Run(std::string()); | 
| 43 } | 43 } | 
| 44 | 44 | 
| 45 }  // namespace chromeos | 45 }  // namespace chromeos | 
| OLD | NEW | 
|---|