OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 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 #ifndef REMOTING_HOST_GAIA_USER_EMAIL_FETCHER_H_ | |
6 #define REMOTING_HOST_GAIA_USER_EMAIL_FETCHER_H_ | |
7 | |
8 #include <string> | |
9 | |
10 #include "base/memory/ref_counted.h" | |
11 #include "base/message_loop_proxy.h" | |
12 | |
13 namespace net { | |
14 class URLRequestContextGetter; | |
15 } // namespace net | |
16 | |
17 // A helper class to get a user's email, given an OAuth access token. | |
18 // TODO(simonmorris): Consider moving this to google_apis/gaia. | |
19 namespace remoting { | |
20 | |
21 class GaiaUserEmailFetcher { | |
22 public: | |
23 class Delegate { | |
24 public: | |
25 virtual ~Delegate() { } | |
26 | |
27 // Invoked on a successful response to the GetUserEmail request. | |
28 virtual void OnGetUserEmailResponse(const std::string& user_email) = 0; | |
29 // Invoked when there is an OAuth error with the request. | |
30 virtual void OnOAuthError() = 0; | |
Jamie
2012/10/02 20:38:35
This function doesn't appear ever to be called. Ca
simonmorris
2012/10/02 21:50:52
Done.
| |
31 // Invoked when there is a network error or upon receiving an | |
32 // invalid response. | |
33 virtual void OnNetworkError(int response_code) = 0; | |
34 }; | |
35 | |
36 GaiaUserEmailFetcher(net::URLRequestContextGetter* context_getter); | |
37 ~GaiaUserEmailFetcher(); | |
38 | |
39 void GetUserEmail(const std::string& oauth_access_token, | |
40 Delegate* delegate); | |
41 | |
42 private: | |
43 // The guts of the implementation live in this class. | |
44 class Core; | |
45 scoped_refptr<Core> core_; | |
46 DISALLOW_COPY_AND_ASSIGN(GaiaUserEmailFetcher); | |
47 }; | |
48 | |
49 } // namespace remoting | |
50 | |
51 #endif // REMOTING_HOST_GAIA_USER_EMAIL_FETCHER_H_ | |
OLD | NEW |