| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef COMPONENTS_POLICY_CORE_COMMON_CLOUD_USER_INFO_FETCHER_H_ | 5 #ifndef COMPONENTS_POLICY_CORE_COMMON_CLOUD_USER_INFO_FETCHER_H_ |
| 6 #define COMPONENTS_POLICY_CORE_COMMON_CLOUD_USER_INFO_FETCHER_H_ | 6 #define COMPONENTS_POLICY_CORE_COMMON_CLOUD_USER_INFO_FETCHER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "components/policy/policy_export.h" | 10 #include "components/policy/policy_export.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 const base::DictionaryValue* response) = 0; | 36 const base::DictionaryValue* response) = 0; |
| 37 | 37 |
| 38 // Invoked when the UserInfo request has failed, passing the associated | 38 // Invoked when the UserInfo request has failed, passing the associated |
| 39 // error in |error|. Delegate may free the UserInfoFetcher in this | 39 // error in |error|. Delegate may free the UserInfoFetcher in this |
| 40 // callback. | 40 // callback. |
| 41 virtual void OnGetUserInfoFailure(const GoogleServiceAuthError& error) = 0; | 41 virtual void OnGetUserInfoFailure(const GoogleServiceAuthError& error) = 0; |
| 42 }; | 42 }; |
| 43 | 43 |
| 44 // Create a new UserInfoFetcher. |context| can be NULL for unit tests. | 44 // Create a new UserInfoFetcher. |context| can be NULL for unit tests. |
| 45 UserInfoFetcher(Delegate* delegate, net::URLRequestContextGetter* context); | 45 UserInfoFetcher(Delegate* delegate, net::URLRequestContextGetter* context); |
| 46 virtual ~UserInfoFetcher(); | 46 ~UserInfoFetcher() override; |
| 47 | 47 |
| 48 // Starts the UserInfo request, using the passed OAuth2 |access_token|. | 48 // Starts the UserInfo request, using the passed OAuth2 |access_token|. |
| 49 void Start(const std::string& access_token); | 49 void Start(const std::string& access_token); |
| 50 | 50 |
| 51 // net::URLFetcherDelegate implementation. | 51 // net::URLFetcherDelegate implementation. |
| 52 virtual void OnURLFetchComplete(const net::URLFetcher* source) override; | 52 void OnURLFetchComplete(const net::URLFetcher* source) override; |
| 53 | 53 |
| 54 private: | 54 private: |
| 55 Delegate* delegate_; | 55 Delegate* delegate_; |
| 56 net::URLRequestContextGetter* context_; | 56 net::URLRequestContextGetter* context_; |
| 57 scoped_ptr<net::URLFetcher> url_fetcher_; | 57 scoped_ptr<net::URLFetcher> url_fetcher_; |
| 58 | 58 |
| 59 DISALLOW_COPY_AND_ASSIGN(UserInfoFetcher); | 59 DISALLOW_COPY_AND_ASSIGN(UserInfoFetcher); |
| 60 }; | 60 }; |
| 61 | 61 |
| 62 } // namespace policy | 62 } // namespace policy |
| 63 | 63 |
| 64 #endif // COMPONENTS_POLICY_CORE_COMMON_CLOUD_USER_INFO_FETCHER_H_ | 64 #endif // COMPONENTS_POLICY_CORE_COMMON_CLOUD_USER_INFO_FETCHER_H_ |
| OLD | NEW |