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

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

Issue 1394423004: Initial skeleton of custom layouts for Web Notifications. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase. Created 5 years, 2 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/NotificationBuilder.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationBuilder.java b/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationBuilder.java
new file mode 100644
index 0000000000000000000000000000000000000000..b7fd119ae33c95c4f29cd16d3b914765a975252b
--- /dev/null
+++ b/chrome/android/java/src/org/chromium/chrome/browser/notifications/NotificationBuilder.java
@@ -0,0 +1,77 @@
+// Copyright 2015 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 android.app.Notification;
+import android.app.PendingIntent;
+import android.graphics.Bitmap;
+
+/**
+ * Builds a notification using the given inputs.
+ */
+public interface NotificationBuilder {
+
+ /**
+ * Combines all of the options that have been set and returns a new Notification object.
+ */
+ Notification build();
+
+ /**
+ * Sets the title text (first row) of the notification.
+ */
+ NotificationBuilder setTitle(String title);
+
+ /**
+ * Sets the body text (second row) of the notification.
+ */
+ NotificationBuilder setBody(String body);
+
+ /**
+ * Sets the origin text (bottom row) of the notification.
+ */
+ NotificationBuilder setOrigin(String origin);
+
+ /**
+ * Sets the text that is displayed in the status bar when the notification first arrives.
+ */
+ NotificationBuilder setTicker(CharSequence tickerText);
+
+ /**
+ * Sets the large icon that is shown in the notification.
+ */
+ NotificationBuilder setLargeIcon(Bitmap icon);
+
+ /**
+ * Sets the the small icon that is shown in the notification and in the status bar.
+ */
+ NotificationBuilder setSmallIcon(int iconId);
+
+ /**
+ * Sets the PendingIntent to send when the notification is clicked.
+ */
+ NotificationBuilder setContentIntent(PendingIntent intent);
+
+ /**
+ * Sets the PendingIntent to send when the notification is cleared by the user directly from the
+ * notification panel.
+ */
+ NotificationBuilder setDeleteIntent(PendingIntent intent);
+
+ /**
+ * Adds an action to the notification. Actions are typically displayed as a button adjacent to
+ * the notification content.
+ */
+ NotificationBuilder addAction(int iconId, CharSequence title, PendingIntent intent);
+
+ /**
+ * Sets the default notification options that will be used.
+ */
+ NotificationBuilder setDefaults(int defaults);
+
+ /**
+ * Sets the vibration pattern to use.
+ */
+ NotificationBuilder setVibrate(long[] pattern);
+}

Powered by Google App Engine
This is Rietveld 408576698