| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/android/offline_pages/downloads/offline_page_notificati
on_bridge.h" |
| 6 |
| 7 #include "base/android/context_utils.h" |
| 8 #include "base/android/jni_string.h" |
| 9 #include "chrome/browser/android/offline_pages/downloads/offline_page_download_b
ridge.h" |
| 10 #include "jni/OfflinePageNotificationBridge_jni.h" |
| 11 |
| 12 using base::android::AttachCurrentThread; |
| 13 using base::android::ConvertUTF8ToJavaString; |
| 14 using base::android::GetApplicationContext; |
| 15 |
| 16 namespace offline_pages { |
| 17 namespace android { |
| 18 |
| 19 void OfflinePageNotificationBridge::NotifyDownloadSuccessful( |
| 20 const DownloadUIItem& item) { |
| 21 JNIEnv* env = AttachCurrentThread(); |
| 22 Java_OfflinePageNotificationBridge_notifyDownloadSuccessful( |
| 23 env, GetApplicationContext(), ConvertUTF8ToJavaString(env, item.guid), |
| 24 ConvertUTF8ToJavaString(env, item.url.spec())); |
| 25 } |
| 26 |
| 27 void OfflinePageNotificationBridge::NotifyDownloadFailed( |
| 28 const DownloadUIItem& item) { |
| 29 JNIEnv* env = AttachCurrentThread(); |
| 30 Java_OfflinePageNotificationBridge_notifyDownloadFailed( |
| 31 env, GetApplicationContext(), ConvertUTF8ToJavaString(env, item.guid), |
| 32 ConvertUTF8ToJavaString(env, item.url.spec())); |
| 33 } |
| 34 |
| 35 void OfflinePageNotificationBridge::NotifyDownloadProgress( |
| 36 const DownloadUIItem& item) { |
| 37 JNIEnv* env = AttachCurrentThread(); |
| 38 Java_OfflinePageNotificationBridge_notifyDownloadProgress( |
| 39 env, GetApplicationContext(), ConvertUTF8ToJavaString(env, item.guid), |
| 40 ConvertUTF8ToJavaString(env, item.url.spec()), |
| 41 item.start_time.ToJavaTime()); |
| 42 } |
| 43 |
| 44 void OfflinePageNotificationBridge::NotifyDownloadPaused( |
| 45 const DownloadUIItem& item) { |
| 46 JNIEnv* env = AttachCurrentThread(); |
| 47 Java_OfflinePageNotificationBridge_notifyDownloadPaused( |
| 48 env, GetApplicationContext(), ConvertUTF8ToJavaString(env, item.guid)); |
| 49 } |
| 50 |
| 51 void OfflinePageNotificationBridge::NotifyDownloadInterrupted( |
| 52 const DownloadUIItem& item) { |
| 53 JNIEnv* env = AttachCurrentThread(); |
| 54 Java_OfflinePageNotificationBridge_notifyDownloadInterrupted( |
| 55 env, GetApplicationContext(), ConvertUTF8ToJavaString(env, item.guid)); |
| 56 } |
| 57 |
| 58 void OfflinePageNotificationBridge::NotifyDownloadCanceled( |
| 59 const DownloadUIItem& item) { |
| 60 JNIEnv* env = AttachCurrentThread(); |
| 61 Java_OfflinePageNotificationBridge_notifyDownloadCanceled( |
| 62 env, GetApplicationContext(), ConvertUTF8ToJavaString(env, item.guid)); |
| 63 } |
| 64 |
| 65 } // namespace android |
| 66 } // namespace offline_pages |
| OLD | NEW |