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

Unified Diff: chrome/browser/android/ntp/content_suggestions_notification_helper.cc

Issue 2616893003: Hide notifications after their deadline (Closed)
Patch Set: import annotation Created 3 years, 11 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/browser/android/ntp/content_suggestions_notification_helper.cc
diff --git a/chrome/browser/android/ntp/content_suggestions_notification_helper.cc b/chrome/browser/android/ntp/content_suggestions_notification_helper.cc
index 03f45739f93dc93a3011db78ca608e266a0a46ef..db5abdd3b659d21147ce6a302283ebbb834b695f 100644
--- a/chrome/browser/android/ntp/content_suggestions_notification_helper.cc
+++ b/chrome/browser/android/ntp/content_suggestions_notification_helper.cc
@@ -4,6 +4,8 @@
#include "chrome/browser/android/ntp/content_suggestions_notification_helper.h"
+#include <limits>
+
#include "base/android/jni_android.h"
#include "base/android/jni_string.h"
#include "base/strings/utf_string_conversions.h"
@@ -24,22 +26,28 @@ void ContentSuggestionsNotificationHelper::SendNotification(
const GURL& url,
const base::string16& title,
const base::string16& text,
- const gfx::Image& image) {
+ const gfx::Image& image,
+ base::Time timeout_at) {
JNIEnv* env = base::android::AttachCurrentThread();
SkBitmap skimage = image.AsImageSkia().GetRepresentation(1.0f).sk_bitmap();
if (skimage.empty())
return;
+ jint timeout_at_millis = timeout_at.ToJavaTime();
+ if (timeout_at == base::Time::Max()) {
+ timeout_at_millis = std::numeric_limits<jint>::max();
+ }
+
Java_ContentSuggestionsNotificationHelper_showNotification(
env, base::android::ConvertUTF8ToJavaString(env, url.spec()),
base::android::ConvertUTF16ToJavaString(env, title),
base::android::ConvertUTF16ToJavaString(env, text),
- gfx::ConvertToJavaBitmap(&skimage));
+ gfx::ConvertToJavaBitmap(&skimage), timeout_at_millis);
}
-void ContentSuggestionsNotificationHelper::HideNotification() {
+void ContentSuggestionsNotificationHelper::HideAllNotifications() {
JNIEnv* env = base::android::AttachCurrentThread();
- Java_ContentSuggestionsNotificationHelper_hideNotification(env);
+ Java_ContentSuggestionsNotificationHelper_hideAllNotifications(env);
}
} // namespace ntp_snippets

Powered by Google App Engine
This is Rietveld 408576698