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

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

Issue 2826223002: Hide Chrome actions in notifications shown for WebAPKs (Closed)
Patch Set: Update CustomNotificationBuilder. Created 3 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/NotificationPlatformBridge.java b/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridge.java
index 5bc1221c9ca81374c76449e1818badff75a434e6..817ca8f136e39567e05488b7334a5c753c8e57f5 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridge.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationPlatformBridge.java
@@ -504,16 +504,6 @@ public class NotificationPlatformBridge {
NotificationSystemStatusUtil.determineAppNotificationStatus(context),
NotificationSystemStatusUtil.APP_NOTIFICATIONS_STATUS_BOUNDARY);
- // Set up a pending intent for going to the settings screen for |origin|.
- Intent settingsIntent = PreferencesLauncher.createIntentForSettingsPage(
- context, SingleWebsitePreferences.class.getName());
- settingsIntent.setData(makeIntentData(notificationId, origin, -1 /* actionIndex */));
- settingsIntent.putExtra(Preferences.EXTRA_SHOW_FRAGMENT_ARGUMENTS,
- SingleWebsitePreferences.createFragmentArgsForSite(origin));
-
- PendingIntent pendingSettingsIntent = PendingIntent.getActivity(context,
- PENDING_INTENT_REQUEST_CODE, settingsIntent, PendingIntent.FLAG_UPDATE_CURRENT);
-
PendingIntent clickIntent = makePendingIntent(context,
NotificationConstants.ACTION_CLICK_NOTIFICATION, notificationId, origin, profileId,
incognito, tag, webApkPackage, -1 /* actionIndex */);
@@ -555,19 +545,6 @@ public class NotificationPlatformBridge {
}
}
- // If action buttons are displayed, there isn't room for the full Site Settings button
- // label and icon, so abbreviate it. This has the unfortunate side-effect of unnecessarily
- // abbreviating it on Android Wear also (crbug.com/576656). If custom layouts are enabled,
- // the label and icon provided here only affect Android Wear, so don't abbreviate them.
- boolean abbreviateSiteSettings = actions.length > 0 && !useCustomLayouts(hasImage);
- int settingsIconId = abbreviateSiteSettings ? 0 : R.drawable.settings_cog;
- CharSequence settingsTitle = abbreviateSiteSettings
- ? res.getString(R.string.notification_site_settings_button)
- : res.getString(R.string.page_info_site_settings_button);
- // If the settings button is displayed together with the other buttons it has to be the last
- // one, so add it after the other actions.
- notificationBuilder.addSettingsAction(settingsIconId, settingsTitle, pendingSettingsIntent);
-
// The Android framework applies a fallback vibration pattern for the sound when the device
// is in vibrate mode, there is no custom pattern, and the vibration default has been
// disabled. To truly prevent vibration, provide a custom empty pattern.
@@ -581,6 +558,31 @@ public class NotificationPlatformBridge {
String platformTag = makePlatformTag(notificationId, origin, tag);
if (webApkPackage.isEmpty()) {
+ // Set up a pending intent for going to the settings screen for |origin|.
+ Intent settingsIntent = PreferencesLauncher.createIntentForSettingsPage(
+ context, SingleWebsitePreferences.class.getName());
+ settingsIntent.setData(makeIntentData(notificationId, origin, -1 /* actionIndex */));
+ settingsIntent.putExtra(Preferences.EXTRA_SHOW_FRAGMENT_ARGUMENTS,
+ SingleWebsitePreferences.createFragmentArgsForSite(origin));
+
+ PendingIntent pendingSettingsIntent = PendingIntent.getActivity(context,
+ PENDING_INTENT_REQUEST_CODE, settingsIntent, PendingIntent.FLAG_UPDATE_CURRENT);
+
+ // If action buttons are displayed, there isn't room for the full Site Settings button
+ // label and icon, so abbreviate it. This has the unfortunate side-effect of
+ // unnecessarily abbreviating it on Android Wear also (crbug.com/576656). If custom
+ // layouts are enabled, the label and icon provided here only affect Android Wear, so
+ // don't abbreviate them.
+ boolean abbreviateSiteSettings = actions.length > 0 && !useCustomLayouts(hasImage);
+ int settingsIconId = abbreviateSiteSettings ? 0 : R.drawable.settings_cog;
+ CharSequence settingsTitle = abbreviateSiteSettings
+ ? res.getString(R.string.notification_site_settings_button)
+ : res.getString(R.string.page_info_site_settings_button);
+ // If the settings button is displayed together with the other buttons it has to be the
+ // last one, so add it after the other actions.
+ notificationBuilder.addSettingsAction(
+ settingsIconId, settingsTitle, pendingSettingsIntent);
+
mNotificationManager.notify(platformTag, PLATFORM_ID, notificationBuilder.build());
} else {
WebApkNotificationClient.notifyNotification(

Powered by Google App Engine
This is Rietveld 408576698