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

Unified Diff: chrome/browser/android/offline_pages/downloads/offline_page_notification_bridge.cc

Issue 2239133002: [Offline pages] Downloads UI: Adding bridge for issuing notifications (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@download-notifications
Patch Set: Addressing CR feedback Created 4 years, 4 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/android/offline_pages/downloads/offline_page_notification_bridge.cc
diff --git a/chrome/browser/android/offline_pages/downloads/offline_page_notification_bridge.cc b/chrome/browser/android/offline_pages/downloads/offline_page_notification_bridge.cc
new file mode 100644
index 0000000000000000000000000000000000000000..4e5f60f5b8b0038ba6c9b9485aeaff1c3ad380ab
--- /dev/null
+++ b/chrome/browser/android/offline_pages/downloads/offline_page_notification_bridge.cc
@@ -0,0 +1,66 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "chrome/browser/android/offline_pages/downloads/offline_page_notification_bridge.h"
+
+#include "base/android/context_utils.h"
+#include "base/android/jni_string.h"
+#include "chrome/browser/android/offline_pages/downloads/offline_page_download_bridge.h"
+#include "jni/OfflinePageNotificationBridge_jni.h"
+
+using base::android::AttachCurrentThread;
+using base::android::ConvertUTF8ToJavaString;
+using base::android::GetApplicationContext;
+
+namespace offline_pages {
+namespace android {
+
+void OfflinePageNotificationBridge::NotifyDownloadSuccessful(
+ const DownloadUIItem& item) {
+ JNIEnv* env = AttachCurrentThread();
+ Java_OfflinePageNotificationBridge_notifyDownloadSuccessful(
+ env, GetApplicationContext(), ConvertUTF8ToJavaString(env, item.guid),
+ ConvertUTF8ToJavaString(env, item.url.spec()));
+}
+
+void OfflinePageNotificationBridge::NotifyDownloadFailed(
+ const DownloadUIItem& item) {
+ JNIEnv* env = AttachCurrentThread();
+ Java_OfflinePageNotificationBridge_notifyDownloadFailed(
+ env, GetApplicationContext(), ConvertUTF8ToJavaString(env, item.guid),
+ ConvertUTF8ToJavaString(env, item.url.spec()));
+}
+
+void OfflinePageNotificationBridge::NotifyDownloadProgress(
+ const DownloadUIItem& item) {
+ JNIEnv* env = AttachCurrentThread();
+ Java_OfflinePageNotificationBridge_notifyDownloadProgress(
+ env, GetApplicationContext(), ConvertUTF8ToJavaString(env, item.guid),
+ ConvertUTF8ToJavaString(env, item.url.spec()),
+ item.start_time.ToJavaTime());
+}
+
+void OfflinePageNotificationBridge::NotifyDownloadPaused(
+ const DownloadUIItem& item) {
+ JNIEnv* env = AttachCurrentThread();
+ Java_OfflinePageNotificationBridge_notifyDownloadPaused(
+ env, GetApplicationContext(), ConvertUTF8ToJavaString(env, item.guid));
+}
+
+void OfflinePageNotificationBridge::NotifyDownloadInterrupted(
+ const DownloadUIItem& item) {
+ JNIEnv* env = AttachCurrentThread();
+ Java_OfflinePageNotificationBridge_notifyDownloadInterrupted(
+ env, GetApplicationContext(), ConvertUTF8ToJavaString(env, item.guid));
+}
+
+void OfflinePageNotificationBridge::NotifyDownloadCanceled(
+ const DownloadUIItem& item) {
+ JNIEnv* env = AttachCurrentThread();
+ Java_OfflinePageNotificationBridge_notifyDownloadCanceled(
+ env, GetApplicationContext(), ConvertUTF8ToJavaString(env, item.guid));
+}
+
+} // namespace android
+} // namespace offline_pages
« no previous file with comments | « chrome/browser/android/offline_pages/downloads/offline_page_notification_bridge.h ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698