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

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

Issue 2712483002: cros: Remove AuthenticatedUserEmailRetriever. (Closed)
Patch Set: Initial upload Created 3 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
« no previous file with comments | « chrome/browser/ui/webui/chromeos/login/authenticated_user_email_retriever.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ui/webui/chromeos/login/authenticated_user_email_retrie ver.h"
6
7 #include <utility>
8 #include <vector>
9
10 #include "google_apis/gaia/gaia_auth_util.h"
11 #include "google_apis/gaia/gaia_constants.h"
12 #include "google_apis/gaia/google_service_auth_error.h"
13 #include "net/url_request/url_request_context_getter.h"
14
15 namespace chromeos {
16
17 AuthenticatedUserEmailRetriever::AuthenticatedUserEmailRetriever(
18 const AuthenticatedUserEmailCallback& callback,
19 scoped_refptr<net::URLRequestContextGetter> url_request_context_getter)
20 : callback_(callback),
21 gaia_auth_fetcher_(this,
22 GaiaConstants::kChromeSource,
23 url_request_context_getter.get()) {
24 gaia_auth_fetcher_.StartListAccounts();
25 }
26
27 AuthenticatedUserEmailRetriever::~AuthenticatedUserEmailRetriever() {
28 }
29
30 void AuthenticatedUserEmailRetriever::OnListAccountsSuccess(
31 const std::string& data) {
32 std::vector<gaia::ListedAccount> accounts;
33 gaia::ParseListAccountsData(data, &accounts, nullptr);
34 if (accounts.size() != 1)
35 callback_.Run(std::string());
36 else
37 callback_.Run(accounts.front().email);
38 }
39
40 void AuthenticatedUserEmailRetriever::OnListAccountsFailure(
41 const GoogleServiceAuthError& error) {
42 callback_.Run(std::string());
43 }
44
45 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/chromeos/login/authenticated_user_email_retriever.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698