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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationSettingsBridge.java

Issue 2886433002: [Android] Adding content settings provider for notification channels (Closed)
Patch Set: Added unit tests (refactored out a class for jni calls) Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationSettingsBridge.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationSettingsBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationSettingsBridge.java
new file mode 100644
index 0000000000000000000000000000000000000000..5546b6ee984e335e6408034f537d052cb0bbc3a9
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationSettingsBridge.java
@@ -0,0 +1,44 @@
+// 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.
+
+package org.chromium.chrome.browser.notifications;
+
+import org.chromium.base.BuildInfo;
+import org.chromium.base.annotations.CalledByNative;
+
+/**
+ * Interface for native code to interact with Android notification channels.
+ */
+public class NotificationSettingsBridge {
+ // TODO(awdf): Remove this and check BuildInfo.sdk_int() from native instead, once SdkVersion
+ // enum includes Android O.
+ @CalledByNative
+ static boolean shouldUseChannelSettings() {
+ return BuildInfo.isAtLeastO();
+ }
+
+ /**
+ * Creates a notification channel for the given origin.
+ * @param origin The site origin to be used as the channel name.
+ * @param enabled True if the channel should be initially enabled, false if
+ * it should start off as blocked.
+ * @return true if the channel was successfully created, false otherwise.
+ */
+ @CalledByNative
+ static boolean createChannel(String origin, boolean enabled) {
+ // TODO(crbug.com/700377) Actually construct a channel.
+ return false;
+ }
+
+ @CalledByNative
+ static @NotificationChannelStatus int getChannelStatus(String origin) {
+ // TODO(crbug.com/700377) Actually check channel status.
+ return NotificationChannelStatus.UNAVAILABLE;
+ }
+
+ @CalledByNative
+ static void deleteChannel(String origin) {
+ // TODO(crbug.com/700377) Actually delete channel.
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698