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 GOOGLE_APIS_DRIVE_REQUEST_SENDER_H_ | 5 #ifndef GOOGLE_APIS_DRIVE_REQUEST_SENDER_H_ |
6 #define GOOGLE_APIS_DRIVE_REQUEST_SENDER_H_ | 6 #define GOOGLE_APIS_DRIVE_REQUEST_SENDER_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/callback_forward.h" | 12 #include "base/callback_forward.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
16 #include "base/threading/thread_checker.h" | 16 #include "base/threading/thread_checker.h" |
17 #include "google_apis/drive/gdata_errorcode.h" | 17 #include "google_apis/drive/drive_api_error_codes.h" |
18 | 18 |
19 namespace base { | 19 namespace base { |
20 class SequencedTaskRunner; | 20 class SequencedTaskRunner; |
21 } | 21 } |
22 | 22 |
23 namespace net { | 23 namespace net { |
24 class URLRequestContextGetter; | 24 class URLRequestContextGetter; |
25 } | 25 } |
26 | 26 |
27 namespace google_apis { | 27 namespace google_apis { |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 base::Closure StartRequestWithRetry(AuthenticatedRequestInterface* request); | 72 base::Closure StartRequestWithRetry(AuthenticatedRequestInterface* request); |
73 | 73 |
74 // Notifies to this RequestSender that |request| has finished. | 74 // Notifies to this RequestSender that |request| has finished. |
75 // TODO(kinaba): refactor the life time management and make this at private. | 75 // TODO(kinaba): refactor the life time management and make this at private. |
76 void RequestFinished(AuthenticatedRequestInterface* request); | 76 void RequestFinished(AuthenticatedRequestInterface* request); |
77 | 77 |
78 private: | 78 private: |
79 // Called when the access token is fetched. | 79 // Called when the access token is fetched. |
80 void OnAccessTokenFetched( | 80 void OnAccessTokenFetched( |
81 const base::WeakPtr<AuthenticatedRequestInterface>& request, | 81 const base::WeakPtr<AuthenticatedRequestInterface>& request, |
82 GDataErrorCode error, | 82 DriveApiErrorCode error, |
83 const std::string& access_token); | 83 const std::string& access_token); |
84 | 84 |
85 // Clears any authentication token and retries the request, which forces | 85 // Clears any authentication token and retries the request, which forces |
86 // an authentication token refresh. | 86 // an authentication token refresh. |
87 void RetryRequest(AuthenticatedRequestInterface* request); | 87 void RetryRequest(AuthenticatedRequestInterface* request); |
88 | 88 |
89 // Cancels the request. Used for implementing the returned closure of | 89 // Cancels the request. Used for implementing the returned closure of |
90 // StartRequestWithRetry. | 90 // StartRequestWithRetry. |
91 void CancelRequest( | 91 void CancelRequest( |
92 const base::WeakPtr<AuthenticatedRequestInterface>& request); | 92 const base::WeakPtr<AuthenticatedRequestInterface>& request); |
(...skipping 10 matching lines...) Expand all Loading... |
103 // Note: This should remain the last member so it'll be destroyed and | 103 // Note: This should remain the last member so it'll be destroyed and |
104 // invalidate its weak pointers before any other members are destroyed. | 104 // invalidate its weak pointers before any other members are destroyed. |
105 base::WeakPtrFactory<RequestSender> weak_ptr_factory_; | 105 base::WeakPtrFactory<RequestSender> weak_ptr_factory_; |
106 | 106 |
107 DISALLOW_COPY_AND_ASSIGN(RequestSender); | 107 DISALLOW_COPY_AND_ASSIGN(RequestSender); |
108 }; | 108 }; |
109 | 109 |
110 } // namespace google_apis | 110 } // namespace google_apis |
111 | 111 |
112 #endif // GOOGLE_APIS_DRIVE_REQUEST_SENDER_H_ | 112 #endif // GOOGLE_APIS_DRIVE_REQUEST_SENDER_H_ |
OLD | NEW |