diff options
author | yfriedman@chromium.org <yfriedman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-22 21:06:37 +0000 |
---|---|---|
committer | yfriedman@chromium.org <yfriedman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-02-22 21:06:37 +0000 |
commit | 4f2b94f1ce652c4f0bc919627958b8a9cf233128 (patch) | |
tree | 5ab63a7a3f017bc0ccb8f8aa1769c0f580f9ab30 | |
parent | 70637c944c29cc0f7f46c75e5db190da8aa9716b (diff) | |
download | chromium_src-4f2b94f1ce652c4f0bc919627958b8a9cf233128.zip chromium_src-4f2b94f1ce652c4f0bc919627958b8a9cf233128.tar.gz chromium_src-4f2b94f1ce652c4f0bc919627958b8a9cf233128.tar.bz2 |
[Android] Make content_shell_apk and chromium_testshell components friendly.
This includes the remaining changes to atleast _compile_ the above
targets. More work is needed for starting up the apps and running.
Inclues:
- Misc EXPORT additions (I assume I can TBR these)
- Introduce a ShellDialogs JNI registrar since it's now a separate
component and ui can't depend on it.
- Random gyp tweaks that are needed to fully specify dependencies
- Change from using NPN_MemAlloc to just plain malloc for the java
bridge. For some reason the NPN_MemAlloc symbol cannot be found in the
component build, but regardless all our implementations end up calling
straight throught to malloc.
BUG=158821
TBR=wjia@chromium.org,willchan@chromium.org,jcivelli@chromium.org
Review URL: https://chromiumcodereview.appspot.com/12281017
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@184173 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | base/android/build_info.h | 3 | ||||
-rw-r--r-- | base/android/path_utils.h | 2 | ||||
-rw-r--r-- | base/process_util.h | 2 | ||||
-rw-r--r-- | chrome/chrome_android.gypi | 4 | ||||
-rw-r--r-- | content/app/android/library_loader_hooks.cc | 6 | ||||
-rw-r--r-- | content/browser/renderer_host/java/java_bound_object.cc | 8 | ||||
-rw-r--r-- | content/public/browser/android/content_view_core.h | 5 | ||||
-rw-r--r-- | content/public/browser/android/download_controller_android.h | 4 | ||||
-rw-r--r-- | content/public/test/content_test_suite_base.cc | 2 | ||||
-rw-r--r-- | media/video/capture/android/video_capture_device_android.h | 3 | ||||
-rw-r--r-- | net/android/keystore.h | 10 | ||||
-rw-r--r-- | net/android/network_library.h | 6 | ||||
-rw-r--r-- | ui/android/ui_jni_registrar.cc | 2 | ||||
-rw-r--r-- | ui/gfx/android/window_android.h | 3 | ||||
-rw-r--r-- | ui/shell_dialogs.gypi | 2 | ||||
-rw-r--r-- | ui/shell_dialogs/android/shell_dialogs_jni_registrar.cc | 24 | ||||
-rw-r--r-- | ui/shell_dialogs/android/shell_dialogs_jni_registrar.h | 21 |
17 files changed, 83 insertions, 24 deletions
diff --git a/base/android/build_info.h b/base/android/build_info.h index 6273d3e..a5f44c2 100644 --- a/base/android/build_info.h +++ b/base/android/build_info.h @@ -9,6 +9,7 @@ #include <string> +#include "base/base_export.h" #include "base/memory/singleton.h" namespace base { @@ -20,7 +21,7 @@ namespace android { // It is also used to store the last java exception seen during JNI. // TODO(nileshagrawal): Find a better place to store this info. -class BuildInfo { +class BASE_EXPORT BuildInfo { public: ~BuildInfo() {} diff --git a/base/android/path_utils.h b/base/android/path_utils.h index 6c632f2..60f8a79 100644 --- a/base/android/path_utils.h +++ b/base/android/path_utils.h @@ -29,7 +29,7 @@ BASE_EXPORT bool GetCacheDirectory(FilePath* result); // Retrieves the path to the public downloads directory. The result is placed // in the FilePath pointed to by 'result'. -bool GetDownloadsDirectory(FilePath* result); +BASE_EXPORT bool GetDownloadsDirectory(FilePath* result); // Retrieves the path to the native JNI libraries via // ApplicationInfo.nativeLibraryDir on the Java side. The result is placed in diff --git a/base/process_util.h b/base/process_util.h index 10d3028..b8ad122 100644 --- a/base/process_util.h +++ b/base/process_util.h @@ -79,7 +79,7 @@ const uint32 kProcessAccessQueryLimitedInfomation = const uint32 kProcessAccessWaitForTermination = SYNCHRONIZE; #elif defined(OS_POSIX) -struct ProcessEntry { +struct BASE_EXPORT ProcessEntry { ProcessEntry(); ~ProcessEntry(); diff --git a/chrome/chrome_android.gypi b/chrome/chrome_android.gypi index 70b7ba6..245b321 100644 --- a/chrome/chrome_android.gypi +++ b/chrome/chrome_android.gypi @@ -14,7 +14,10 @@ 'target_name': 'libchromiumtestshell', 'type': 'shared_library', 'dependencies': [ + '../base/base.gyp:base', + '../jingle/jingle.gyp:notifier', 'chrome_android_core', + 'chrome.gyp:browser_ui', ], 'sources': [ # This file must always be included in the shared_library step to ensure @@ -98,6 +101,7 @@ 'type': 'static_library', 'dependencies': [ 'chrome.gyp:browser', + 'chrome.gyp:browser_ui', 'chrome.gyp:plugin', 'chrome.gyp:renderer', 'chrome.gyp:utility', diff --git a/content/app/android/library_loader_hooks.cc b/content/app/android/library_loader_hooks.cc index 1a2fbd0..4794da1 100644 --- a/content/app/android/library_loader_hooks.cc +++ b/content/app/android/library_loader_hooks.cc @@ -23,10 +23,11 @@ #include "content/common/android/command_line.h" #include "content/public/common/content_switches.h" #include "content/public/common/result_codes.h" +#include "jni/LibraryLoader_jni.h" #include "media/base/android/media_jni_registrar.h" #include "net/android/net_jni_registrar.h" #include "ui/android/ui_jni_registrar.h" -#include "jni/LibraryLoader_jni.h" +#include "ui/shell_dialogs/android/shell_dialogs_jni_registrar.h" namespace { base::AtExitManager* g_at_exit_manager = NULL; @@ -77,6 +78,9 @@ static jint LibraryLoadedOnMainThread(JNIEnv* env, jclass clazz, if (!ui::android::RegisterJni(env)) return RESULT_CODE_FAILED_TO_REGISTER_JNI; + if (!ui::shell_dialogs::RegisterJni(env)) + return RESULT_CODE_FAILED_TO_REGISTER_JNI; + if (!content::android::RegisterCommonJni(env)) return RESULT_CODE_FAILED_TO_REGISTER_JNI; diff --git a/content/browser/renderer_host/java/java_bound_object.cc b/content/browser/renderer_host/java/java_bound_object.cc index 9d37dc3..5d50948 100644 --- a/content/browser/renderer_host/java/java_bound_object.cc +++ b/content/browser/renderer_host/java/java_bound_object.cc @@ -192,12 +192,10 @@ bool CallJNIMethod( } std::string str = base::android::ConvertJavaStringToUTF8(scoped_java_string); - // Take a copy and pass ownership to the variant. We must allocate using - // NPN_MemAlloc, to match NPN_ReleaseVariant, which uses NPN_MemFree. size_t length = str.length(); - // TODO(thakis): This causes linker errors in a components build. Figure - // out what to do. - char* buffer = static_cast<char*>(NPN_MemAlloc(length)); + // This pointer is freed in _NPN_ReleaseVariantValue in + // third_party/WebKit/Source/WebCore/bindings/v8/npruntime.cpp. + char* buffer = static_cast<char*>(malloc(length)); str.copy(buffer, length, 0); STRINGN_TO_NPVARIANT(buffer, length, *result); break; diff --git a/content/public/browser/android/content_view_core.h b/content/public/browser/android/content_view_core.h index 1ff7335..cf5f7b1 100644 --- a/content/public/browser/android/content_view_core.h +++ b/content/public/browser/android/content_view_core.h @@ -5,9 +5,10 @@ #ifndef CONTENT_PUBLIC_BROWSER_ANDROID_CONTENT_VIEW_CORE_H_ #define CONTENT_PUBLIC_BROWSER_ANDROID_CONTENT_VIEW_CORE_H_ -#include "base/android/scoped_java_ref.h" #include <jni.h> +#include "base/android/scoped_java_ref.h" +#include "content/common/content_export.h" #include "content/public/browser/navigation_controller.h" namespace cc { @@ -28,7 +29,7 @@ class WebContents; // Native side of the ContentViewCore.java, which is the primary way of // communicating with the native Chromium code on Android. This is a // public interface used by native code outside of the content module. -class ContentViewCore { +class CONTENT_EXPORT ContentViewCore { public: // Returns the existing ContentViewCore for |web_contents|, or NULL. static ContentViewCore* FromWebContents(WebContents* web_contents); diff --git a/content/public/browser/android/download_controller_android.h b/content/public/browser/android/download_controller_android.h index 308bf35..d04f047 100644 --- a/content/public/browser/android/download_controller_android.h +++ b/content/public/browser/android/download_controller_android.h @@ -5,6 +5,8 @@ #ifndef CONTENT_PUBLIC_BROWSER_ANDROID_DOWNLOAD_CONTROLLER_ANDROID_H_ #define CONTENT_PUBLIC_BROWSER_ANDROID_DOWNLOAD_CONTROLLER_ANDROID_H_ +#include "content/common/content_export.h" + namespace content { class DownloadItem; class RenderViewHost; @@ -12,7 +14,7 @@ class WebContents; // Interface to request GET downloads and send notifications for POST // downloads. -class DownloadControllerAndroid { +class CONTENT_EXPORT DownloadControllerAndroid { public: // Returns the singleton instance of the DownloadControllerAndroid. static DownloadControllerAndroid* Get(); diff --git a/content/public/test/content_test_suite_base.cc b/content/public/test/content_test_suite_base.cc index 7c8c4d3..5e99db6 100644 --- a/content/public/test/content_test_suite_base.cc +++ b/content/public/test/content_test_suite_base.cc @@ -21,6 +21,7 @@ #include "content/common/android/common_jni_registrar.h" #include "net/android/net_jni_registrar.h" #include "ui/android/ui_jni_registrar.h" +#include "ui/shell_dialogs/android/shell_dialogs_jni_registrar.h" #endif namespace content { @@ -40,6 +41,7 @@ void ContentTestSuiteBase::Initialize() { content::android::RegisterBrowserJni(env); net::android::RegisterJni(env); ui::android::RegisterJni(env); + ui::shell_dialogs::RegisterJni(env); #endif if (external_libraries_enabled_) diff --git a/media/video/capture/android/video_capture_device_android.h b/media/video/capture/android/video_capture_device_android.h index 9264eb0..d2316f5 100644 --- a/media/video/capture/android/video_capture_device_android.h +++ b/media/video/capture/android/video_capture_device_android.h @@ -11,6 +11,7 @@ #include "base/android/scoped_java_ref.h" #include "base/synchronization/lock.h" #include "base/threading/thread.h" +#include "media/base/media_export.h" #include "media/video/capture/video_capture_device.h" namespace media { @@ -19,7 +20,7 @@ namespace media { // by VideoCaptureManager on its own thread, while OnFrameAvailable is called // on JAVA thread (i.e., UI thread). Both will access |state_| and |observer_|, // but only VideoCaptureManager would change their value. -class VideoCaptureDeviceAndroid : public VideoCaptureDevice { +class MEDIA_EXPORT VideoCaptureDeviceAndroid : public VideoCaptureDevice { public: virtual ~VideoCaptureDeviceAndroid(); diff --git a/net/android/keystore.h b/net/android/keystore.h index 58a994b..6267719 100644 --- a/net/android/keystore.h +++ b/net/android/keystore.h @@ -40,8 +40,8 @@ enum PrivateKeyType { // |modulus| will receive the modulus bytes on success. // Returns true on success, or false on failure (e.g. if the key // is not RSA). -bool GetRSAKeyModulus(jobject private_key, - std::vector<uint8>* modulus); +NET_EXPORT bool GetRSAKeyModulus(jobject private_key, + std::vector<uint8>* modulus); // Returns the Q parameter of a given DSAPrivateKey platform object, // as a series of bytes, in big-endian representation. This can be used @@ -50,8 +50,8 @@ bool GetRSAKeyModulus(jobject private_key, // |q| will receive the result bytes on success. // Returns true on success, or false on failure (e.g. if the key is // not DSA). -bool GetDSAKeyParamQ(jobject private_key, - std::vector<uint8>* q); +NET_EXPORT bool GetDSAKeyParamQ(jobject private_key, + std::vector<uint8>* q); // Returns the order parameter of a given ECPrivateKey platform object, // as a series of bytes, in big-endian representation. This can be used @@ -91,7 +91,7 @@ bool RawSignDigestWithPrivateKey( // |private_key| is a JNI reference for the private key. // Returns a PrivateKeyType, while will be CLIENT_CERT_INVALID_TYPE // on error. -PrivateKeyType GetPrivateKeyType(jobject private_key); +NET_EXPORT PrivateKeyType GetPrivateKeyType(jobject private_key); // Returns a handle to the system EVP_PKEY object used to back a given // private_key object. This must *only* be used for RSA private keys diff --git a/net/android/network_library.h b/net/android/network_library.h index 451834e..6bdc1ae 100644 --- a/net/android/network_library.h +++ b/net/android/network_library.h @@ -48,9 +48,9 @@ bool StoreKeyPair(const uint8* public_key, // Helper used to pass the DER-encoded bytes of an X.509 certificate or // a PKCS#12 archive holding a private key to the CertInstaller activity. -void StoreCertificate(net::CertificateMimeType cert_type, - const void* data, - size_t data_len); +NET_EXPORT void StoreCertificate(net::CertificateMimeType cert_type, + const void* data, + size_t data_len); // Returns true if it can determine that only loopback addresses are configured. // i.e. if only 127.0.0.1 and ::1 are routable. diff --git a/ui/android/ui_jni_registrar.cc b/ui/android/ui_jni_registrar.cc index 11daf36..37a3fb8 100644 --- a/ui/android/ui_jni_registrar.cc +++ b/ui/android/ui_jni_registrar.cc @@ -9,7 +9,6 @@ #include "ui/gfx/android/device_display_info.h" #include "ui/gfx/android/java_bitmap.h" #include "ui/gfx/android/window_android.h" -#include "ui/shell_dialogs/select_file_dialog_android.h" namespace ui { namespace android { @@ -18,7 +17,6 @@ static base::android::RegistrationMethod kUiRegisteredMethods[] = { { "DeviceDisplayInfo", gfx::DeviceDisplayInfo::RegisterDeviceDisplayInfo }, { "JavaBitmap", gfx::JavaBitmap::RegisterJavaBitmap }, { "NativeWindow", ui::WindowAndroid::RegisterWindowAndroid }, - { "SelectFileDialog", ui::SelectFileDialogImpl::RegisterSelectFileDialog }, }; bool RegisterJni(JNIEnv* env) { diff --git a/ui/gfx/android/window_android.h b/ui/gfx/android/window_android.h index 8c3aa32..12d541d 100644 --- a/ui/gfx/android/window_android.h +++ b/ui/gfx/android/window_android.h @@ -8,11 +8,12 @@ #include <jni.h> #include "base/android/jni_helper.h" #include "base/android/scoped_java_ref.h" +#include "ui/base/ui_export.h" namespace ui { // Android implementation of the activity window. -class WindowAndroid { +class UI_EXPORT WindowAndroid { public: WindowAndroid(JNIEnv* env, jobject obj); diff --git a/ui/shell_dialogs.gypi b/ui/shell_dialogs.gypi index e1462c8..98855c5 100644 --- a/ui/shell_dialogs.gypi +++ b/ui/shell_dialogs.gypi @@ -18,6 +18,8 @@ 'SHELL_DIALOGS_IMPLEMENTATION', ], 'sources': [ + 'shell_dialogs/android/shell_dialogs_jni_registrar.cc', + 'shell_dialogs/android/shell_dialogs_jni_registrar.h', 'shell_dialogs/base_shell_dialog.cc', 'shell_dialogs/base_shell_dialog.h', 'shell_dialogs/base_shell_dialog_win.cc', diff --git a/ui/shell_dialogs/android/shell_dialogs_jni_registrar.cc b/ui/shell_dialogs/android/shell_dialogs_jni_registrar.cc new file mode 100644 index 0000000..d62392a --- /dev/null +++ b/ui/shell_dialogs/android/shell_dialogs_jni_registrar.cc @@ -0,0 +1,24 @@ +// Copyright (c) 2013 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 "ui/shell_dialogs/android/shell_dialogs_jni_registrar.h" + +#include "base/android/jni_android.h" +#include "base/android/jni_registrar.h" +#include "ui/shell_dialogs/select_file_dialog_android.h" + +namespace ui { +namespace shell_dialogs { + +static base::android::RegistrationMethod kUiRegisteredMethods[] = { + { "SelectFileDialog", ui::SelectFileDialogImpl::RegisterSelectFileDialog }, +}; + +bool RegisterJni(JNIEnv* env) { + return RegisterNativeMethods(env, kUiRegisteredMethods, + arraysize(kUiRegisteredMethods)); +} + +} // namespace shell_dialogs +} // namespace ui diff --git a/ui/shell_dialogs/android/shell_dialogs_jni_registrar.h b/ui/shell_dialogs/android/shell_dialogs_jni_registrar.h new file mode 100644 index 0000000..5975080 --- /dev/null +++ b/ui/shell_dialogs/android/shell_dialogs_jni_registrar.h @@ -0,0 +1,21 @@ +// Copyright (c) 2013 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 UI_SHELL_DIALOGS_ANDROID_UI_SHELL_DIALOGS_JNI_REGISTRAR_H_ +#define UI_SHELL_DIALOGS_ANDROID_UI_SHELL_DIALOGS_JNI_REGISTRAR_H_ + +#include <jni.h> + +#include "ui/shell_dialogs/shell_dialogs_export.h" + +namespace ui { +namespace shell_dialogs { + +// Register all JNI bindings necessary for chrome. +SHELL_DIALOGS_EXPORT bool RegisterJni(JNIEnv* env); + +} // namespace shell_dialogs +} // namespace ui + +#endif // UI_SHELL_DIALOGS_ANDROID_UI_SHELL_DIALOGS_JNI_REGISTRAR_H_ |