OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_OFFLINE_PAGE_METADATA_STORE_H_ | 5 #ifndef COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_METADATA_STORE_H_ |
6 #define COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_METADATA_STORE_H_ | 6 #define COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_METADATA_STORE_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/callback.h" | 12 #include "base/callback.h" |
13 #include "components/offline_pages/offline_page_item.h" | 13 #include "components/offline_pages/offline_page_item.h" |
| 14 #include "components/offline_pages/offline_page_types.h" |
14 | 15 |
15 class GURL; | 16 class GURL; |
16 | 17 |
17 namespace offline_pages { | 18 namespace offline_pages { |
18 | 19 |
19 // TODO(fgorski): This enum is meant to replace |LoadStatus|. | 20 // TODO(fgorski): This enum is meant to replace |LoadStatus|. |
20 // Current store state. When LOADED, the store is operational. When | 21 // Current store state. When LOADED, the store is operational. When |
21 // initialization or reset fails, it is reflected appropriately. | 22 // initialization or reset fails, it is reflected appropriately. |
22 enum class StoreState { | 23 enum class StoreState { |
23 NOT_LOADED, // Store is not loaded yet. | 24 NOT_LOADED, // Store is not loaded yet. |
24 LOADED, // Store is properly loaded and operational. | 25 LOADED, // Store is properly loaded and operational. |
25 FAILED_LOADING, // Store initialization failed. | 26 FAILED_LOADING, // Store initialization failed. |
26 FAILED_RESET, // Resetting the store failed. | 27 FAILED_RESET, // Resetting the store failed. |
27 }; | 28 }; |
28 | 29 |
29 // Statuses referring to actions taken on items in the store. | |
30 enum class ItemActionStatus { | |
31 SUCCESS, | |
32 ALREADY_EXISTS, | |
33 NOT_FOUND, | |
34 STORE_ERROR, | |
35 }; | |
36 | |
37 class StoreUpdateResult { | 30 class StoreUpdateResult { |
38 public: | 31 public: |
39 explicit StoreUpdateResult(StoreState state); | 32 explicit StoreUpdateResult(StoreState state); |
40 ~StoreUpdateResult(); | 33 ~StoreUpdateResult(); |
41 | 34 |
42 // List of Offline ID to item action status mappings. | 35 // List of Offline ID to item action status mappings. |
43 // It is meant to be consumed by the original caller of the operation. | 36 // It is meant to be consumed by the original caller of the operation. |
44 std::vector<std::pair<int64_t, ItemActionStatus>> item_statuses; | 37 std::vector<std::pair<int64_t, ItemActionStatus>> item_statuses; |
45 | 38 |
46 // List of successfully updated offline page items as seen after operation | 39 // List of successfully updated offline page items as seen after operation |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 // Resets the store. | 92 // Resets the store. |
100 virtual void Reset(const ResetCallback& callback) = 0; | 93 virtual void Reset(const ResetCallback& callback) = 0; |
101 | 94 |
102 // Gets the store state. | 95 // Gets the store state. |
103 virtual StoreState state() const = 0; | 96 virtual StoreState state() const = 0; |
104 }; | 97 }; |
105 | 98 |
106 } // namespace offline_pages | 99 } // namespace offline_pages |
107 | 100 |
108 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_METADATA_STORE_H_ | 101 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_METADATA_STORE_H_ |
OLD | NEW |