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..c88034b669c5e68b1eae7bd1b9b41a50397a63e0 |
--- /dev/null |
+++ b/base/android/java/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.chromeview.base; |
John Grabowski
2012/02/26 08:25:58
I don't think org.chromium.chromeview makes sense
Peter Beverloo
2012/02/29 15:40:22
Done in the thread. It's org.chromium.base now.
|
+ |
+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) { |
+ // TODO(beverloo) base/ should not know about "chrome": http://b/6057342 |
John Grabowski
2012/02/26 08:25:58
I think we should try a little harder to not viola
klobag.chromium
2012/02/27 21:38:59
I actually don't think this violates the layering.
|
+ 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(); |
+ } |
+} |