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

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

Issue 2715903002: Re-design Unsubscribe and getPermissionStatus mojo interfaces. (Closed)
Patch Set: Re-design Unsubscribe and getPermissionStatus mojo interfaces. 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
OLDNEW
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 module content.mojom; 5 module content.mojom;
6 6
7 import "url/mojo/url.mojom"; 7 import "url/mojo/url.mojom";
8 8
9 // TODO(heke): The type-mapping struct and enums are duplicately defined. Need 9 // TODO(heke): The type-mapping struct and enums are duplicately defined. Need
10 // to remove/replace those defined in content or blink namespace. 10 // to remove/replace those defined in content or blink namespace.
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 // previously logged data. When making changes, also update the enum list 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 73 // in tools/metrics/histograms/histograms.xml to keep it in sync, and
74 // update LAST below. 74 // update LAST below.
75 75
76 LAST = SENDER_ID_MISMATCH 76 LAST = SENDER_ID_MISMATCH
77 }; 77 };
78 78
79 enum PushErrorType { 79 enum PushErrorType {
80 ABORT = 0, 80 ABORT = 0,
81 NETWORK = 1, 81 NETWORK = 1,
82 NOT_ALLOWED = 2, 82 NONE = 2,
83 NOT_FOUND = 3, 83 NOT_ALLOWED = 3,
84 NOT_SUPPORTED = 4, 84 NOT_FOUND = 4,
85 UNKNOWN = 5, 85 NOT_SUPPORTED = 5,
86 INVALID_STATE = 6, 86 INVALID_STATE = 6,
87 LAST = INVALID_STATE 87 LAST = INVALID_STATE
88 }; 88 };
89 89
90 // Push getregistration success/error codes for internal use & reporting in UMA. 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. 91 // Enum values can be added, but must never be renumbered or deleted and reused.
92 enum PushGetRegistrationStatus { 92 enum PushGetRegistrationStatus {
93 // Getting the registration was successful. 93 // Getting the registration was successful.
94 SUCCESS = 0, 94 SUCCESS = 0,
95 95
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 interface PushMessaging { 127 interface PushMessaging {
128 Subscribe(int32 render_frame_id, 128 Subscribe(int32 render_frame_id,
129 int64 service_worker_registration_id, 129 int64 service_worker_registration_id,
130 PushSubscriptionOptions options) 130 PushSubscriptionOptions options)
131 => (PushRegistrationStatus status, 131 => (PushRegistrationStatus status,
132 url.mojom.Url? endpoint, 132 url.mojom.Url? endpoint,
133 PushSubscriptionOptions? options, 133 PushSubscriptionOptions? options,
134 array<uint8>? p256dh, 134 array<uint8>? p256dh,
135 array<uint8>? auth); 135 array<uint8>? auth);
136 136
137 // It returns |did_unsubscribe| if is_success is true, and returns 137 // We use the value of |error_type| as a flag. If |error_type| == NONE, it
138 // |error_type| and |error_message| if is_success is false. 138 // means no error and returns |did_unsubscribe|. Else, it means there is an
139 // error and returns |error_type| and |error_message|.
139 Unsubscribe(int64 service_worker_registration_id) 140 Unsubscribe(int64 service_worker_registration_id)
140 => (bool is_success, 141 => (PushErrorType error_type,
141 bool did_unsubscribe, 142 bool did_unsubscribe,
142 PushErrorType error_type,
143 string? error_message); 143 string? error_message);
144 144
145 GetSubscription(int64 service_worker_registration_id) 145 GetSubscription(int64 service_worker_registration_id)
146 => (PushGetRegistrationStatus status, 146 => (PushGetRegistrationStatus status,
147 url.mojom.Url? endpoint, 147 url.mojom.Url? endpoint,
148 PushSubscriptionOptions? options, 148 PushSubscriptionOptions? options,
149 array<uint8>? p256dh, 149 array<uint8>? p256dh,
150 array<uint8>? auth); 150 array<uint8>? auth);
151 151
152 // It returns |status| if |is_success| is true and returns |error| if 152 // We use the value of |error_type| as a flag. If |error_type| == NONE, it
153 // |is_success| is false. 153 // means no error and returns |status|. Else, it means there is an error and
154 // returns |error_type|.
154 GetPermissionStatus(int64 service_worker_registration_id, 155 GetPermissionStatus(int64 service_worker_registration_id,
155 bool user_visible) 156 bool user_visible)
156 => (bool is_success, 157 => (PushErrorType error_type,
157 // |status| is meaningful when (is_success == true) 158 PushPermissionStatus status);
158 PushPermissionStatus status,
159 // |error| is meaningful when (is_success == false)
160 PushErrorType error);
161 }; 159 };
OLDNEW
« no previous file with comments | « content/child/push_messaging/push_provider.cc ('k') | content/common/push_messaging_param_traits.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698