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

Unified Diff: chrome/browser/notifications/notification_platform_bridge_android.cc

Issue 2337963003: Plumb through notification action types and placeholders on Android (Closed)
Patch Set: Review fixes, improved comments and tests, rebased. Created 4 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
Index: chrome/browser/notifications/notification_platform_bridge_android.cc
diff --git a/chrome/browser/notifications/notification_platform_bridge_android.cc b/chrome/browser/notifications/notification_platform_bridge_android.cc
index 9c3075a749de185d950fd5247926f2325a76eb44..5d6833a501fd51245a3520066c5c205a8516a55a 100644
--- a/chrome/browser/notifications/notification_platform_bridge_android.cc
+++ b/chrome/browser/notifications/notification_platform_bridge_android.cc
@@ -12,6 +12,7 @@
#include "base/command_line.h"
#include "base/files/file_path.h"
#include "base/logging.h"
+#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/notifications/native_notification_display_service.h"
#include "chrome/browser/notifications/notification.h"
@@ -219,11 +220,27 @@ void NotificationPlatformBridgeAndroid::Display(
badge = gfx::ConvertToJavaBitmap(&badge_bitmap);
std::vector<base::string16> action_titles_vector;
- for (const message_center::ButtonInfo& button : notification.buttons())
+ std::vector<base::string16> action_types_vector;
+ std::vector<base::string16> action_placeholders_vector;
+ for (const message_center::ButtonInfo& button : notification.buttons()) {
action_titles_vector.push_back(button.title);
+ action_types_vector.push_back(button.type ==
+ message_center::ButtonType::TEXT
+ ? base::ASCIIToUTF16("text")
+ : base::ASCIIToUTF16("button"));
Peter Beverloo 2016/09/23 16:01:22 So occasionally "git cl format" does things that a
awdf 2016/09/26 15:33:29 Done.
+ action_placeholders_vector.push_back(!button.placeholder.is_null()
+ ? button.placeholder.string()
+ : base::ASCIIToUTF16(""));
Peter Beverloo 2016/09/23 16:01:22 As discussed, this should become non-nullable. (Wh
awdf 2016/09/26 15:33:29 Done.
+ }
ScopedJavaLocalRef<jobjectArray> action_titles =
base::android::ToJavaArrayOfStrings(env, action_titles_vector);
+ ScopedJavaLocalRef<jobjectArray> action_types =
+ base::android::ToJavaArrayOfStrings(env, action_types_vector);
+
+ ScopedJavaLocalRef<jobjectArray> action_placeholders =
+ base::android::ToJavaArrayOfStrings(env, action_placeholders_vector);
+
ScopedJavaLocalRef<jobjectArray> action_icons =
ConvertToJavaBitmaps(notification.buttons());
@@ -238,7 +255,7 @@ void NotificationPlatformBridgeAndroid::Display(
tag, webapk_package, title, body, image, notification_icon, badge,
vibration_pattern, notification.timestamp().ToJavaTime(),
notification.renotify(), notification.silent(), action_titles,
- action_icons);
+ action_icons, action_types, action_placeholders);
regenerated_notification_infos_[notification_id] =
RegeneratedNotificationInfo(origin_url.spec(), notification.tag(),

Powered by Google App Engine
This is Rietveld 408576698