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

Unified Diff: base/android/java/org/chromium/base/PathUtils.java

Issue 9443018: Upstream Android's PathUtils implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased patch Created 8 years, 9 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: base/android/java/org/chromium/base/PathUtils.java
diff --git a/base/android/java/org/chromium/base/PathUtils.java b/base/android/java/org/chromium/base/PathUtils.java
new file mode 100644
index 0000000000000000000000000000000000000000..94403d4df3ae42fdeafaac010ef1be846d8f8423
--- /dev/null
+++ b/base/android/java/org/chromium/base/PathUtils.java
@@ -0,0 +1,44 @@
+// Copyright (c) 2012 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.base;
+
+import android.content.Context;
+import android.os.Environment;
+
+import org.chromium.base.CalledByNative;
+
+import java.io.File;
+
+/**
+ * This class provides the path related methods for the native library.
+ */
+class PathUtils {
+
+ /**
+ * @return the private directory that used to store application data.
+ */
+ @CalledByNative
+ public static String getDataDirectory(Context appContext) {
+ // TODO(beverloo) base/ should not know about "chrome": http://b/6057342
+ return appContext.getDir("chrome", Context.MODE_PRIVATE).getPath();
+ }
+
+ /**
+ * @return the cache directory.
+ */
+ @CalledByNative
+ public static String getCacheDirectory(Context appContext) {
+ return appContext.getCacheDir().getPath();
+ }
+
+ /**
+ * @return the public downloads directory.
+ */
+ @CalledByNative
+ public static String getDownloadsDirectory(Context appContext) {
+ return Environment.getExternalStoragePublicDirectory(
+ Environment.DIRECTORY_DOWNLOADS).getPath();
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698