Chromium Code Reviews| 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_CHILD_ACCOUNTS_PERMISSION_REQUEST_CREATOR _APIARY_H_ | 5 #ifndef CHROME_BROWSER_SUPERVISED_USER_CHILD_ACCOUNTS_PERMISSION_REQUEST_CREATOR _APIARY_H_ |
| 6 #define CHROME_BROWSER_SUPERVISED_USER_CHILD_ACCOUNTS_PERMISSION_REQUEST_CREATOR _APIARY_H_ | 6 #define CHROME_BROWSER_SUPERVISED_USER_CHILD_ACCOUNTS_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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 42 bool IsEnabled() const override; | 42 bool IsEnabled() const override; |
| 43 void CreateURLAccessRequest(const GURL& url_requested, | 43 void CreateURLAccessRequest(const GURL& url_requested, |
| 44 const SuccessCallback& callback) override; | 44 const SuccessCallback& callback) override; |
| 45 void CreateExtensionUpdateRequest(const std::string& id, | 45 void CreateExtensionUpdateRequest(const std::string& id, |
| 46 const SuccessCallback& callback) override; | 46 const SuccessCallback& callback) override; |
| 47 | 47 |
| 48 void set_url_fetcher_id_for_testing(int id) { url_fetcher_id_ = id; } | 48 void set_url_fetcher_id_for_testing(int id) { url_fetcher_id_ = id; } |
| 49 | 49 |
| 50 private: | 50 private: |
| 51 struct Request; | 51 struct Request; |
| 52 typedef ScopedVector<Request>::iterator RequestIterator; | 52 using RequestIterator = ScopedVector<Request>::iterator; |
| 53 | 53 |
| 54 // OAuth2TokenService::Consumer implementation: | 54 // OAuth2TokenService::Consumer implementation: |
| 55 void OnGetTokenSuccess(const OAuth2TokenService::Request* request, | 55 void OnGetTokenSuccess(const OAuth2TokenService::Request* request, |
| 56 const std::string& access_token, | 56 const std::string& access_token, |
| 57 const base::Time& expiration_time) override; | 57 const base::Time& expiration_time) override; |
| 58 void OnGetTokenFailure(const OAuth2TokenService::Request* request, | 58 void OnGetTokenFailure(const OAuth2TokenService::Request* request, |
| 59 const GoogleServiceAuthError& error) override; | 59 const GoogleServiceAuthError& error) override; |
| 60 | 60 |
| 61 // net::URLFetcherDelegate implementation. | 61 // net::URLFetcherDelegate implementation. |
| 62 void OnURLFetchComplete(const net::URLFetcher* source) override; | 62 void OnURLFetchComplete(const net::URLFetcher* source) override; |
| 63 | 63 |
| 64 GURL GetApiUrl() const; | 64 GURL GetApiUrl() const; |
| 65 std::string GetApiScope() const; | 65 std::string GetApiScope() const; |
| 66 | 66 |
| 67 void CreateRequest(const std::string& request_type, | 67 void CreateRequest(const std::string& request_type, |
| 68 const std::string& object_ref, | 68 const std::string& object_ref, |
| 69 const SuccessCallback& callback); | 69 const SuccessCallback& callback); |
| 70 | 70 |
| 71 // Requests an access token, which is the first thing we need. This is where | 71 // Requests an access token, which is the first thing we need. This is where |
| 72 // we restart when the returned access token has expired. | 72 // we restart when the returned access token has expired. |
| 73 void StartFetching(Request* request); | 73 void StartFetching(Request* request); |
| 74 | 74 |
| 75 void DispatchNetworkError(RequestIterator it, int error_code); | 75 void DispatchResult(RequestIterator it, bool succss); |
|
Marc Treib
2015/09/23 14:23:31
nit: succEss
Bernhard Bauer
2015/09/23 15:10:03
Yssss.
| |
| 76 void DispatchGoogleServiceAuthError(RequestIterator it, | |
| 77 const GoogleServiceAuthError& error); | |
| 78 | 76 |
| 79 OAuth2TokenService* oauth2_token_service_; | 77 OAuth2TokenService* oauth2_token_service_; |
| 80 std::string account_id_; | 78 std::string account_id_; |
| 81 net::URLRequestContextGetter* context_; | 79 net::URLRequestContextGetter* context_; |
| 82 int url_fetcher_id_; | 80 int url_fetcher_id_; |
| 83 | 81 |
| 84 ScopedVector<Request> requests_; | 82 ScopedVector<Request> requests_; |
| 85 | 83 |
| 86 DISALLOW_COPY_AND_ASSIGN(PermissionRequestCreatorApiary); | 84 DISALLOW_COPY_AND_ASSIGN(PermissionRequestCreatorApiary); |
| 87 }; | 85 }; |
| 88 | 86 |
| 89 #endif // CHROME_BROWSER_SUPERVISED_USER_CHILD_ACCOUNTS_PERMISSION_REQUEST_CREA TOR_APIARY_H_ | 87 #endif // CHROME_BROWSER_SUPERVISED_USER_CHILD_ACCOUNTS_PERMISSION_REQUEST_CREA TOR_APIARY_H_ |
| OLD | NEW |