Index: base/android/java/PathUtils.java |
diff --git a/base/android/java/PathUtils.java b/base/android/java/PathUtils.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..e0d5817afb1d68f4a68e9b8266a405b9c572a81d |
--- /dev/null |
+++ b/base/android/java/PathUtils.java |
@@ -0,0 +1,43 @@ |
+// 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.chromeview.base; |
+ |
+import android.content.Context; |
+import android.os.Environment; |
+ |
+import org.chromium.chromeview.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) { |
+ return appContext.getDir("chrome", Context.MODE_PRIVATE).getPath(); |
joth
2012/02/23 14:07:14
base/ should not know about "chrome"
at least, th
Peter Beverloo
2012/02/23 14:39:21
Added a TODO and filed an issue downstream, as it
|
+ } |
+ |
+ /** |
+ * @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(); |
+ } |
+} |