| 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 CHROME_BROWSER_POLICY_CLOUD_USER_INFO_FETCHER_H_ | 5 #ifndef COMPONENTS_POLICY_CORE_COMMON_CLOUD_USER_INFO_FETCHER_H_ |
| 6 #define CHROME_BROWSER_POLICY_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 "net/url_request/url_fetcher_delegate.h" | 11 #include "net/url_request/url_fetcher_delegate.h" |
| 11 | 12 |
| 12 class GoogleServiceAuthError; | 13 class GoogleServiceAuthError; |
| 13 | 14 |
| 14 namespace base { | 15 namespace base { |
| 15 class DictionaryValue; | 16 class DictionaryValue; |
| 16 } | 17 } |
| 17 | 18 |
| 18 namespace net { | 19 namespace net { |
| 19 class URLFetcher; | 20 class URLFetcher; |
| 20 class URLRequestContextGetter; | 21 class URLRequestContextGetter; |
| 21 } | 22 } |
| 22 | 23 |
| 23 namespace policy { | 24 namespace policy { |
| 24 | 25 |
| 25 // Class that makes a UserInfo request, parses the response, and notifies | 26 // Class that makes a UserInfo request, parses the response, and notifies |
| 26 // a provided Delegate when the request is complete. | 27 // a provided Delegate when the request is complete. |
| 27 class UserInfoFetcher : public net::URLFetcherDelegate { | 28 class POLICY_EXPORT UserInfoFetcher : public net::URLFetcherDelegate { |
| 28 public: | 29 public: |
| 29 class Delegate { | 30 class POLICY_EXPORT Delegate { |
| 30 public: | 31 public: |
| 31 // Invoked when the UserInfo request has succeeded, passing the parsed | 32 // Invoked when the UserInfo request has succeeded, passing the parsed |
| 32 // response in |response|. Delegate may free the UserInfoFetcher in this | 33 // response in |response|. Delegate may free the UserInfoFetcher in this |
| 33 // callback. | 34 // callback. |
| 34 virtual void OnGetUserInfoSuccess( | 35 virtual void OnGetUserInfoSuccess( |
| 35 const base::DictionaryValue* response) = 0; | 36 const base::DictionaryValue* response) = 0; |
| 36 | 37 |
| 37 // Invoked when the UserInfo request has failed, passing the associated | 38 // Invoked when the UserInfo request has failed, passing the associated |
| 38 // error in |error|. Delegate may free the UserInfoFetcher in this | 39 // error in |error|. Delegate may free the UserInfoFetcher in this |
| 39 // callback. | 40 // callback. |
| (...skipping 13 matching lines...) Expand all Loading... |
| 53 private: | 54 private: |
| 54 Delegate* delegate_; | 55 Delegate* delegate_; |
| 55 net::URLRequestContextGetter* context_; | 56 net::URLRequestContextGetter* context_; |
| 56 scoped_ptr<net::URLFetcher> url_fetcher_; | 57 scoped_ptr<net::URLFetcher> url_fetcher_; |
| 57 | 58 |
| 58 DISALLOW_COPY_AND_ASSIGN(UserInfoFetcher); | 59 DISALLOW_COPY_AND_ASSIGN(UserInfoFetcher); |
| 59 }; | 60 }; |
| 60 | 61 |
| 61 } // namespace policy | 62 } // namespace policy |
| 62 | 63 |
| 63 #endif // CHROME_BROWSER_POLICY_CLOUD_USER_INFO_FETCHER_H_ | 64 #endif // COMPONENTS_POLICY_CORE_COMMON_CLOUD_USER_INFO_FETCHER_H_ |
| OLD | NEW |