| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ | 5 #ifndef COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ |
| 6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ | 6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 RETRY_COUNT_EXCEEDED, | 45 RETRY_COUNT_EXCEEDED, |
| 46 REMOVED, | 46 REMOVED, |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 // Nested observer class. To make sure that no events are missed, the client | 49 // Nested observer class. To make sure that no events are missed, the client |
| 50 // code should first register for notifications, then |GetAllRequests|, and | 50 // code should first register for notifications, then |GetAllRequests|, and |
| 51 // ignore all events before the return from |GetAllRequests|, and consume | 51 // ignore all events before the return from |GetAllRequests|, and consume |
| 52 // events after the return callback from |GetAllRequests|. | 52 // events after the return callback from |GetAllRequests|. |
| 53 class Observer { | 53 class Observer { |
| 54 public: | 54 public: |
| 55 virtual ~Observer() = default; |
| 55 virtual void OnAdded(const SavePageRequest& request) = 0; | 56 virtual void OnAdded(const SavePageRequest& request) = 0; |
| 56 virtual void OnCompleted(const SavePageRequest& request, | 57 virtual void OnCompleted(const SavePageRequest& request, |
| 57 SavePageStatus status) = 0; | 58 SavePageStatus status) = 0; |
| 58 virtual void OnChanged(const SavePageRequest& request) = 0; | 59 virtual void OnChanged(const SavePageRequest& request) = 0; |
| 59 }; | 60 }; |
| 60 | 61 |
| 61 // Callback to report when the processing of a triggered task is complete. | 62 // Callback to report when the processing of a triggered task is complete. |
| 62 typedef base::Callback<void(const SavePageRequest& request)> | 63 typedef base::Callback<void(const SavePageRequest& request)> |
| 63 RequestPickedCallback; | 64 RequestPickedCallback; |
| 64 typedef base::Callback<void()> RequestQueueEmptyCallback; | 65 typedef base::Callback<void()> RequestQueueEmptyCallback; |
| (...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 base::TimeDelta offliner_timeout_; | 243 base::TimeDelta offliner_timeout_; |
| 243 // Allows us to pass a weak pointer to callbacks. | 244 // Allows us to pass a weak pointer to callbacks. |
| 244 base::WeakPtrFactory<RequestCoordinator> weak_ptr_factory_; | 245 base::WeakPtrFactory<RequestCoordinator> weak_ptr_factory_; |
| 245 | 246 |
| 246 DISALLOW_COPY_AND_ASSIGN(RequestCoordinator); | 247 DISALLOW_COPY_AND_ASSIGN(RequestCoordinator); |
| 247 }; | 248 }; |
| 248 | 249 |
| 249 } // namespace offline_pages | 250 } // namespace offline_pages |
| 250 | 251 |
| 251 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ | 252 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_COORDINATOR_H_ |
| OLD | NEW |