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 "url/gurl.h" | |
11 | 13 |
12 namespace offline_pages { | 14 namespace offline_pages { |
13 | 15 |
14 // Status for sending prefetch request to the server. | 16 // Status for sending prefetch request to the server. |
15 enum class PrefetchRequestStatus { | 17 enum class PrefetchRequestStatus { |
16 // Request completed successfully. | 18 // Request completed successfully. |
17 SUCCESS, | 19 SUCCESS, |
18 // 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 |
19 // 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 |
20 // WiFi window after 15 minutes have passed. | 22 // WiFi window after 15 minutes have passed. |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
98 enum class PrefetchItemErrorCode { | 100 enum class PrefetchItemErrorCode { |
99 SUCCESS, | 101 SUCCESS, |
100 EXPIRED, | 102 EXPIRED, |
101 }; | 103 }; |
102 | 104 |
103 // Callback invoked upon completion of a prefetch request. | 105 // Callback invoked upon completion of a prefetch request. |
104 using PrefetchRequestFinishedCallback = | 106 using PrefetchRequestFinishedCallback = |
105 base::Callback<void(PrefetchRequestStatus status, | 107 base::Callback<void(PrefetchRequestStatus status, |
106 const std::vector<RenderPageInfo>& pages)>; | 108 const std::vector<RenderPageInfo>& pages)>; |
107 | 109 |
110 // Holds information about a new URL to be prefetched. | |
111 struct PrefetchURL { | |
112 PrefetchURL(const std::string& client_id, const GURL& url) | |
113 : client_id(client_id), url(url) {} | |
114 | |
115 // Client provided ID to allow the matching of URLs to the respective work | |
116 // item in the prefetching system. It can be anything useful to identify the | |
117 // page . It will not be used internally for de-duplication. | |
118 std::string client_id; | |
fgorski
2017/05/30 17:21:45
You are overloading the term Client ID.
Is that in
carlosk
2017/06/01 01:49:59
It would have the same objective as the existing C
| |
119 | |
120 // This URL will be prefetched by the service. | |
121 GURL url; | |
122 }; | |
123 | |
108 } // namespace offline_pages | 124 } // namespace offline_pages |
109 | 125 |
110 #endif // COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_TYPES_H_ | 126 #endif // COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_TYPES_H_ |
OLD | NEW |