OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_TYPES_H_ |
| 6 #define COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_TYPES_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "base/time/time.h" |
| 10 |
| 11 namespace offline_pages { |
| 12 |
| 13 // Status for sending prefetch request to the server. |
| 14 enum class PrefetchRequestStatus { |
| 15 // Request completed successfully. |
| 16 SUCCESS, |
| 17 // 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 |
| 19 // WiFi window after 15 minutes have passed. |
| 20 SHOULD_RETRY_WITHOUT_BACKOFF, |
| 21 // Request failed probably related to transient server problems. The caller |
| 22 // will reschedule the retry with backoff included. |
| 23 SHOULD_RETRY_WITH_BACKOFF, |
| 24 // Request failed with error indicating that the server no longer knows how |
| 25 // to service a request. The caller will prevent network requests for the |
| 26 // period of 1 day. |
| 27 SHOULD_SUSPEND |
| 28 }; |
| 29 |
| 30 // Status indicating the page rendering status in the server. |
| 31 enum class RenderStatus { |
| 32 // The page is rendered. |
| 33 RENDERED, |
| 34 // The page is still being processed. |
| 35 PENDING, |
| 36 // The page failed to render. |
| 37 FAILED, |
| 38 // Failed due to bundle size limits. |
| 39 EXCEEDED_LIMIT |
| 40 }; |
| 41 |
| 42 // Information about the page rendered in the server. |
| 43 struct RenderPageInfo { |
| 44 RenderPageInfo(); |
| 45 RenderPageInfo(const RenderPageInfo& other); |
| 46 |
| 47 // The URL of the page that was rendered. |
| 48 std::string url; |
| 49 // The final URL after redirects. Empty if the final URL is url. |
| 50 std::string redirect_url; |
| 51 // Status of the render attempt. |
| 52 RenderStatus status = RenderStatus::FAILED; |
| 53 // Resource name for the body which can be read via the ByteStream API. |
| 54 // Set only when |status| is RENDERED. |
| 55 std::string body_name; |
| 56 // Length of the body in bytes. Set only when |status| is RENDERED. |
| 57 int64_t body_length = 0LL; |
| 58 // Time the page was rendered. Set only when |status| is RENDERED. |
| 59 base::Time render_time; |
| 60 }; |
| 61 |
| 62 } // namespace offline_pages |
| 63 |
| 64 #endif // COMPONENTS_OFFLINE_PAGES_CORE_PREFETCH_PREFETCH_TYPES_H_ |
OLD | NEW |