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 "base/macros.h" | 8 #include <string> |
| 9 |
9 #include "base/time/time.h" | 10 #include "base/time/time.h" |
10 | 11 |
| 12 #include "url/gurl.h" |
| 13 |
11 namespace offline_pages { | 14 namespace offline_pages { |
12 | 15 |
13 // Status for sending prefetch request to the server. | 16 // Status for sending prefetch request to the server. |
14 enum class PrefetchRequestStatus { | 17 enum class PrefetchRequestStatus { |
15 // Request completed successfully. | 18 // Request completed successfully. |
16 SUCCESS, | 19 SUCCESS, |
17 // Request failed due to to local network problem, unrelated to server load | 20 // Request failed due to to local network problem, unrelated to server load |
18 // levels. The caller will simply reschedule the retry in the next available | 21 // levels. The caller will simply reschedule the retry in the next available |
19 // WiFi window after 15 minutes have passed. | 22 // WiFi window after 15 minutes have passed. |
20 SHOULD_RETRY_WITHOUT_BACKOFF, | 23 SHOULD_RETRY_WITHOUT_BACKOFF, |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 ZOMBIE, | 95 ZOMBIE, |
93 }; | 96 }; |
94 | 97 |
95 // Error codes used to identify the reason why a prefetch item has finished | 98 // Error codes used to identify the reason why a prefetch item has finished |
96 // processing. | 99 // processing. |
97 enum class PrefetchItemErrorCode { | 100 enum class PrefetchItemErrorCode { |
98 SUCCESS, | 101 SUCCESS, |
99 EXPIRED, | 102 EXPIRED, |
100 }; | 103 }; |
101 | 104 |
| 105 // Holds information about a new URL to be prefetched. |
| 106 struct PrefetchURL { |
| 107 PrefetchURL(const std::string& client_id, const GURL& url) |
| 108 : client_id(client_id), url(url) {} |
| 109 |
| 110 // Client provided ID to allow the matching of URLs to the respective work |
| 111 // item in the prefetching system. It can be anything useful to identify the |
| 112 // page . It will not be used internally for de-duplication. |
| 113 std::string client_id; |
| 114 |
| 115 // This URL will be prefetched by the service. |
| 116 GURL url; |
| 117 }; |
| 118 |
102 } // namespace offline_pages | 119 } // namespace offline_pages |
103 | 120 |
104 #endif // COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_TYPES_H_ | 121 #endif // COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_TYPES_H_ |
OLD | NEW |