| 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 // TODO(petewil): Can we find a better name for this enum? | 15 // TODO(petewil): Can we find a better name for this enum? |
| 16 enum class SavePageStatus { | 16 enum class SavePageStatus { |
| 17 SUCCESS, | 17 SUCCESS, |
| 18 PRERENDER_FAILURE, | 18 PRERENDER_FAILURE, |
| 19 PRERENDER_CANCELED, |
| 19 FOREGROUND_CANCELED, | 20 FOREGROUND_CANCELED, |
| 20 SAVE_FAILED, | 21 SAVE_FAILED, |
| 21 EXPIRED, | 22 EXPIRED, |
| 22 RETRY_COUNT_EXCEEDED, | 23 RETRY_COUNT_EXCEEDED, |
| 23 REMOVED, | 24 REMOVED, |
| 24 }; | 25 }; |
| 25 | 26 |
| 26 virtual ~RequestNotifier() = default; | 27 virtual ~RequestNotifier() = default; |
| 27 | 28 |
| 28 // Notifies observers that |request| has been added. | 29 // Notifies observers that |request| has been added. |
| 29 virtual void NotifyAdded(const SavePageRequest& request) = 0; | 30 virtual void NotifyAdded(const SavePageRequest& request) = 0; |
| 30 | 31 |
| 31 // Notifies observers that |request| has been completed with |status|. | 32 // Notifies observers that |request| has been completed with |status|. |
| 32 virtual void NotifyCompleted(const SavePageRequest& request, | 33 virtual void NotifyCompleted(const SavePageRequest& request, |
| 33 SavePageStatus status) = 0; | 34 SavePageStatus status) = 0; |
| 34 | 35 |
| 35 // Notifies observers that |request| has been changed. | 36 // Notifies observers that |request| has been changed. |
| 36 virtual void NotifyChanged(const SavePageRequest& request) = 0; | 37 virtual void NotifyChanged(const SavePageRequest& request) = 0; |
| 37 }; | 38 }; |
| 38 | 39 |
| 39 } // namespace offline_pages | 40 } // namespace offline_pages |
| 40 | 41 |
| 41 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_NOTIFIER_H_ | 42 #endif // COMPONENTS_OFFLINE_PAGES_BACKGROUND_REQUEST_NOTIFIER_H_ |
| OLD | NEW |