OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "chrome/browser/notifications/notification_ui_manager_android.h" | 5 #include "chrome/browser/notifications/notification_ui_manager_android.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/android/jni_array.h" | 9 #include "base/android/jni_array.h" |
10 #include "base/android/jni_string.h" | 10 #include "base/android/jni_string.h" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 env, notification.title()); | 111 env, notification.title()); |
112 ScopedJavaLocalRef<jstring> body = ConvertUTF16ToJavaString( | 112 ScopedJavaLocalRef<jstring> body = ConvertUTF16ToJavaString( |
113 env, notification.message()); | 113 env, notification.message()); |
114 | 114 |
115 ScopedJavaLocalRef<jobject> icon; | 115 ScopedJavaLocalRef<jobject> icon; |
116 | 116 |
117 SkBitmap icon_bitmap = notification.icon().AsBitmap(); | 117 SkBitmap icon_bitmap = notification.icon().AsBitmap(); |
118 if (!icon_bitmap.isNull()) | 118 if (!icon_bitmap.isNull()) |
119 icon = gfx::ConvertToJavaBitmap(&icon_bitmap); | 119 icon = gfx::ConvertToJavaBitmap(&icon_bitmap); |
120 | 120 |
| 121 ScopedJavaLocalRef<jintArray> vibrate = |
| 122 base::android::ToJavaIntArray(env, notification.vibrate()); |
| 123 |
121 Java_NotificationUIManager_displayNotification( | 124 Java_NotificationUIManager_displayNotification( |
122 env, | 125 env, |
123 java_object_.obj(), | 126 java_object_.obj(), |
124 persistent_notification_id, | 127 persistent_notification_id, |
125 origin.obj(), | 128 origin.obj(), |
126 tag.obj(), | 129 tag.obj(), |
127 title.obj(), | 130 title.obj(), |
128 body.obj(), | 131 body.obj(), |
129 icon.obj(), | 132 icon.obj(), |
| 133 vibrate.obj(), |
130 notification.silent()); | 134 notification.silent()); |
131 | 135 |
132 regenerated_notification_infos_[persistent_notification_id] = | 136 regenerated_notification_infos_[persistent_notification_id] = |
133 std::make_pair(origin_url.spec(), notification.tag()); | 137 std::make_pair(origin_url.spec(), notification.tag()); |
134 | 138 |
135 notification.delegate()->Display(); | 139 notification.delegate()->Display(); |
136 } | 140 } |
137 | 141 |
138 bool NotificationUIManagerAndroid::Update(const Notification& notification, | 142 bool NotificationUIManagerAndroid::Update(const Notification& notification, |
139 Profile* profile) { | 143 Profile* profile) { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 return false; | 204 return false; |
201 } | 205 } |
202 | 206 |
203 void NotificationUIManagerAndroid::CancelAll() { | 207 void NotificationUIManagerAndroid::CancelAll() { |
204 NOTREACHED(); | 208 NOTREACHED(); |
205 } | 209 } |
206 | 210 |
207 bool NotificationUIManagerAndroid::RegisterNotificationUIManager(JNIEnv* env) { | 211 bool NotificationUIManagerAndroid::RegisterNotificationUIManager(JNIEnv* env) { |
208 return RegisterNativesImpl(env); | 212 return RegisterNativesImpl(env); |
209 } | 213 } |
OLD | NEW |