-
Notifications
You must be signed in to change notification settings - Fork 6.6k
/
PushMessagingServiceBridge.java
47 lines (40 loc) · 1.62 KB
/
PushMessagingServiceBridge.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
package org.chromium.chrome.browser.notifications;
import org.chromium.base.annotations.NativeMethods;
/**
* Provides the ability for the PushMessagingServiceImpl to revoke Notifications permission.
*
* This class should only be used on the UI thread.
*/
public class PushMessagingServiceBridge {
private static PushMessagingServiceBridge sInstance;
/**
* Returns the current instance of the PushMessagingServiceBridge.
*
* @return The instance of the PushMessagingServiceBridge.
*/
static PushMessagingServiceBridge getInstance() {
if (sInstance == null) {
sInstance = new PushMessagingServiceBridge();
}
return sInstance;
}
/**
* Verifies if Notifications permission should be revoked for an origin.
*
* @param origin Full text of the origin, including the protocol, owning this notification.
* @param profileId Id of the profile that showed the notification.
* @param appLevelNotificationsEnabled Whether Chrome has app-level Notifications permission.
*/
public void verify(String origin, String profileId, boolean appLevelNotificationsEnabled) {
PushMessagingServiceBridgeJni.get().verifyAndRevokeNotificationsPermission(
origin, profileId, appLevelNotificationsEnabled);
}
@NativeMethods
interface Natives {
void verifyAndRevokeNotificationsPermission(
String origin, String profileId, boolean appLevelNotificationsEnabled);
}
}