| 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_GOOGLE_APIS_REQUEST_SENDER_H_ | 5 #ifndef CHROME_BROWSER_GOOGLE_APIS_REQUEST_SENDER_H_ |
| 6 #define CHROME_BROWSER_GOOGLE_APIS_REQUEST_SENDER_H_ | 6 #define CHROME_BROWSER_GOOGLE_APIS_REQUEST_SENDER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 virtual ~RequestSender(); | 44 virtual ~RequestSender(); |
| 45 | 45 |
| 46 AuthService* auth_service() { return auth_service_.get(); } | 46 AuthService* auth_service() { return auth_service_.get(); } |
| 47 RequestRegistry* request_registry() { | 47 RequestRegistry* request_registry() { |
| 48 return request_registry_.get(); | 48 return request_registry_.get(); |
| 49 } | 49 } |
| 50 | 50 |
| 51 // Prepares the object for use. | 51 // Prepares the object for use. |
| 52 virtual void Initialize(); | 52 virtual void Initialize(); |
| 53 | 53 |
| 54 // Cancels all in-flight requests. | |
| 55 void CancelAll(); | |
| 56 | |
| 57 // Starts a request implementing the AuthenticatedRequestInterface | 54 // Starts a request implementing the AuthenticatedRequestInterface |
| 58 // interface, and makes the request retry upon authentication failures by | 55 // interface, and makes the request retry upon authentication failures by |
| 59 // calling back to RetryRequest. | 56 // calling back to RetryRequest. |
| 60 // | 57 // |
| 61 // Returns a closure to cancel the request. The closure cancels the request | 58 // Returns a closure to cancel the request. The closure cancels the request |
| 62 // if it is in-flight, and does nothing if it is already terminated. | 59 // if it is in-flight, and does nothing if it is already terminated. |
| 63 base::Closure StartRequestWithRetry(AuthenticatedRequestInterface* request); | 60 base::Closure StartRequestWithRetry(AuthenticatedRequestInterface* request); |
| 64 | 61 |
| 65 private: | 62 private: |
| 66 // Called when the access token is fetched. | 63 // Called when the access token is fetched. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 87 // Note: This should remain the last member so it'll be destroyed and | 84 // Note: This should remain the last member so it'll be destroyed and |
| 88 // invalidate its weak pointers before any other members are destroyed. | 85 // invalidate its weak pointers before any other members are destroyed. |
| 89 base::WeakPtrFactory<RequestSender> weak_ptr_factory_; | 86 base::WeakPtrFactory<RequestSender> weak_ptr_factory_; |
| 90 | 87 |
| 91 DISALLOW_COPY_AND_ASSIGN(RequestSender); | 88 DISALLOW_COPY_AND_ASSIGN(RequestSender); |
| 92 }; | 89 }; |
| 93 | 90 |
| 94 } // namespace google_apis | 91 } // namespace google_apis |
| 95 | 92 |
| 96 #endif // CHROME_BROWSER_GOOGLE_APIS_REQUEST_SENDER_H_ | 93 #endif // CHROME_BROWSER_GOOGLE_APIS_REQUEST_SENDER_H_ |
| OLD | NEW |