| 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 syntax = "proto3"; | 5 syntax = "proto2"; |
| 6 option optimize_for = LITE_RUNTIME; | 6 option optimize_for = LITE_RUNTIME; |
| 7 | 7 |
| 8 package offline_pages.proto; | 8 package offline_pages.proto; |
| 9 | 9 |
| 10 import "status.proto"; | 10 import "status.proto"; |
| 11 import "timestamp.proto"; | |
| 12 | 11 |
| 13 // Type of transformation applied to a web page. | 12 // Type of transformation applied to a web page. |
| 14 enum Transformation { | 13 enum Transformation { |
| 15 // Transformation not specified. | 14 // Transformation not specified. |
| 16 TRANSFORMATION_UNSPECIFIED = 0; | 15 TRANSFORMATION_UNSPECIFIED = 0; |
| 17 // Minimal transformation required to provide an offline-accessible web page. | 16 // Minimal transformation required to provide an offline-accessible web page. |
| 18 NO_TRANSFORMATION = 1; | 17 NO_TRANSFORMATION = 1; |
| 19 } | 18 } |
| 20 | 19 |
| 21 // Page package format. | 20 // Page package format. |
| 22 enum OutputFormat { | 21 enum OutputFormat { |
| 23 // Format not specified. | 22 // Format not specified. |
| 24 FORMAT_UNSPECIFIED = 0; | 23 FORMAT_UNSPECIFIED = 0; |
| 25 // An MHTML archive containing a single web page. | 24 // An MHTML archive containing a single web page. |
| 26 FORMAT_MHTML = 1; | 25 FORMAT_MHTML = 1; |
| 27 } | 26 } |
| 28 | 27 |
| 28 message Timestamp { |
| 29 // Represents seconds of UTC time since Unix epoch |
| 30 // 1970-01-01T00:00:00Z. Must be from 0001-01-01T00:00:00Z to |
| 31 // 9999-12-31T23:59:59Z inclusive. |
| 32 optional int64 seconds = 1; |
| 33 |
| 34 // Non-negative fractions of a second at nanosecond resolution. Negative |
| 35 // second values with fractions must still have non-negative nanos values |
| 36 // that count forward in time. Must be from 0 to 999,999,999 |
| 37 // inclusive. |
| 38 optional int32 nanos = 2; |
| 39 } |
| 40 |
| 29 // Response to the GeneratePageBundle request. | 41 // Response to the GeneratePageBundle request. |
| 30 message PageBundle { | 42 message PageBundle { |
| 31 // The list of archives in the bundle. The distribution of pages into archives | 43 // The list of archives in the bundle. The distribution of pages into archives |
| 32 // is arbitrary. | 44 // is arbitrary. |
| 33 repeated Archive archives = 1; | 45 repeated Archive archives = 1; |
| 34 } | 46 } |
| 35 | 47 |
| 36 // A resource containing one or more serialized offline pages. | 48 // A resource containing one or more serialized offline pages. |
| 37 message Archive { | 49 message Archive { |
| 38 // Information about the individual page(s) used to create the Archive. | 50 // Information about the individual page(s) used to create the Archive. |
| 39 // There will be one PageInfo message for every page in the archive, including | 51 // There will be one PageInfo message for every page in the archive, including |
| 40 // those that encountered an error or were elided due to size considerations. | 52 // those that encountered an error or were elided due to size considerations. |
| 41 repeated PageInfo page_infos = 1; | 53 repeated PageInfo page_infos = 1; |
| 42 // Format of the body. | 54 // Format of the body. |
| 43 OutputFormat output_format = 2; | 55 optional OutputFormat output_format = 2; |
| 44 // Resource name for the body which can be read via the ByteStream API. | 56 // Resource name for the body which can be read via the ByteStream API. |
| 45 // This resource will remain available for a minimum of 24 hours after the | 57 // This resource will remain available for a minimum of 24 hours after the |
| 46 // GeneratePageBundle request. | 58 // GeneratePageBundle request. |
| 47 string body_name = 3; | 59 optional string body_name = 3; |
| 48 // Length of the body in bytes. | 60 // Length of the body in bytes. |
| 49 int64 body_length = 4; | 61 optional int64 body_length = 4; |
| 50 } | 62 } |
| 51 | 63 |
| 52 // Information about a single returned offline page. | 64 // Information about a single returned offline page. |
| 53 message PageInfo { | 65 message PageInfo { |
| 54 // The URL of the page that was rendered. | 66 // The URL of the page that was rendered. |
| 55 string url = 1; | 67 optional string url = 1; |
| 56 // The final URL after redirects. Empty if the final URL is url. | 68 // The final URL after redirects. Empty if the final URL is url. |
| 57 string redirect_url = 2; | 69 optional string redirect_url = 2; |
| 58 // Status of the render attempt. If status.code != OK, fields below this will | 70 // Status of the render attempt. If status.code != OK, fields below this will |
| 59 // be unset. If the operation is still running, status is NotFound to | 71 // be unset. If the operation is still running, status is NotFound to |
| 60 // indicate the page is still being processed. | 72 // indicate the page is still being processed. |
| 61 // If the page was not returned due to bundle size limits, status is | 73 // If the page was not returned due to bundle size limits, status is |
| 62 // FailedPrecondition. If the page failed to render for any other reason, | 74 // FailedPrecondition. If the page failed to render for any other reason, |
| 63 // status is Unknown. | 75 // status is Unknown. |
| 64 Status status = 3; | 76 optional Status status = 3; |
| 65 // Transformation that was applied to the page. | 77 // Transformation that was applied to the page. |
| 66 Transformation transformation = 4; | 78 optional Transformation transformation = 4; |
| 67 // Time the page was rendered. | 79 // Time the page was rendered. |
| 68 Timestamp render_time = 5; | 80 optional Timestamp render_time = 5; |
| 69 } | 81 } |
| 70 | 82 |
| 71 // Request to return a list of pages in a format suitable for offline viewing. | 83 // Request to return a list of pages in a format suitable for offline viewing. |
| 72 message GeneratePageBundleRequest { | 84 message GeneratePageBundleRequest { |
| 73 // The client's browser's user agent string. | 85 // The client's browser's user agent string. |
| 74 string user_agent = 1; | 86 optional string user_agent = 1; |
| 75 // Preferred browser language(s) as defined by | 87 // Preferred browser language(s) as defined by |
| 76 // [IETF BCP 47](https://tools.ietf.org/html/bcp47). | 88 // [IETF BCP 47](https://tools.ietf.org/html/bcp47). |
| 77 repeated string browser_languages = 2; | 89 repeated string browser_languages = 2; |
| 78 // Desired format of the web page archive(s). | 90 // Desired format of the web page archive(s). |
| 79 OutputFormat output_format = 3; | 91 optional OutputFormat output_format = 3; |
| 80 // Maximum size of the generated body. If all pages' output would exceed this | 92 // Maximum size of the generated body. If all pages' output would exceed this |
| 81 // size, only the first N pages are returned. | 93 // size, only the first N pages are returned. |
| 82 int64 max_bundle_size_bytes = 4; | 94 optional int64 max_bundle_size_bytes = 4; |
| 83 // The GCM registration ID that can be used to inform the client | 95 // The GCM registration ID that can be used to inform the client |
| 84 // of LRO completion. | 96 // of LRO completion. |
| 85 string gcm_registration_id = 5; | 97 optional string gcm_registration_id = 5; |
| 86 // List of individual page requests, in order of priority. At most 100 pages | 98 // List of individual page requests, in order of priority. At most 100 pages |
| 87 // may be requested at a time. | 99 // may be requested at a time. |
| 88 repeated PageParameters pages = 6; | 100 repeated PageParameters pages = 6; |
| 89 } | 101 } |
| 90 | 102 |
| 91 // Request a set of pages to be returned in a format suitable for offline | 103 // Request a set of pages to be returned in a format suitable for offline |
| 92 // viewing. | 104 // viewing. |
| 93 message PageParameters { | 105 message PageParameters { |
| 94 // URL of the web page to return. | 106 // URL of the web page to return. |
| 95 string url = 1; | 107 optional string url = 1; |
| 96 // Transformation to apply. Must not be TRANSFORMATION_UNSPECIFIED. | 108 // Transformation to apply. Must not be TRANSFORMATION_UNSPECIFIED. |
| 97 Transformation transformation = 2; | 109 optional Transformation transformation = 2; |
| 98 } | 110 } |
| OLD | NEW |