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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 env, notification.title()); | 123 env, notification.title()); |
124 ScopedJavaLocalRef<jstring> body = ConvertUTF16ToJavaString( | 124 ScopedJavaLocalRef<jstring> body = ConvertUTF16ToJavaString( |
125 env, notification.message()); | 125 env, notification.message()); |
126 | 126 |
127 ScopedJavaLocalRef<jobject> icon; | 127 ScopedJavaLocalRef<jobject> icon; |
128 | 128 |
129 SkBitmap icon_bitmap = notification.icon().AsBitmap(); | 129 SkBitmap icon_bitmap = notification.icon().AsBitmap(); |
130 if (!icon_bitmap.isNull()) | 130 if (!icon_bitmap.isNull()) |
131 icon = gfx::ConvertToJavaBitmap(&icon_bitmap); | 131 icon = gfx::ConvertToJavaBitmap(&icon_bitmap); |
132 | 132 |
| 133 ScopedJavaLocalRef<jintArray> vibration_pattern = |
| 134 base::android::ToJavaIntArray(env, notification.vibration_pattern()); |
| 135 |
133 Java_NotificationUIManager_displayNotification( | 136 Java_NotificationUIManager_displayNotification( |
134 env, | 137 env, |
135 java_object_.obj(), | 138 java_object_.obj(), |
136 persistent_notification_id, | 139 persistent_notification_id, |
137 origin.obj(), | 140 origin.obj(), |
138 tag.obj(), | 141 tag.obj(), |
139 title.obj(), | 142 title.obj(), |
140 body.obj(), | 143 body.obj(), |
141 icon.obj(), | 144 icon.obj(), |
| 145 vibration_pattern.obj(), |
142 notification.silent()); | 146 notification.silent()); |
143 | 147 |
144 regenerated_notification_infos_[persistent_notification_id] = | 148 regenerated_notification_infos_[persistent_notification_id] = |
145 std::make_pair(origin_url.spec(), notification.tag()); | 149 std::make_pair(origin_url.spec(), notification.tag()); |
146 | 150 |
147 notification.delegate()->Display(); | 151 notification.delegate()->Display(); |
148 } | 152 } |
149 | 153 |
150 bool NotificationUIManagerAndroid::Update(const Notification& notification, | 154 bool NotificationUIManagerAndroid::Update(const Notification& notification, |
151 Profile* profile) { | 155 Profile* profile) { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 return false; | 216 return false; |
213 } | 217 } |
214 | 218 |
215 void NotificationUIManagerAndroid::CancelAll() { | 219 void NotificationUIManagerAndroid::CancelAll() { |
216 NOTREACHED(); | 220 NOTREACHED(); |
217 } | 221 } |
218 | 222 |
219 bool NotificationUIManagerAndroid::RegisterNotificationUIManager(JNIEnv* env) { | 223 bool NotificationUIManagerAndroid::RegisterNotificationUIManager(JNIEnv* env) { |
220 return RegisterNativesImpl(env); | 224 return RegisterNativesImpl(env); |
221 } | 225 } |
OLD | NEW |