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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/media/MediaCaptureNotificationService.java

Issue 1328663003: [Custom tab]Fix a bug that clicking media notification opens blank tab (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: final touch Created 5 years, 3 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
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/media/ui/NotificationMediaPlaybackControls.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/android/java/src/org/chromium/chrome/browser/media/MediaCaptureNotificationService.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/media/MediaCaptureNotificationService.java b/chrome/android/java/src/org/chromium/chrome/browser/media/MediaCaptureNotificationService.java
index 5da216539fd6e5f752cda62954ae0e60dd24a1b0..1fcc1750d2aefbecc8b24ca0720e72c16e3b016f 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/media/MediaCaptureNotificationService.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/media/MediaCaptureNotificationService.java
@@ -159,9 +159,6 @@ public class MediaCaptureNotificationService extends Service {
notificationIconId = R.drawable.webrtc_audio;
}
- Intent tabIntent = Tab.createBringTabToFrontIntent(notificationId);
- PendingIntent contentIntent = PendingIntent.getActivity(
- mContext, notificationId, tabIntent, 0);
String contentText = mContext.getResources().getString(notificationContentTextId) + ". "
+ mContext.getResources().getString(
R.string.media_notification_link_text, url);
@@ -169,12 +166,18 @@ public class MediaCaptureNotificationService extends Service {
NotificationCompat.Builder builder = new NotificationCompat.Builder(mContext)
.setAutoCancel(false)
.setOngoing(true)
- .setContentIntent(contentIntent)
.setContentTitle(mContext.getString(R.string.app_name))
.setContentText(contentText)
.setSmallIcon(notificationIconId)
.setLocalOnly(true);
+ Intent tabIntent = Tab.createBringTabToFrontIntent(notificationId);
+ if (tabIntent != null) {
+ PendingIntent contentIntent = PendingIntent.getActivity(
+ mContext, notificationId, tabIntent, 0);
+ builder.setContentIntent(contentIntent);
+ }
+
Notification notification = new NotificationCompat.BigTextStyle(builder)
.bigText(contentText).build();
mNotificationManager.notify(NOTIFICATION_NAMESPACE, notificationId, notification);
« no previous file with comments | « no previous file | chrome/android/java/src/org/chromium/chrome/browser/media/ui/NotificationMediaPlaybackControls.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698