// Copyright 2017 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. module content.mojom; import "content/public/common/push_messaging_status.mojom"; import "url/mojom/url.mojom"; // TODO(heke): The type-mapping struct and enums are duplicately defined. Need // to remove/replace those defined in content or blink namespace. struct PushSubscriptionOptions { bool user_visible_only; string sender_info; }; enum PushErrorType { ABORT = 0, NETWORK = 1, NONE = 2, NOT_ALLOWED = 3, NOT_FOUND = 4, NOT_SUPPORTED = 5, INVALID_STATE = 6, }; interface PushMessaging { Subscribe(int32 render_frame_id, int64 service_worker_registration_id, PushSubscriptionOptions options, bool user_gesture) => (PushRegistrationStatus status, url.mojom.Url? endpoint, PushSubscriptionOptions? options, array? p256dh, array? auth); // We use the value of |error_type| as a flag. If |error_type| == NONE, it // means no error and returns |did_unsubscribe|. Else, it means there is an // error and returns |error_type| and |error_message|. Unsubscribe(int64 service_worker_registration_id) => (PushErrorType error_type, bool did_unsubscribe, string? error_message); GetSubscription(int64 service_worker_registration_id) => (PushGetRegistrationStatus status, url.mojom.Url? endpoint, PushSubscriptionOptions? options, array? p256dh, array? auth); };