| 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 a network error or upon receiving an | |
| 30 // invalid response. | |
| 31 virtual void OnNetworkError(int response_code) = 0; | |
| 32 }; | |
| 33 | |
| 34 GaiaUserEmailFetcher(net::URLRequestContextGetter* context_getter); | |
| 35 ~GaiaUserEmailFetcher(); | |
| 36 | |
| 37 void GetUserEmail(const std::string& oauth_access_token, | |
| 38 Delegate* delegate); | |
| 39 | |
| 40 private: | |
| 41 // The guts of the implementation live in this class. | |
| 42 class Core; | |
| 43 scoped_refptr<Core> core_; | |
| 44 DISALLOW_COPY_AND_ASSIGN(GaiaUserEmailFetcher); | |
| 45 }; | |
| 46 | |
| 47 } // namespace remoting | |
| 48 | |
| 49 #endif // REMOTING_HOST_GAIA_USER_EMAIL_FETCHER_H_ | |
| OLD | NEW |