Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1342)

Side by Side Diff: chrome/browser/ui/webui/chromeos/login/authenticated_user_email_retriever.cc

Issue 166433005: Add URL parameter so that /ListAccounts returns valid json. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix ListAccount strings in tests Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/signin/account_reconcilor_unittest.cc ('k') | google_apis/gaia/gaia_auth_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <vector> 8 #include <vector>
8 9
9 #include "google_apis/gaia/gaia_auth_util.h" 10 #include "google_apis/gaia/gaia_auth_util.h"
10 #include "google_apis/gaia/gaia_constants.h" 11 #include "google_apis/gaia/gaia_constants.h"
11 #include "google_apis/gaia/google_service_auth_error.h" 12 #include "google_apis/gaia/google_service_auth_error.h"
12 #include "net/url_request/url_request_context_getter.h" 13 #include "net/url_request/url_request_context_getter.h"
13 14
14 namespace chromeos { 15 namespace chromeos {
15 16
16 AuthenticatedUserEmailRetriever::AuthenticatedUserEmailRetriever( 17 AuthenticatedUserEmailRetriever::AuthenticatedUserEmailRetriever(
17 const AuthenticatedUserEmailCallback& callback, 18 const AuthenticatedUserEmailCallback& callback,
18 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter) 19 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter)
19 : callback_(callback), 20 : callback_(callback),
20 gaia_auth_fetcher_(this, 21 gaia_auth_fetcher_(this,
21 GaiaConstants::kChromeSource, 22 GaiaConstants::kChromeSource,
22 url_request_context_getter) { 23 url_request_context_getter) {
23 gaia_auth_fetcher_.StartListAccounts(); 24 gaia_auth_fetcher_.StartListAccounts();
24 } 25 }
25 26
26 AuthenticatedUserEmailRetriever::~AuthenticatedUserEmailRetriever() { 27 AuthenticatedUserEmailRetriever::~AuthenticatedUserEmailRetriever() {
27 } 28 }
28 29
29 void AuthenticatedUserEmailRetriever::OnListAccountsSuccess( 30 void AuthenticatedUserEmailRetriever::OnListAccountsSuccess(
30 const std::string& data) { 31 const std::string& data) {
31 std::vector<std::string> accounts; 32 std::vector<std::pair<std::string, bool> > accounts;
32 gaia::ParseListAccountsData(data, &accounts); 33 gaia::ParseListAccountsData(data, &accounts);
33 if (accounts.size() != 1) 34 if (accounts.size() != 1)
34 callback_.Run(std::string()); 35 callback_.Run(std::string());
35 else 36 else
36 callback_.Run(accounts.front()); 37 callback_.Run(accounts.front().first);
37 } 38 }
38 39
39 void AuthenticatedUserEmailRetriever::OnListAccountsFailure( 40 void AuthenticatedUserEmailRetriever::OnListAccountsFailure(
40 const GoogleServiceAuthError& error) { 41 const GoogleServiceAuthError& error) {
41 callback_.Run(std::string()); 42 callback_.Run(std::string());
42 } 43 }
43 44
44 } // namespace chromeos 45 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/signin/account_reconcilor_unittest.cc ('k') | google_apis/gaia/gaia_auth_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698