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

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

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

Powered by Google App Engine
This is Rietveld 408576698