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

Unified Diff: content/public/android/java/org/chromium/content/browser/DownloadController.java

Issue 10449017: Add android download controller. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed nit Created 8 years, 7 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
« no previous file with comments | « content/content_jni.gypi ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/android/java/org/chromium/content/browser/DownloadController.java
diff --git a/content/public/android/java/org/chromium/content/browser/DownloadController.java b/content/public/android/java/org/chromium/content/browser/DownloadController.java
new file mode 100644
index 0000000000000000000000000000000000000000..6d827d27e69f4aeff3e2cf97be486580abbd5c90
--- /dev/null
+++ b/content/public/android/java/org/chromium/content/browser/DownloadController.java
@@ -0,0 +1,80 @@
+// Copyright (c) 2011 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.
+
+package org.chromium.content.browser;
+
+import java.io.File;
+
+import android.content.Context;
+import android.util.Log;
+import android.webkit.DownloadListener;
+
+import org.chromium.base.CalledByNative;
+
+/**
+ * Java counterpart of android DownloadController.
+ *
+ * Its a singleton class instantiated by the C++ DownloadController.
+ */
+class DownloadController {
+ private static final String LOGTAG = "DownloadController";
+ private static DownloadController sInstance;
+
+ public static DownloadController getInstance() {
+ if (sInstance == null) {
+ sInstance = new DownloadController();
+ }
+ return sInstance;
+ }
+
+ private Context mContext;
+
+ private DownloadController() {
+ nativeInit();
+ }
+
+ private static DownloadListener listenerFromView(ContentView view) {
+ // TODO(nileshagrawal): Implement.
+ return null;
+ }
+
+ public void setContext(Context context) {
+ mContext = context;
+ }
+
+ /**
+ * Notifies the DownloadListener of a new GET download and passes all the information
+ * needed to download the file.
+ *
+ * The DownloadListener is expected to handle the download.
+ */
+ @CalledByNative
+ public void newHttpGetDownload(ContentView view, String url,
+ String userAgent, String contentDisposition, String mimetype,
+ String cookie, long contentLength) {
+ // TODO(nileshagrawal): Implement.
+ }
+
+ /**
+ * Notifies the DownloadListener that a new POST download has started.
+ */
+ @CalledByNative
+ public void onHttpPostDownloadStarted(ContentView view) {
+ // TODO(nileshagrawal): Implement.
+ }
+
+ /**
+ * Notifies the DownloadListener that a POST download completed and passes along info about the
+ * download.
+ */
+ @CalledByNative
+ public void onHttpPostDownloadCompleted(ContentView view, String url,
+ String contentDisposition, String mimetype, String path,
+ long contentLength, boolean successful) {
+ // TODO(nileshagrawal): Implement.
+ }
+
+ // native methods
+ private native void nativeInit();
+}
« no previous file with comments | « content/content_jni.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698