OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_TYPES_H_ | |
6 #define COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_TYPES_H_ | |
7 | |
8 #include <stdint.h> | |
9 | |
10 #include <set> | |
11 #include <vector> | |
12 | |
13 #include "base/callback.h" | |
14 #include "components/offline_pages/offline_page_item.h" | |
15 | |
16 class GURL; | |
17 | |
18 // This file contains common callbacks used by OfflinePageModel and is a | |
19 // temporary step to refactor and interface of the model out of the | |
20 // implementation. | |
21 namespace offline_pages { | |
22 // Result of saving a page offline. | |
23 // A Java counterpart will be generated for this enum. | |
24 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.components.offlinepages | |
25 enum class SavePageResult { | |
26 SUCCESS, | |
27 CANCELLED, | |
28 DEVICE_FULL, | |
29 CONTENT_UNAVAILABLE, | |
30 ARCHIVE_CREATION_FAILED, | |
31 STORE_FAILURE, | |
32 ALREADY_EXISTS, | |
33 // Certain pages, i.e. file URL or NTP, will not be saved because these | |
34 // are already locally accessible. | |
35 SKIPPED, | |
36 SECURITY_CERTIFICATE_ERROR, | |
37 // NOTE: always keep this entry at the end. Add new result types only | |
38 // immediately above this line. Make sure to update the corresponding | |
39 // histogram enum accordingly. | |
40 RESULT_COUNT, | |
41 }; | |
42 | |
43 // Result of deleting an offline page. | |
44 // A Java counterpart will be generated for this enum. | |
45 // GENERATED_JAVA_ENUM_PACKAGE: org.chromium.components.offlinepages | |
46 enum class DeletePageResult { | |
47 SUCCESS, | |
48 CANCELLED, | |
49 STORE_FAILURE, | |
50 DEVICE_FAILURE, | |
51 // Deprecated. Deleting pages which are not in metadata store would be | |
52 // returing |SUCCESS|. Should not be used anymore. | |
53 NOT_FOUND, | |
54 // NOTE: always keep this entry at the end. Add new result types only | |
55 // immediately above this line. Make sure to update the corresponding | |
56 // histogram enum accordingly. | |
57 RESULT_COUNT, | |
58 }; | |
59 | |
60 typedef std::set<GURL> CheckPagesExistOfflineResult; | |
61 typedef std::vector<int64_t> MultipleOfflineIdResult; | |
62 typedef std::vector<OfflinePageItem> MultipleOfflinePageItemResult; | |
63 | |
64 typedef base::Callback<void(SavePageResult, int64_t)> SavePageCallback; | |
65 typedef base::Callback<void(DeletePageResult)> DeletePageCallback; | |
66 typedef base::Callback<void(const CheckPagesExistOfflineResult&)> | |
67 CheckPagesExistOfflineCallback; | |
68 typedef base::Callback<void(bool)> HasPagesCallback; | |
69 typedef base::Callback<void(const MultipleOfflineIdResult&)> | |
70 MultipleOfflineIdCallback; | |
71 typedef base::Callback<void(const OfflinePageItem*)> | |
72 SingleOfflinePageItemCallback; | |
73 typedef base::Callback<void(const MultipleOfflinePageItemResult&)> | |
74 MultipleOfflinePageItemCallback; | |
75 typedef base::Callback<bool(const GURL&)> UrlPredicate; | |
76 } // namespace offline_pages | |
77 | |
78 #endif // COMPONENTS_OFFLINE_PAGES_OFFLINE_PAGE_TYPES_H_ | |
OLD | NEW |