diff options
author | benm@chromium.org <benm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-03 12:43:29 +0000 |
---|---|---|
committer | benm@chromium.org <benm@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-08-03 12:43:29 +0000 |
commit | f152b67b5802543986e37a9f57e228e424786e84 (patch) | |
tree | 6b882ebd754e1ebe91c8b8561984c6089413eb13 /base/android | |
parent | a94ba89aeec548f475b3e37eeb4ffbc5369c999c (diff) | |
download | chromium_src-f152b67b5802543986e37a9f57e228e424786e84.zip chromium_src-f152b67b5802543986e37a9f57e228e424786e84.tar.gz chromium_src-f152b67b5802543986e37a9f57e228e424786e84.tar.bz2 |
Android requires some extra functionality to set the path to it's resource pak files and native libraries.
This patch adds a new value to the PathService to implement the resource pak override and update the places that load pak files to take advantage of it.
Also adds a function for embedders to set the path to native libraries.
Review URL: https://chromiumcodereview.appspot.com/10802065
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@149842 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/android')
-rw-r--r-- | base/android/base_jni_registrar.cc | 2 | ||||
-rw-r--r-- | base/android/java/src/org/chromium/base/PathService.java | 24 | ||||
-rw-r--r-- | base/android/path_service.cc | 26 | ||||
-rw-r--r-- | base/android/path_service.h | 18 |
4 files changed, 70 insertions, 0 deletions
diff --git a/base/android/base_jni_registrar.cc b/base/android/base_jni_registrar.cc index 4ec2047..6f4096a 100644 --- a/base/android/base_jni_registrar.cc +++ b/base/android/base_jni_registrar.cc @@ -10,6 +10,7 @@ #include "base/android/jni_android.h" #include "base/android/jni_registrar.h" #include "base/android/locale_utils.h" +#include "base/android/path_service.h" #include "base/android/path_utils.h" namespace base { @@ -18,6 +19,7 @@ namespace android { static RegistrationMethod kBaseRegisteredMethods[] = { { "BuildInfo", base::android::BuildInfo::RegisterBindings }, { "LocaleUtils", base::android::RegisterLocaleUtils }, + { "PathService", base::android::RegisterPathService }, { "PathUtils", base::android::RegisterPathUtils }, { "SystemMessageHandler", base::MessagePumpForUI::RegisterBindings }, }; diff --git a/base/android/java/src/org/chromium/base/PathService.java b/base/android/java/src/org/chromium/base/PathService.java new file mode 100644 index 0000000..dfda736 --- /dev/null +++ b/base/android/java/src/org/chromium/base/PathService.java @@ -0,0 +1,24 @@ +// 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; + +/** + * This class provides java side access to the native PathService. + */ +@JNINamespace("base::android") +public abstract class PathService { + + // Must match the value of DIR_MODULE in base/base_paths.h! + public static final int DIR_MODULE = 3; + + // Prevent instantiation. + private PathService() {} + + public static void override(int what, String path) { + nativeOverride(what, path); + } + + private static native void nativeOverride(int what, String path); +} diff --git a/base/android/path_service.cc b/base/android/path_service.cc new file mode 100644 index 0000000..8591e90 --- /dev/null +++ b/base/android/path_service.cc @@ -0,0 +1,26 @@ +// 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. + +#include "base/android/path_service.h" + +#include "base/file_path.h" +#include "base/path_service.h" +#include "base/android/jni_android.h" +#include "base/android/jni_string.h" +#include "jni/PathService_jni.h" + +namespace base { +namespace android { + +void Override(JNIEnv* env, jclass clazz, jint what, jstring path) { + FilePath file_path(ConvertJavaStringToUTF8(env, path)); + PathService::Override(what, file_path); +} + +bool RegisterPathService(JNIEnv* env) { + return RegisterNativesImpl(env); +} + +} // namespace android +} // namespace base diff --git a/base/android/path_service.h b/base/android/path_service.h new file mode 100644 index 0000000..baaa2a4 --- /dev/null +++ b/base/android/path_service.h @@ -0,0 +1,18 @@ +// 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. + +#ifndef BASE_ANDROID_PATH_SERVICE_H_ +#define BASE_ANDROID_PATH_SERVICE_H_ + +#include <jni.h> + +namespace base { +namespace android { + +bool RegisterPathService(JNIEnv* env); + +} // namespace android +} // namespace base + +#endif // BASE_ANDROID_PATH_SERVICE_H_ |