| 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_NOTIFIER_H_ | 5 #ifndef COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_NOTIFIER_H_ |
| 6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_NOTIFIER_H_ | 6 #define COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_NOTIFIER_H_ |
| 7 | 7 |
| 8 namespace offline_pages { | 8 namespace offline_pages { |
| 9 | 9 |
| 10 class SavePageRequest; | 10 class SavePageRequest; |
| 11 | 11 |
| 12 class RequestNotifier { | 12 class RequestNotifier { |
| 13 public: | 13 public: |
| 14 // Status to return for failed notifications. | 14 // Status to return for failed notifications. |
| 15 // NOTE: for any changes to the enum, please also update related switch code |
| 16 // in RequestCoordinatorEventLogger. |
| 15 enum class BackgroundSavePageResult { | 17 enum class BackgroundSavePageResult { |
| 16 SUCCESS, | 18 SUCCESS, |
| 17 PRERENDER_FAILURE, | 19 PRERENDER_FAILURE, |
| 18 PRERENDER_CANCELED, | 20 PRERENDER_CANCELED, |
| 19 FOREGROUND_CANCELED, | 21 FOREGROUND_CANCELED, |
| 20 SAVE_FAILED, | 22 SAVE_FAILED, |
| 21 EXPIRED, | 23 EXPIRED, |
| 22 RETRY_COUNT_EXCEEDED, | 24 RETRY_COUNT_EXCEEDED, |
| 23 START_COUNT_EXCEEDED, | 25 START_COUNT_EXCEEDED, |
| 24 REMOVED, | 26 REMOVED, |
| 25 }; | 27 }; |
| 26 | 28 |
| 27 virtual ~RequestNotifier() = default; | 29 virtual ~RequestNotifier() = default; |
| 28 | 30 |
| 29 // Notifies observers that |request| has been added. | 31 // Notifies observers that |request| has been added. |
| 30 virtual void NotifyAdded(const SavePageRequest& request) = 0; | 32 virtual void NotifyAdded(const SavePageRequest& request) = 0; |
| 31 | 33 |
| 32 // Notifies observers that |request| has been completed with |status|. | 34 // Notifies observers that |request| has been completed with |status|. |
| 33 virtual void NotifyCompleted(const SavePageRequest& request, | 35 virtual void NotifyCompleted(const SavePageRequest& request, |
| 34 BackgroundSavePageResult status) = 0; | 36 BackgroundSavePageResult status) = 0; |
| 35 | 37 |
| 36 // Notifies observers that |request| has been changed. | 38 // Notifies observers that |request| has been changed. |
| 37 virtual void NotifyChanged(const SavePageRequest& request) = 0; | 39 virtual void NotifyChanged(const SavePageRequest& request) = 0; |
| 38 }; | 40 }; |
| 39 | 41 |
| 40 } // namespace offline_pages | 42 } // namespace offline_pages |
| 41 | 43 |
| 42 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_NOTIFIER_H_ | 44 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_NOTIFIER_H_ |
| OLD | NEW |