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

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

Issue 1919183003: Rename NotificationUIManager to NotificationPlatformBridge (1/2) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/NotificationPlatformBridge.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationUIManager.java b/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridge.java
similarity index 92%
rename from chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationUIManager.java
rename to chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridge.java
index 7d61b3b69cf65cb46bd96448a5bd4c5979594622..ac1e9b04c27aa18f1bb942a0378c2fe8ea291924 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationUIManager.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridge.java
@@ -20,9 +20,9 @@ import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.TextUtils;
import android.text.style.StyleSpan;
-import android.util.Log;
import org.chromium.base.CommandLine;
+import org.chromium.base.Log;
import org.chromium.base.VisibleForTesting;
import org.chromium.base.annotations.CalledByNative;
import org.chromium.base.library_loader.ProcessInitException;
@@ -46,13 +46,13 @@ import java.util.concurrent.TimeUnit;
import javax.annotation.Nullable;
/**
- * Provides the ability for the NotificationUIManagerAndroid to talk to the Android platform
- * notification manager.
+ * Provides the ability for the NotificationPlatformBridgeAndroid to talk to the Android platform
+ * notification system.
*
* This class should only be used on the UI thread.
*/
-public class NotificationUIManager {
- private static final String TAG = NotificationUIManager.class.getSimpleName();
+public class NotificationPlatformBridge {
+ private static final String TAG = NotificationPlatformBridge.class.getSimpleName();
// We always use the same integer id when showing and closing notifications. The notification
// tag is always set, which is a safe and sufficient way of identifying a notification, so the
@@ -61,7 +61,8 @@ public class NotificationUIManager {
// Prefix for platform tags generated by this class. This allows us to verify when reading a tag
// that it was set by us.
- private static final String PLATFORM_TAG_PREFIX = NotificationUIManager.class.getSimpleName();
+ private static final String PLATFORM_TAG_PREFIX =
+ NotificationPlatformBridge.class.getSimpleName();
private static final int NOTIFICATION_ICON_BG_COLOR = 0xFF969696;
private static final int NOTIFICATION_TEXT_SIZE_DP = 28;
@@ -70,10 +71,10 @@ public class NotificationUIManager {
// uniqueness of pending intents when necessary.
private static final int PENDING_INTENT_REQUEST_CODE = 0;
- private static NotificationUIManager sInstance;
+ private static NotificationPlatformBridge sInstance;
private static NotificationManagerProxy sNotificationManagerOverride;
- private final long mNativeNotificationManager;
+ private final long mNativeNotificationPlatformBridge;
private final Context mAppContext;
private final NotificationManagerProxy mNotificationManager;
@@ -86,30 +87,32 @@ public class NotificationUIManager {
private long mLastNotificationClickMs = 0L;
/**
- * Creates a new instance of the NotificationUIManager.
+ * Creates a new instance of the NotificationPlatformBridge.
*
- * @param nativeNotificationManager Instance of the NotificationUIManagerAndroid class.
+ * @param nativeNotificationPlatformBridge Instance of the NotificationPlatformBridgeAndroid
+ * class.
* @param context Application context for this instance of Chrome.
*/
- @CalledByNative
- private static NotificationUIManager create(long nativeNotificationManager, Context context) {
+ @CalledByNative private static NotificationPlatformBridge create(
+ long nativeNotificationPlatformBridge, Context context) {
if (sInstance != null) {
throw new IllegalStateException(
- "There must only be a single NotificationPlatformBridge.");
+ "There must only be a single NotificationPlatformBridge.");
}
- sInstance = new NotificationUIManager(nativeNotificationManager, context);
+ sInstance = new NotificationPlatformBridge(
+ nativeNotificationPlatformBridge, context);
return sInstance;
}
/**
- * Returns the current instance of the NotificationUIManager.
+ * Returns the current instance of the NotificationPlatformBridge.
*
- * @return The instance of the NotificationUIManager, if any.
+ * @return The instance of the NotificationPlatformBridge, if any.
*/
@Nullable
@VisibleForTesting
- static NotificationUIManager getInstanceForTests() {
+ static NotificationPlatformBridge getInstanceForTests() {
return sInstance;
}
@@ -126,8 +129,8 @@ public class NotificationUIManager {
sNotificationManagerOverride = notificationManager;
}
- private NotificationUIManager(long nativeNotificationManager, Context context) {
- mNativeNotificationManager = nativeNotificationManager;
+ private NotificationPlatformBridge(long nativeNotificationPlatformBridge, Context context) {
+ mNativeNotificationPlatformBridge = nativeNotificationPlatformBridge;
mAppContext = context.getApplicationContext();
if (sNotificationManagerOverride != null) {
@@ -147,7 +150,7 @@ public class NotificationUIManager {
}
/**
- * Marks the current instance as being freed, allowing for a new NotificationUIManager
+ * Marks the current instance as being freed, allowing for a new NotificationPlatformBridge
* object to be initialized.
*/
@CalledByNative
@@ -158,17 +161,17 @@ public class NotificationUIManager {
/**
* Invoked by the NotificationService when a Notification intent has been received. There may
- * not be an active instance of the NotificationUIManager at this time, so inform the native
- * side through a static method, initializing the manager if needed.
+ * not be an active instance of the NotificationPlatformBridge at this time, so inform the
+ * native side through a static method, initializing both ends if needed.
*
* @param intent The intent as received by the Notification service.
- * @return Whether the event could be handled by the native Notification manager.
+ * @return Whether the event could be handled by the native Notification bridge.
*/
public static boolean dispatchNotificationEvent(Intent intent) {
if (sInstance == null) {
- nativeInitializeNotificationUIManager();
+ nativeInitializeNotificationPlatformBridge();
if (sInstance == null) {
- Log.e(TAG, "Unable to initialize the native NotificationUIManager.");
+ Log.e(TAG, "Unable to initialize the native NotificationPlatformBridge.");
return false;
}
}
@@ -651,8 +654,8 @@ public class NotificationUIManager {
}
/**
- * Calls NotificationUIManagerAndroid::OnNotificationClicked in native code to indicate that
- * the notification with the given parameters has been clicked on.
+ * Calls NotificationPlatformBridgeAndroid::OnNotificationClicked in native code to indicate
+ * that the notification with the given parameters has been clicked on.
*
* @param persistentNotificationId The persistent id of the notification.
* @param origin The origin of the notification.
@@ -663,12 +666,12 @@ public class NotificationUIManager {
private void onNotificationClicked(long persistentNotificationId, String origin,
String profileId, boolean incognito, String tag, int actionIndex) {
mLastNotificationClickMs = System.currentTimeMillis();
- nativeOnNotificationClicked(mNativeNotificationManager, persistentNotificationId, origin,
- profileId, incognito, tag, actionIndex);
+ nativeOnNotificationClicked(mNativeNotificationPlatformBridge, persistentNotificationId,
+ origin, profileId, incognito, tag, actionIndex);
}
/**
- * Calls NotificationUIManagerAndroid::OnNotificationClosed in native code to indicate that
+ * Calls NotificationPlatformBridgeAndroid::OnNotificationClosed in native code to indicate that
* the notification with the given parameters has been closed.
*
* @param persistentNotificationId The persistent id of the notification.
@@ -680,16 +683,16 @@ public class NotificationUIManager {
*/
private void onNotificationClosed(long persistentNotificationId, String origin,
String profileId, boolean incognito, String tag, boolean byUser) {
- nativeOnNotificationClosed(mNativeNotificationManager, persistentNotificationId, origin,
- profileId, incognito, tag, byUser);
+ nativeOnNotificationClosed(mNativeNotificationPlatformBridge, persistentNotificationId,
+ origin, profileId, incognito, tag, byUser);
}
- private static native void nativeInitializeNotificationUIManager();
+ private static native void nativeInitializeNotificationPlatformBridge();
- private native void nativeOnNotificationClicked(long nativeNotificationUIManagerAndroid,
+ private native void nativeOnNotificationClicked(long nativeNotificationPlatformBridgeAndroid,
long persistentNotificationId, String origin, String profileId, boolean incognito,
String tag, int actionIndex);
- private native void nativeOnNotificationClosed(long nativeNotificationUIManagerAndroid,
+ private native void nativeOnNotificationClosed(long nativeNotificationPlatformBridgeAndroid,
long persistentNotificationId, String origin, String profileId, boolean incognito,
String tag, boolean byUser);
}

Powered by Google App Engine
This is Rietveld 408576698