blob: 7966268f95eee39d318e2299edd5415f75e241fc [file] [log] [blame]
ke.he5f426e322017-02-22 12:37:121// 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
5module content.mojom;
6
Peter Beverloo7815db1e02017-07-12 19:03:217import "content/public/common/push_messaging_status.mojom";
Daniel Cheng7a059b02018-02-03 10:04:138import "url/mojom/url.mojom";
ke.he5f426e322017-02-22 12:37:129
10// TODO(heke): The type-mapping struct and enums are duplicately defined. Need
11// to remove/replace those defined in content or blink namespace.
12
13struct PushSubscriptionOptions {
14 bool user_visible_only;
15 string sender_info;
16};
17
ke.he5f426e322017-02-22 12:37:1218enum PushErrorType {
19 ABORT = 0,
20 NETWORK = 1,
ke.hedc9d2cf2017-02-28 05:07:3321 NONE = 2,
22 NOT_ALLOWED = 3,
23 NOT_FOUND = 4,
24 NOT_SUPPORTED = 5,
ke.he5f426e322017-02-22 12:37:1225 INVALID_STATE = 6,
ke.he5f426e322017-02-22 12:37:1226};
27
ke.he5f426e322017-02-22 12:37:1228interface PushMessaging {
29 Subscribe(int32 render_frame_id,
30 int64 service_worker_registration_id,
dominickn6ba3fa622017-06-16 06:14:4631 PushSubscriptionOptions options,
32 bool user_gesture)
ke.he5f426e322017-02-22 12:37:1233 => (PushRegistrationStatus status,
34 url.mojom.Url? endpoint,
35 PushSubscriptionOptions? options,
36 array<uint8>? p256dh,
37 array<uint8>? auth);
38
ke.hedc9d2cf2017-02-28 05:07:3339 // We use the value of |error_type| as a flag. If |error_type| == NONE, it
40 // means no error and returns |did_unsubscribe|. Else, it means there is an
41 // error and returns |error_type| and |error_message|.
ke.he5f426e322017-02-22 12:37:1242 Unsubscribe(int64 service_worker_registration_id)
ke.hedc9d2cf2017-02-28 05:07:3343 => (PushErrorType error_type,
ke.he5f426e322017-02-22 12:37:1244 bool did_unsubscribe,
ke.he5f426e322017-02-22 12:37:1245 string? error_message);
46
47 GetSubscription(int64 service_worker_registration_id)
48 => (PushGetRegistrationStatus status,
49 url.mojom.Url? endpoint,
50 PushSubscriptionOptions? options,
51 array<uint8>? p256dh,
52 array<uint8>? auth);
ke.he5f426e322017-02-22 12:37:1253};