| 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_REGISTRY_H_ | 5 #ifndef CHROME_BROWSER_GOOGLE_APIS_REQUEST_REGISTRY_H_ |
| 6 #define CHROME_BROWSER_GOOGLE_APIS_REQUEST_REGISTRY_H_ | 6 #define CHROME_BROWSER_GOOGLE_APIS_REQUEST_REGISTRY_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/files/file_path.h" | 9 #include "base/files/file_path.h" |
| 10 #include "base/id_map.h" | 10 #include "base/id_map.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 void NotifyFinish(RequestTransferState status); | 71 void NotifyFinish(RequestTransferState status); |
| 72 | 72 |
| 73 private: | 73 private: |
| 74 // Does the cancellation. | 74 // Does the cancellation. |
| 75 virtual void DoCancel() = 0; | 75 virtual void DoCancel() = 0; |
| 76 | 76 |
| 77 RequestRegistry* const registry_; | 77 RequestRegistry* const registry_; |
| 78 RequestProgressStatus progress_status_; | 78 RequestProgressStatus progress_status_; |
| 79 }; | 79 }; |
| 80 | 80 |
| 81 // Cancels all in-flight requests. | |
| 82 void CancelAll(); | |
| 83 | |
| 84 // Cancels ongoing request for a given virtual |file_path|. Returns true if | |
| 85 // the request was found and canceled. | |
| 86 bool CancelForFilePath(const base::FilePath& file_path); | |
| 87 | |
| 88 // Cancels the specified request. | 81 // Cancels the specified request. |
| 89 void CancelRequest(Request* request); | 82 void CancelRequest(Request* request); |
| 90 | 83 |
| 91 private: | 84 private: |
| 92 // Handlers for notifications from Requests. | 85 // Handlers for notifications from Requests. |
| 93 friend class Request; | 86 friend class Request; |
| 94 // Notifies that an request has started. This method passes the ownership of | 87 // Notifies that an request has started. This method passes the ownership of |
| 95 // the request to the registry. A fresh request ID is returned to *id. | 88 // the request to the registry. A fresh request ID is returned to *id. |
| 96 void OnRequestStart(Request* request, RequestID* id); | 89 void OnRequestStart(Request* request, RequestID* id); |
| 97 void OnRequestFinish(RequestID request_id); | 90 void OnRequestFinish(RequestID request_id); |
| 98 | 91 |
| 99 typedef IDMap<Request, IDMapOwnPointer> RequestIDMap; | 92 typedef IDMap<Request, IDMapOwnPointer> RequestIDMap; |
| 100 RequestIDMap in_flight_requests_; | 93 RequestIDMap in_flight_requests_; |
| 101 | 94 |
| 102 DISALLOW_COPY_AND_ASSIGN(RequestRegistry); | 95 DISALLOW_COPY_AND_ASSIGN(RequestRegistry); |
| 103 }; | 96 }; |
| 104 | 97 |
| 105 } // namespace google_apis | 98 } // namespace google_apis |
| 106 | 99 |
| 107 #endif // CHROME_BROWSER_GOOGLE_APIS_REQUEST_REGISTRY_H_ | 100 #endif // CHROME_BROWSER_GOOGLE_APIS_REQUEST_REGISTRY_H_ |
| OLD | NEW |