summaryrefslogtreecommitdiff
path: root/chromium/components/webapk/webapk.proto
blob: 77a790b6a8212ee42105ed5571c9130383f19a0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
// Copyright 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

syntax = "proto2";

option optimize_for = LITE_RUNTIME;

package webapk;

// Response after creating or updating a WebAPK.
message WebApkResponse {
  // Package name to install WebAPK at.
  optional string package_name = 1;

  // Version code of the WebAPK.
  optional string version = 2;

  // Unique id identifying session with WebAPK server.
  optional string token = 6;

  // This flag may be used, for example, if the WebAPK server is unable to
  // fulfill an update request and likely won't be able to fulfill subsequent
  // update requests from this WebAPK. One case where the server is unable to
  // fulfill update requests is if the Web Manifest is dynamically generated
  // based on the user's country etc. Therefore, we want the client to back off
  // from spamming update requests too often.
  optional bool relax_updates = 8;

  reserved 3, 4, 5, 7;
}

// Sent as part of request to create or update a WebAPK.
message WebApk {
  enum UpdateReason {
    NONE = 1;
    OLD_SHELL_APK = 2;
    PRIMARY_ICON_HASH_DIFFERS = 3;
    SCOPE_DIFFERS = 5;
    START_URL_DIFFERS = 6;
    SHORT_NAME_DIFFERS = 7;
    NAME_DIFFERS = 8;
    BACKGROUND_COLOR_DIFFERS = 9;
    THEME_COLOR_DIFFERS = 10;
    ORIENTATION_DIFFERS = 11;
    DISPLAY_MODE_DIFFERS = 12;
    WEB_SHARE_TARGET_DIFFERS = 13;
    MANUALLY_TRIGGERED = 14;
    PRIMARY_ICON_MASKABLE_DIFFERS = 15;
    SHORTCUTS_DIFFER = 16;
    SPLASH_ICON_HASH_DIFFERS = 17;

    reserved 4;
  }

  // Package name of the WebAPK.
  optional string package_name = 1;

  // Version code of the WebAPK.
  optional string version = 2;

  // The URL of the Web App Manifest.
  optional string manifest_url = 3;

  // Chrome's package name.
  optional string requester_application_package = 5;

  // Chrome's version.
  optional string requester_application_version = 6;

  // The Web App Manifest.
  optional WebAppManifest manifest = 7;

  // The cpu abi of the browser making the request.
  optional string android_abi = 8;

  // If set true, this flag indicates that the Web App Manifest of the site is
  // no longer available.
  optional bool stale_manifest = 9;

  // A list of all reasons why the WebAPK needs to be updated.
  repeated UpdateReason update_reasons = 11;

  // The Android OS version (e.g '11').
  optional string android_version = 12;

  // Whether this builds supports app identity updates via dialog.
  optional bool app_identity_update_supported = 13;

  reserved 4, 10;
}

// Contains data from the Web App Manifest.
message WebAppManifest {
  optional string name = 1;
  optional string short_name = 2;
  optional string start_url = 4;
  repeated string scopes = 5;
  repeated Image icons = 6;
  optional string orientation = 9;
  optional string display_mode = 10;
  optional string theme_color = 11;
  optional string background_color = 12;
  repeated ShareTarget share_targets = 17;
  repeated ShortcutItem shortcuts = 18;

  reserved 3, 7, 8, 13 to 16;
}

message Image {
  enum Usage {
    PRIMARY_ICON = 1;
    BADGE_ICON = 2;
    SPLASH_ICON = 3;
  }

  // Image's URL.
  optional string src = 1;

  // Murmur2 hash of the icon's bytes. There should not be any transformations
  // applied to the icon's bytes prior to taking the Murmur2 hash.
  optional string hash = 5;

  // Actual bytes of the image. This image may be re-encoded from the original
  // image and may not match the murmur2 hash field above.
  optional bytes image_data = 6;

  // Possible purposes that an icon can be used for.
  enum Purpose {
    // Missing purpose.
    PURPOSE_UNDEFINED = 0;
    // The icon can be displayed in any context.
    ANY = 1;

    // The icon can be used where a monochrome icon with a solid fill is needed.
    // MONOCHROME = 2; This is not currently used, so ignore it.

    // The icon is designed with the intention to be masked.
    MASKABLE = 3;

    reserved 2;
  }

  // The purposes this image may be used for.
  repeated Purpose purposes = 7;

  // Specifies Chrome's intended usages for the image.
  repeated Usage usages = 8;

  reserved 2, 3, 4, 9;
}

// A proto representing a ShareTargetParamsFile
// https://wicg.github.io/web-share-target/level-2/#sharetargetfiles-and-its-members
message ShareTargetParamsFile {
  optional string name = 1;
  repeated string accept = 2;
}

// A proto representing ShareTargetParams
// https://wicg.github.io/web-share-target/#dom-sharetargetparams
// Each field corresponds to key in ShareData. These are the query parameter
// keys to be used for the data supplied in a ShareData instance.
// ShareData: https://w3c.github.io/web-share#dom-sharedata
message ShareTargetParams {
  optional string title = 1;
  optional string text = 2;
  optional string url = 3;
  repeated ShareTargetParamsFile files = 4;
}

// A proto representing a ShareTarget.
// https://wicg.github.io/web-share-target/#dom-sharetarget
message ShareTarget {
  // The URL to be resolved when sharing.
  optional string action = 2;
  optional ShareTargetParams params = 3;
  optional string method = 4;
  optional string enctype = 5;
  reserved 1;
}

message ShortcutItem {
  optional string name = 1;
  optional string short_name = 2;
  optional string url = 3;
  repeated Image icons = 4;
}