Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Side by Side Diff: content/common/push_messaging.mojom

Issue 2690203003: Convert push_messaging IPC msgs into mojo interfaces (Closed)
Patch Set: code rebase Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « content/common/content_message_generator.h ('k') | content/common/push_messaging.typemap » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 module content.mojom;
6
7 import "url/mojo/url.mojom";
8
9 // TODO(heke): The type-mapping struct and enums are duplicately defined. Need
10 // to remove/replace those defined in content or blink namespace.
11
12 struct PushSubscriptionOptions {
13 bool user_visible_only;
14 string sender_info;
15 };
16
17 // Push registration success/error codes for internal use & reporting in UMA.
18 // Enum values can be added, but must never be renumbered or deleted and reused.
19 enum PushRegistrationStatus {
20 // New successful registration (there was not yet a registration cached in
21 // Service Worker storage, so the browser successfully registered with the
22 // push service. This is likely to be a new push registration, though it's
23 // possible that the push service had its own cache (for example if Chrome's
24 // app data was cleared, we might have forgotten about a registration that the
25 // push service still stores).
26 SUCCESS_FROM_PUSH_SERVICE = 0,
27
28 // Registration failed because there is no Service Worker.
29 NO_SERVICE_WORKER = 1,
30
31 // Registration failed because the push service is not available.
32 SERVICE_NOT_AVAILABLE = 2,
33
34 // Registration failed because the maximum number of registratons has been
35 // reached.
36 LIMIT_REACHED = 3,
37
38 // Registration failed because permission was denied.
39 PERMISSION_DENIED = 4,
40
41 // Registration failed in the push service implemented by the embedder.
42 SERVICE_ERROR = 5,
43
44 // Registration failed because no sender id was provided by the page.
45 NO_SENDER_ID = 6,
46
47 // Registration succeeded, but we failed to persist it.
48 STORAGE_ERROR = 7,
49
50 // A successful registration was already cached in Service Worker storage.
51 SUCCESS_FROM_CACHE = 8,
52
53 // Registration failed due to a network error.
54 NETWORK_ERROR = 9,
55
56 // Registration failed because the push service is not available in incognito,
57 // but we tell JS that permission was denied to not reveal incognito.
58 INCOGNITO_PERMISSION_DENIED = 10,
59
60 // Registration failed because the public key could not be retrieved.
61 PUBLIC_KEY_UNAVAILABLE = 11,
62
63 // Registration failed because the manifest could not be retrieved or was
64 // empty.
65 MANIFEST_EMPTY_OR_MISSING = 12,
66
67 // Registration failed because a subscription with a different sender id
68 // already exists.
69 SENDER_ID_MISMATCH = 13,
70
71 // NOTE: Do not renumber these as that would confuse interpretation of
72 // previously logged data. When making changes, also update the enum list
73 // in tools/metrics/histograms/histograms.xml to keep it in sync, and
74 // update LAST below.
75
76 LAST = SENDER_ID_MISMATCH
77 };
78
79 enum PushErrorType {
80 ABORT = 0,
81 NETWORK = 1,
82 NOT_ALLOWED = 2,
83 NOT_FOUND = 3,
84 NOT_SUPPORTED = 4,
85 UNKNOWN = 5,
86 INVALID_STATE = 6,
87 LAST = INVALID_STATE
88 };
89
90 // Push getregistration success/error codes for internal use & reporting in UMA.
91 // Enum values can be added, but must never be renumbered or deleted and reused.
92 enum PushGetRegistrationStatus {
93 // Getting the registration was successful.
94 SUCCESS = 0,
95
96 // Getting the registration failed because the push service is not available.
97 SERVICE_NOT_AVAILABLE = 1,
98
99 // Getting the registration failed because we failed to read from storage.
100 STORAGE_ERROR = 2,
101
102 // Getting the registration failed because there is no push registration.
103 REGISTRATION_NOT_FOUND = 3,
104
105 // Getting the registration failed because the push service isn't available in
106 // incognito, but we tell JS registration not found to not reveal incognito.
107 INCOGNITO_REGISTRATION_NOT_FOUND = 4,
108
109 // Registration failed because the public key could not be retrieved.
110 PUBLIC_KEY_UNAVAILABLE = 5,
111
112 // NOTE: Do not renumber these as that would confuse interpretation of
113 // previously logged data. When making changes, also update the enum list
114 // in tools/metrics/histograms/histograms.xml to keep it in sync, and
115 // update LAST below.
116
117 LAST = PUBLIC_KEY_UNAVAILABLE
118 };
119
120 enum PushPermissionStatus {
121 GRANTED = 0,
122 DENIED = 1,
123 PROMPT = 2,
124 LAST = PROMPT
125 };
126
127 interface PushMessaging {
128 Subscribe(int32 render_frame_id,
129 int64 service_worker_registration_id,
130 PushSubscriptionOptions options)
131 => (PushRegistrationStatus status,
132 url.mojom.Url? endpoint,
133 PushSubscriptionOptions? options,
134 array<uint8>? p256dh,
135 array<uint8>? auth);
136
137 // It returns |did_unsubscribe| if is_success is true, and returns
138 // |error_type| and |error_message| if is_success is false.
139 Unsubscribe(int64 service_worker_registration_id)
140 => (bool is_success,
141 bool did_unsubscribe,
142 PushErrorType error_type,
143 string? error_message);
144
145 GetSubscription(int64 service_worker_registration_id)
146 => (PushGetRegistrationStatus status,
147 url.mojom.Url? endpoint,
148 PushSubscriptionOptions? options,
149 array<uint8>? p256dh,
150 array<uint8>? auth);
151
152 // It returns |status| if |is_success| is true and returns |error| if
153 // |is_success| is false.
154 GetPermissionStatus(int64 service_worker_registration_id,
155 bool user_visible)
156 => (bool is_success,
157 // |status| is meaningful when (is_success == true)
158 PushPermissionStatus status,
159 // |error| is meaningful when (is_success == false)
160 PushErrorType error);
161 };
OLDNEW
« no previous file with comments | « content/common/content_message_generator.h ('k') | content/common/push_messaging.typemap » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698