Chromium Code Reviews| Index: chrome/browser/notifications/notification_ui_manager_android.cc |
| diff --git a/chrome/browser/notifications/notification_ui_manager_android.cc b/chrome/browser/notifications/notification_ui_manager_android.cc |
| index 9332bb0c43f413152806a0f91e4bc531d4e5b8b5..80746dbcb062fac70030cff0bd09ebc7a3939b69 100644 |
| --- a/chrome/browser/notifications/notification_ui_manager_android.cc |
| +++ b/chrome/browser/notifications/notification_ui_manager_android.cc |
| @@ -118,6 +118,19 @@ void NotificationUIManagerAndroid::Add(const Notification& notification, |
| if (!icon_bitmap.isNull()) |
| icon = gfx::ConvertToJavaBitmap(&icon_bitmap); |
| + std::vector<int64> pattern; |
|
Peter Beverloo
2015/04/21 17:58:22
nit: Please use int64_t everywhere. int64 is depre
Sanghyun Park
2015/04/23 11:08:26
Done.
|
| + if (!notification.vibrate().empty()) { |
|
Peter Beverloo
2015/04/21 17:58:22
We can simplify this block by using:
ScopedJavaLo
Sanghyun Park
2015/04/23 11:08:25
We couldn't use ToJavaLongArray function directly.
Peter Beverloo
2015/04/26 23:26:40
Yes - having this in Java SGTM. (It changes common
|
| + // In Android platform, the first value indicates the number of |
| + // milliseconds to wait before turning the vibrator on unlike Blink. |
| + // So, we need to insert any value at the beginning of vibrate value. |
| + pattern.reserve(notification.vibrate().size() + 1); |
| + pattern.push_back(0); |
| + for (size_t i = 0; i < notification.vibrate().size(); ++i) |
| + pattern.push_back(notification.vibrate()[i]); |
| + } |
| + ScopedJavaLocalRef<jlongArray> vibrate = |
| + base::android::ToJavaLongArray(env, pattern.begin(), pattern.size()); |
| + |
| Java_NotificationUIManager_displayNotification( |
| env, |
| java_object_.obj(), |
| @@ -127,6 +140,7 @@ void NotificationUIManagerAndroid::Add(const Notification& notification, |
| title.obj(), |
| body.obj(), |
| icon.obj(), |
| + vibrate.obj(), |
| notification.silent()); |
| regenerated_notification_infos_[persistent_notification_id] = |