| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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_SUPERVISED_USER_PERMISSION_REQUEST_CREATOR_APIARY_H_ | 5 #ifndef CHROME_BROWSER_SUPERVISED_USER_PERMISSION_REQUEST_CREATOR_APIARY_H_ |
| 6 #define CHROME_BROWSER_SUPERVISED_USER_PERMISSION_REQUEST_CREATOR_APIARY_H_ | 6 #define CHROME_BROWSER_SUPERVISED_USER_PERMISSION_REQUEST_CREATOR_APIARY_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 OAuth2TokenService* oauth2_token_service, | 34 OAuth2TokenService* oauth2_token_service, |
| 35 scoped_ptr<SupervisedUserSigninManagerWrapper> signin_wrapper, | 35 scoped_ptr<SupervisedUserSigninManagerWrapper> signin_wrapper, |
| 36 net::URLRequestContextGetter* context, | 36 net::URLRequestContextGetter* context, |
| 37 const GURL& apiary_url); | 37 const GURL& apiary_url); |
| 38 virtual ~PermissionRequestCreatorApiary(); | 38 virtual ~PermissionRequestCreatorApiary(); |
| 39 | 39 |
| 40 static scoped_ptr<PermissionRequestCreator> CreateWithProfile( | 40 static scoped_ptr<PermissionRequestCreator> CreateWithProfile( |
| 41 Profile* profile, const GURL& apiary_url); | 41 Profile* profile, const GURL& apiary_url); |
| 42 | 42 |
| 43 // PermissionRequestCreator implementation: | 43 // PermissionRequestCreator implementation: |
| 44 virtual bool IsEnabled() const OVERRIDE; | 44 virtual bool IsEnabled() const override; |
| 45 virtual void CreatePermissionRequest( | 45 virtual void CreatePermissionRequest( |
| 46 const GURL& url_requested, | 46 const GURL& url_requested, |
| 47 const SuccessCallback& callback) OVERRIDE; | 47 const SuccessCallback& callback) override; |
| 48 | 48 |
| 49 void set_url_fetcher_id_for_testing(int id) { url_fetcher_id_ = id; } | 49 void set_url_fetcher_id_for_testing(int id) { url_fetcher_id_ = id; } |
| 50 | 50 |
| 51 private: | 51 private: |
| 52 struct Request; | 52 struct Request; |
| 53 typedef ScopedVector<Request>::iterator RequestIterator; | 53 typedef ScopedVector<Request>::iterator RequestIterator; |
| 54 | 54 |
| 55 // OAuth2TokenService::Consumer implementation: | 55 // OAuth2TokenService::Consumer implementation: |
| 56 virtual void OnGetTokenSuccess(const OAuth2TokenService::Request* request, | 56 virtual void OnGetTokenSuccess(const OAuth2TokenService::Request* request, |
| 57 const std::string& access_token, | 57 const std::string& access_token, |
| 58 const base::Time& expiration_time) OVERRIDE; | 58 const base::Time& expiration_time) override; |
| 59 virtual void OnGetTokenFailure(const OAuth2TokenService::Request* request, | 59 virtual void OnGetTokenFailure(const OAuth2TokenService::Request* request, |
| 60 const GoogleServiceAuthError& error) OVERRIDE; | 60 const GoogleServiceAuthError& error) override; |
| 61 | 61 |
| 62 // net::URLFetcherDelegate implementation. | 62 // net::URLFetcherDelegate implementation. |
| 63 virtual void OnURLFetchComplete(const net::URLFetcher* source) OVERRIDE; | 63 virtual void OnURLFetchComplete(const net::URLFetcher* source) override; |
| 64 | 64 |
| 65 std::string GetApiScopeToUse() const; | 65 std::string GetApiScopeToUse() const; |
| 66 | 66 |
| 67 // Requests an access token, which is the first thing we need. This is where | 67 // Requests an access token, which is the first thing we need. This is where |
| 68 // we restart when the returned access token has expired. | 68 // we restart when the returned access token has expired. |
| 69 void StartFetching(Request* request); | 69 void StartFetching(Request* request); |
| 70 | 70 |
| 71 void DispatchNetworkError(RequestIterator it, int error_code); | 71 void DispatchNetworkError(RequestIterator it, int error_code); |
| 72 void DispatchGoogleServiceAuthError(RequestIterator it, | 72 void DispatchGoogleServiceAuthError(RequestIterator it, |
| 73 const GoogleServiceAuthError& error); | 73 const GoogleServiceAuthError& error); |
| 74 | 74 |
| 75 OAuth2TokenService* oauth2_token_service_; | 75 OAuth2TokenService* oauth2_token_service_; |
| 76 scoped_ptr<SupervisedUserSigninManagerWrapper> signin_wrapper_; | 76 scoped_ptr<SupervisedUserSigninManagerWrapper> signin_wrapper_; |
| 77 net::URLRequestContextGetter* context_; | 77 net::URLRequestContextGetter* context_; |
| 78 GURL apiary_url_; | 78 GURL apiary_url_; |
| 79 int url_fetcher_id_; | 79 int url_fetcher_id_; |
| 80 | 80 |
| 81 ScopedVector<Request> requests_; | 81 ScopedVector<Request> requests_; |
| 82 }; | 82 }; |
| 83 | 83 |
| 84 #endif // CHROME_BROWSER_SUPERVISED_USER_PERMISSION_REQUEST_CREATOR_APIARY_H_ | 84 #endif // CHROME_BROWSER_SUPERVISED_USER_PERMISSION_REQUEST_CREATOR_APIARY_H_ |
| OLD | NEW |