OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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_CORE_PREFETCH_PREFETCH_TYPES_H_ | 5 #ifndef COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_TYPES_H_ |
6 #define COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_TYPES_H_ | 6 #define COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_TYPES_H_ |
7 | 7 |
| 8 #include <string> |
8 #include <vector> | 9 #include <vector> |
9 #include "base/macros.h" | 10 |
10 #include "base/time/time.h" | 11 #include "base/time/time.h" |
| 12 #include "components/offline_pages/core/client_id.h" |
| 13 #include "url/gurl.h" |
11 | 14 |
12 namespace offline_pages { | 15 namespace offline_pages { |
13 | 16 |
14 // Status for sending prefetch request to the server. | 17 // Status for sending prefetch request to the server. |
15 enum class PrefetchRequestStatus { | 18 enum class PrefetchRequestStatus { |
16 // Request completed successfully. | 19 // Request completed successfully. |
17 SUCCESS, | 20 SUCCESS, |
18 // Request failed due to to local network problem, unrelated to server load | 21 // Request failed due to to local network problem, unrelated to server load |
19 // levels. The caller will simply reschedule the retry in the next available | 22 // levels. The caller will simply reschedule the retry in the next available |
20 // WiFi window after 15 minutes have passed. | 23 // WiFi window after 15 minutes have passed. |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 enum class PrefetchItemErrorCode { | 101 enum class PrefetchItemErrorCode { |
99 SUCCESS, | 102 SUCCESS, |
100 EXPIRED, | 103 EXPIRED, |
101 }; | 104 }; |
102 | 105 |
103 // Callback invoked upon completion of a prefetch request. | 106 // Callback invoked upon completion of a prefetch request. |
104 using PrefetchRequestFinishedCallback = | 107 using PrefetchRequestFinishedCallback = |
105 base::Callback<void(PrefetchRequestStatus status, | 108 base::Callback<void(PrefetchRequestStatus status, |
106 const std::vector<RenderPageInfo>& pages)>; | 109 const std::vector<RenderPageInfo>& pages)>; |
107 | 110 |
| 111 // Holds information about a new URL to be prefetched. |
| 112 struct PrefetchURL { |
| 113 PrefetchURL(const ClientId& client_id, const GURL& url) |
| 114 : client_id(client_id), url(url) {} |
| 115 |
| 116 // Client provided ID to allow the matching of URLs to the respective work |
| 117 // item in the prefetching system. It can be anything useful to identify the |
| 118 // page . It will not be used internally for de-duplication. |
| 119 ClientId client_id; |
| 120 |
| 121 // This URL will be prefetched by the service. |
| 122 GURL url; |
| 123 }; |
| 124 |
108 } // namespace offline_pages | 125 } // namespace offline_pages |
109 | 126 |
110 #endif // COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_TYPES_H_ | 127 #endif // COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_TYPES_H_ |
OLD | NEW |