diff options
author | boliu@chromium.org <boliu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-12 23:04:31 +0000 |
---|---|---|
committer | boliu@chromium.org <boliu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-01-12 23:04:31 +0000 |
commit | 434a1326361f04e671c0f998a60b20bab85ebaa7 (patch) | |
tree | cef45711481cadbeea31b12a505763d75ee93c54 | |
parent | 50fc3337ba7a6f22f903d8c4235afdddb535f911 (diff) | |
download | chromium_src-434a1326361f04e671c0f998a60b20bab85ebaa7.zip chromium_src-434a1326361f04e671c0f998a60b20bab85ebaa7.tar.gz chromium_src-434a1326361f04e671c0f998a60b20bab85ebaa7.tar.bz2 |
Move content/components/web_contents_delegate_android to components/web_contents_delegate_android
Moving files, change namespace from content to components,
added/updated DEPS files, and fix builds
BUG=169312
Review URL: https://chromiumcodereview.appspot.com/11823046
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@176598 0039d316-1c4b-4281-b951-d872f2087c98
33 files changed, 145 insertions, 111 deletions
diff --git a/android_webview/Android.mk b/android_webview/Android.mk index c1aa86a..312ed43 100644 --- a/android_webview/Android.mk +++ b/android_webview/Android.mk @@ -38,7 +38,7 @@ LOCAL_SRC_FILES += \ # browser components LOCAL_SRC_FILES += \ $(call all-java-files-under, \ - ../content/components/web_contents_delegate_android/java/src) \ + ../components/web_contents_delegate_android/android/java/src) \ $(call all-java-files-under, \ ../content/components/navigation_interception/java/src) \ diff --git a/android_webview/DEPS b/android_webview/DEPS index 740e94d..fa3868b 100644 --- a/android_webview/DEPS +++ b/android_webview/DEPS @@ -9,6 +9,7 @@ include_rules = [ "!chrome/browser/component", "+cc", + # TODO(boliu): Remove this when content/components is moved to components/. "+content/components", "+content/public/common", "+jni", diff --git a/android_webview/android_webview.gyp b/android_webview/android_webview.gyp index 5f95e09..ab8691e 100644 --- a/android_webview/android_webview.gyp +++ b/android_webview/android_webview.gyp @@ -100,9 +100,9 @@ 'type': 'static_library', 'dependencies': [ '../android_webview/native/webview_native.gyp:webview_native', + '../components/components.gyp:web_contents_delegate_android', '../content/content.gyp:content', '../content/content.gyp:navigation_interception', - '../content/content.gyp:web_contents_delegate_android', '../skia/skia.gyp:skia', 'android_webview_pak', ], @@ -187,7 +187,7 @@ 'dependencies': [ '../content/content.gyp:content_java', '../content/content.gyp:navigation_interception_java', - '../content/content.gyp:web_contents_delegate_android_java', + '../components/components.gyp:web_contents_delegate_android_java', '../ui/ui.gyp:ui_java', ], 'variables': { @@ -201,9 +201,9 @@ 'type': 'none', 'dependencies': [ '../base/base.gyp:base_java', + '../components/components.gyp:web_contents_delegate_android_java', '../content/content.gyp:content_java', '../content/content.gyp:navigation_interception_java', - '../content/content.gyp:web_contents_delegate_android_java', '../media/media.gyp:media_java', '../net/net.gyp:net_java', '../ui/ui.gyp:ui_java', diff --git a/android_webview/java/DEPS b/android_webview/java/DEPS index 0d019e1..9f7ec84 100644 --- a/android_webview/java/DEPS +++ b/android_webview/java/DEPS @@ -1,3 +1,4 @@ include_rules = [ "+content/public/android/java", + "+components/web_contents_delegate_android/android/java", ] diff --git a/android_webview/java/src/org/chromium/android_webview/AwWebContentsDelegate.java b/android_webview/java/src/org/chromium/android_webview/AwWebContentsDelegate.java index 3479e2e..59c6422 100644 --- a/android_webview/java/src/org/chromium/android_webview/AwWebContentsDelegate.java +++ b/android_webview/java/src/org/chromium/android_webview/AwWebContentsDelegate.java @@ -6,7 +6,7 @@ package org.chromium.android_webview; import org.chromium.base.CalledByNative; import org.chromium.base.JNINamespace; -import org.chromium.content.components.web_contents_delegate_android.WebContentsDelegateAndroid; +import org.chromium.components.web_contents_delegate_android.WebContentsDelegateAndroid; /** * WebView-specific WebContentsDelegate. diff --git a/android_webview/lib/DEPS b/android_webview/lib/DEPS index f3505d7..b0da14f 100644 --- a/android_webview/lib/DEPS +++ b/android_webview/lib/DEPS @@ -1,4 +1,5 @@ include_rules = [ "+cc/switches.h", + "+components", # For jni registers. "+content/public", ] diff --git a/android_webview/lib/main/webview_entry_point.cc b/android_webview/lib/main/webview_entry_point.cc index 567161e..a7338b1 100644 --- a/android_webview/lib/main/webview_entry_point.cc +++ b/android_webview/lib/main/webview_entry_point.cc @@ -5,9 +5,19 @@ #include "android_webview/lib/main/aw_main_delegate.h" #include "android_webview/native/android_webview_jni_registrar.h" #include "base/android/jni_android.h" +#include "base/android/jni_registrar.h" +#include "components/web_contents_delegate_android/component_jni_registrar.h" +#include "content/components/navigation_interception/component_jni_registrar.h" #include "content/public/app/android_library_loader_hooks.h" #include "content/public/app/content_main.h" +static base::android::RegistrationMethod +kWebViewDependencyRegisteredMethods[] = { + { "NavigationInterception", content::RegisterNavigationInterceptionJni }, + { "WebContentsDelegateAndroid", + components::RegisterWebContentsDelegateAndroidJni }, +}; + // This is called by the VM when the shared library is first loaded. // Most of the initialization is done in LibraryLoadedOnMainThread(), not here. JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { @@ -16,6 +26,13 @@ JNI_EXPORT jint JNI_OnLoad(JavaVM* vm, void* reserved) { if (!content::RegisterLibraryLoaderEntryHook(env)) return -1; + // Register JNI for components we depend on. + if (!RegisterNativeMethods( + env, + kWebViewDependencyRegisteredMethods, + arraysize(kWebViewDependencyRegisteredMethods))) + return -1; + if (!android_webview::RegisterJni(env)) return -1; diff --git a/android_webview/native/DEPS b/android_webview/native/DEPS index 3067d75..452c80b 100644 --- a/android_webview/native/DEPS +++ b/android_webview/native/DEPS @@ -3,6 +3,9 @@ include_rules = [ "+ui/gfx", "+ui/gl", + # Components that Android WebView depends on. + "+components/web_contents_delegate_android", + # TODO(joth): Remove if we can move the compositor driver into ../browser/ "+third_party/skia/include", ] diff --git a/android_webview/native/android_webview_jni_registrar.cc b/android_webview/native/android_webview_jni_registrar.cc index 4863295..64e6073 100644 --- a/android_webview/native/android_webview_jni_registrar.cc +++ b/android_webview/native/android_webview_jni_registrar.cc @@ -16,16 +16,10 @@ #include "android_webview/native/js_result_handler.h" #include "base/android/jni_android.h" #include "base/android/jni_registrar.h" -#include "content/components/navigation_interception/component_jni_registrar.h" -#include "content/components/web_contents_delegate_android/component_jni_registrar.h" namespace android_webview { static base::android::RegistrationMethod kWebViewRegisteredMethods[] = { - // Register JNI for components we depend on. - { "navigation_interception", content::RegisterNavigationInterceptionJni }, - { "web_contents_delegate_android", - content::RegisterWebContentsDelegateAndroidJni }, // Register JNI for android_webview classes. { "AndroidProtocolHandler", RegisterAndroidProtocolHandler }, { "AwContents", RegisterAwContents }, diff --git a/android_webview/native/aw_web_contents_delegate.h b/android_webview/native/aw_web_contents_delegate.h index c9270d0..737c6b1 100644 --- a/android_webview/native/aw_web_contents_delegate.h +++ b/android_webview/native/aw_web_contents_delegate.h @@ -7,7 +7,7 @@ #include <jni.h> -#include "content/components/web_contents_delegate_android/web_contents_delegate_android.h" +#include "components/web_contents_delegate_android/web_contents_delegate_android.h" namespace android_webview { @@ -15,7 +15,7 @@ namespace android_webview { // Should contain WebContentsDelegate code required by WebView that should not // be part of the Chromium Android port. class AwWebContentsDelegate - : public content::WebContentsDelegateAndroid { + : public components::WebContentsDelegateAndroid { public: AwWebContentsDelegate(JNIEnv* env, jobject obj); virtual ~AwWebContentsDelegate(); diff --git a/android_webview/native/webview_native.gyp b/android_webview/native/webview_native.gyp index 2d29820..431f966 100644 --- a/android_webview/native/webview_native.gyp +++ b/android_webview/native/webview_native.gyp @@ -11,7 +11,7 @@ 'type': 'static_library', 'dependencies': [ '../../base/base.gyp:base_static', - '../../content/content.gyp:web_contents_delegate_android', + '../../components/components.gyp:web_contents_delegate_android', '../../skia/skia.gyp:skia', '../../ui/gl/gl.gyp:gl', 'android_webview_native_jni', diff --git a/chrome/android/java/DEPS b/chrome/android/java/DEPS index 1a013b3..223a9fd 100644 --- a/chrome/android/java/DEPS +++ b/chrome/android/java/DEPS @@ -1,4 +1,4 @@ include_rules = [ - "+content/components/web_contents_delegate_android", + "+components/web_contents_delegate_android", "+content/public/android/java", ] diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeWebContentsDelegateAndroid.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeWebContentsDelegateAndroid.java index b9ed30c..f7abbc8 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeWebContentsDelegateAndroid.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeWebContentsDelegateAndroid.java @@ -5,7 +5,7 @@ package org.chromium.chrome.browser; import org.chromium.base.CalledByNative; -import org.chromium.content.components.web_contents_delegate_android.WebContentsDelegateAndroid; +import org.chromium.components.web_contents_delegate_android.WebContentsDelegateAndroid; /** * Chromium Android specific WebContentsDelegate. diff --git a/chrome/browser/DEPS b/chrome/browser/DEPS index 6b17612..2f2c9c2 100644 --- a/chrome/browser/DEPS +++ b/chrome/browser/DEPS @@ -4,6 +4,8 @@ include_rules = [ "+chrome/installer", "+chrome/tools/profiles", # For history unit tests. "+chromeos", + "+components/web_contents_delegate_android", + # TODO(boliu): Remove when content/components is moved to components. "+content/components", "+content/public/browser", "+device/bluetooth", diff --git a/chrome/browser/android/chrome_jni_registrar.cc b/chrome/browser/android/chrome_jni_registrar.cc index 70547bf..a55a797 100644 --- a/chrome/browser/android/chrome_jni_registrar.cc +++ b/chrome/browser/android/chrome_jni_registrar.cc @@ -17,14 +17,18 @@ #include "chrome/browser/ui/android/chrome_http_auth_handler.h" #include "chrome/browser/ui/android/javascript_app_modal_dialog_android.h" #include "chrome/browser/ui/android/navigation_popup.h" +#include "components/web_contents_delegate_android/component_jni_registrar.h" #include "content/components/navigation_interception/component_jni_registrar.h" -#include "content/components/web_contents_delegate_android/color_chooser_android.h" -#include "content/components/web_contents_delegate_android/component_jni_registrar.h" namespace chrome { namespace android { static base::android::RegistrationMethod kChromeRegisteredMethods[] = { + // Register JNI for components we depend on. + { "NavigationInterception", content::RegisterNavigationInterceptionJni }, + { "WebContentsDelegateAndroid", + components::RegisterWebContentsDelegateAndroidJni }, + // Register JNI for chrome classes. { "AutofillPopup", AutofillPopupViewAndroid::RegisterAutofillPopupViewAndroid}, { "ChromeBrowserProvider", @@ -33,7 +37,6 @@ static base::android::RegistrationMethod kChromeRegisteredMethods[] = { ChromeHttpAuthHandler::RegisterChromeHttpAuthHandler }, { "ChromeWebContentsDelegateAndroid", RegisterChromeWebContentsDelegateAndroid }, - { "ColorChooserAndroid", content::RegisterColorChooserAndroid }, { "ContentViewUtil", RegisterContentViewUtil }, { "DevToolsServer", RegisterDevToolsServer }, { "IntentHelper", RegisterIntentHelper }, @@ -42,11 +45,9 @@ static base::android::RegistrationMethod kChromeRegisteredMethods[] = { { "NavigationPopup", NavigationPopup::RegisterNavigationPopup }, { "ProcessUtils", RegisterProcessUtils }, { "SqliteCursor", SQLiteCursor::RegisterSqliteCursor }, - { "navigation_interception", content::RegisterNavigationInterceptionJni }, }; bool RegisterJni(JNIEnv* env) { - content::RegisterWebContentsDelegateAndroidJni(env); return RegisterNativeMethods(env, kChromeRegisteredMethods, arraysize(kChromeRegisteredMethods)); } diff --git a/chrome/browser/android/chrome_web_contents_delegate_android.h b/chrome/browser/android/chrome_web_contents_delegate_android.h index 31916c3..a2f0659 100644 --- a/chrome/browser/android/chrome_web_contents_delegate_android.h +++ b/chrome/browser/android/chrome_web_contents_delegate_android.h @@ -7,7 +7,7 @@ #include <jni.h> -#include "content/components/web_contents_delegate_android/web_contents_delegate_android.h" +#include "components/web_contents_delegate_android/web_contents_delegate_android.h" #include "content/public/browser/notification_observer.h" #include "content/public/browser/notification_registrar.h" @@ -30,7 +30,7 @@ namespace android { // Should contain any WebContentsDelegate implementations required by // the Chromium Android port but not to be shared with WebView. class ChromeWebContentsDelegateAndroid - : public content::WebContentsDelegateAndroid, + : public components::WebContentsDelegateAndroid, public content::NotificationObserver { public: ChromeWebContentsDelegateAndroid(JNIEnv* env, jobject obj); diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 2579fe6..4b9c83c 100644 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -1069,9 +1069,9 @@ 'type': 'none', 'dependencies': [ '../base/base.gyp:base', + '../components/components.gyp:web_contents_delegate_android_java', '../content/content.gyp:content_java', '../content/content.gyp:navigation_interception_java', - '../content/content.gyp:web_contents_delegate_android_java', '../sync/sync.gyp:sync_java', '../third_party/guava/guava.gyp:guava_javalib', '../ui/ui.gyp:ui_java', diff --git a/chrome/chrome_browser.gypi b/chrome/chrome_browser.gypi index 0a4597a..8a4d2bf 100644 --- a/chrome/chrome_browser.gypi +++ b/chrome/chrome_browser.gypi @@ -2741,7 +2741,7 @@ }], ['OS=="android"', { 'dependencies': [ - '../content/content.gyp:web_contents_delegate_android', + '../components/components.gyp:web_contents_delegate_android', 'chrome_browser_jni_headers', ], 'dependencies!': [ diff --git a/chrome/chrome_browser_ui.gypi b/chrome/chrome_browser_ui.gypi index 9aafc60..ac2b175 100644 --- a/chrome/chrome_browser_ui.gypi +++ b/chrome/chrome_browser_ui.gypi @@ -2498,7 +2498,7 @@ }], ['OS=="android"', { 'dependencies': [ - '../content/content.gyp:web_contents_delegate_android', + '../components/components.gyp:web_contents_delegate_android', 'chrome_browser_jni_headers', ], 'sources': [ diff --git a/components/components.gyp b/components/components.gyp index 31aa67a..d1ea61a 100644 --- a/components/components.gyp +++ b/components/components.gyp @@ -5,5 +5,6 @@ { 'includes': [ 'components_tests.gypi', + 'web_contents_delegate_android.gypi', ], } diff --git a/content/content_components_web_contents_delegate_android.gypi b/components/web_contents_delegate_android.gypi index 6a36a1c..00a55e0 100644 --- a/content/content_components_web_contents_delegate_android.gypi +++ b/components/web_contents_delegate_android.gypi @@ -12,12 +12,12 @@ 'type': 'static_library', 'dependencies': [ '../base/base.gyp:base', + '../content/content.gyp:content_browser', + '../content/content.gyp:content_common', '../net/net.gyp:net', '../skia/skia.gyp:skia', '../ui/ui.gyp:ui', '../webkit/support/webkit_support.gyp:glue', - 'content_browser', - 'content_common', 'web_contents_delegate_android_jni_headers', ], 'include_dirs': [ @@ -26,12 +26,12 @@ '<(SHARED_INTERMEDIATE_DIR)/web_contents_delegate_android', ], 'sources': [ - 'components/web_contents_delegate_android/color_chooser_android.cc', - 'components/web_contents_delegate_android/color_chooser_android.h', - 'components/web_contents_delegate_android/component_jni_registrar.cc', - 'components/web_contents_delegate_android/component_jni_registrar.h', - 'components/web_contents_delegate_android/web_contents_delegate_android.cc', - 'components/web_contents_delegate_android/web_contents_delegate_android.h', + 'web_contents_delegate_android/color_chooser_android.cc', + 'web_contents_delegate_android/color_chooser_android.h', + 'web_contents_delegate_android/component_jni_registrar.cc', + 'web_contents_delegate_android/component_jni_registrar.h', + 'web_contents_delegate_android/web_contents_delegate_android.cc', + 'web_contents_delegate_android/web_contents_delegate_android.h', ], }, { @@ -39,11 +39,11 @@ 'type': 'none', 'dependencies': [ '../base/base.gyp:base', - 'content_java', + '../content/content.gyp:content_java', ], 'variables': { 'package_name': 'web_contents_delegate_android', - 'java_in_dir': 'components/web_contents_delegate_android/java', + 'java_in_dir': 'web_contents_delegate_android/android/java', }, 'includes': [ '../build/java.gypi' ], }, @@ -51,8 +51,8 @@ 'target_name': 'web_contents_delegate_android_jni_headers', 'type': 'none', 'sources': [ - 'components/web_contents_delegate_android/java/src/org/chromium/content/components/web_contents_delegate_android/ColorChooserAndroid.java', - 'components/web_contents_delegate_android/java/src/org/chromium/content/components/web_contents_delegate_android/WebContentsDelegateAndroid.java', + 'web_contents_delegate_android/android/java/src/org/chromium/components/web_contents_delegate_android/ColorChooserAndroid.java', + 'web_contents_delegate_android/android/java/src/org/chromium/components/web_contents_delegate_android/WebContentsDelegateAndroid.java', ], 'variables': { 'jni_gen_dir': 'web_contents_delegate_android', diff --git a/components/web_contents_delegate_android/DEPS b/components/web_contents_delegate_android/DEPS new file mode 100644 index 0000000..01432ca --- /dev/null +++ b/components/web_contents_delegate_android/DEPS @@ -0,0 +1,6 @@ +include_rules = [ + "+content/public/browser", + "+jni", + "+ui/gfx", + "+webkit/glue", +] diff --git a/content/components/web_contents_delegate_android/OWNERS b/components/web_contents_delegate_android/OWNERS index f9dca5c..f9dca5c 100644 --- a/content/components/web_contents_delegate_android/OWNERS +++ b/components/web_contents_delegate_android/OWNERS diff --git a/content/components/web_contents_delegate_android/DEPS b/components/web_contents_delegate_android/android/DEPS index 471d9e0..45a78e4 100644 --- a/content/components/web_contents_delegate_android/DEPS +++ b/components/web_contents_delegate_android/android/DEPS @@ -1,4 +1,4 @@ include_rules = [ "+content/public/android/java", - "+content/public/browser" + "+ui/android/java", ] diff --git a/content/components/web_contents_delegate_android/java/src/org/chromium/content/components/web_contents_delegate_android/ColorChooserAndroid.java b/components/web_contents_delegate_android/android/java/src/org/chromium/components/web_contents_delegate_android/ColorChooserAndroid.java index f04573b..cdab32b 100644 --- a/content/components/web_contents_delegate_android/java/src/org/chromium/content/components/web_contents_delegate_android/ColorChooserAndroid.java +++ b/components/web_contents_delegate_android/android/java/src/org/chromium/components/web_contents_delegate_android/ColorChooserAndroid.java @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -package org.chromium.content.components.web_contents_delegate_android; +package org.chromium.components.web_contents_delegate_android; import android.content.Context; @@ -15,7 +15,7 @@ import org.chromium.ui.ColorPickerDialog; * ColorChooserAndroid communicates with the java ColorPickerDialog and the * native color_chooser_android.cc */ -@JNINamespace("content") +@JNINamespace("components") public class ColorChooserAndroid { private final ColorPickerDialog mDialog; private final int mNativeColorChooserAndroid; diff --git a/content/components/web_contents_delegate_android/java/src/org/chromium/content/components/web_contents_delegate_android/WebContentsDelegateAndroid.java b/components/web_contents_delegate_android/android/java/src/org/chromium/components/web_contents_delegate_android/WebContentsDelegateAndroid.java index b67f3e5..baedee2 100644 --- a/content/components/web_contents_delegate_android/java/src/org/chromium/content/components/web_contents_delegate_android/WebContentsDelegateAndroid.java +++ b/components/web_contents_delegate_android/android/java/src/org/chromium/components/web_contents_delegate_android/WebContentsDelegateAndroid.java @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -package org.chromium.content.components.web_contents_delegate_android; +package org.chromium.components.web_contents_delegate_android; import android.graphics.Rect; import android.view.KeyEvent; @@ -14,7 +14,7 @@ import org.chromium.content.browser.ContentViewCore; /** * Java peer of the native class of the same name. */ -@JNINamespace("content") +@JNINamespace("components") public class WebContentsDelegateAndroid { // Equivalent of WebCore::WebConsoleMessage::LevelTip. diff --git a/content/components/web_contents_delegate_android/color_chooser_android.cc b/components/web_contents_delegate_android/color_chooser_android.cc index 34ab4f0..6e4c298f 100644 --- a/content/components/web_contents_delegate_android/color_chooser_android.cc +++ b/components/web_contents_delegate_android/color_chooser_android.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/components/web_contents_delegate_android/color_chooser_android.h" +#include "components/web_contents_delegate_android/color_chooser_android.h" #include "content/public/browser/android/content_view_core.h" #include "content/public/browser/web_contents.h" @@ -10,13 +10,22 @@ namespace content { +ColorChooser* ColorChooser::Create( + int identifier, WebContents* tab, SkColor initial_color) { + return new components::ColorChooserAndroid(identifier, tab, initial_color); +} + +} // namespace content + +namespace components { + ColorChooserAndroid::ColorChooserAndroid(int identifier, content::WebContents* tab, SkColor initial_color) : ColorChooser::ColorChooser(identifier), content::WebContentsObserver(tab) { JNIEnv* env = AttachCurrentThread(); - ContentViewCore* content_view_core = tab->GetContentNativeView(); + content::ContentViewCore* content_view_core = tab->GetContentNativeView(); DCHECK(content_view_core); j_color_chooser_.Reset(Java_ColorChooserAndroid_createColorChooserAndroid( @@ -47,11 +56,6 @@ void ColorChooserAndroid::OnColorChosen(JNIEnv* env, jobject obj, jint color) { web_contents()->DidEndColorChooser(identifier()); } -content::ColorChooser* content::ColorChooser::Create( - int identifier, content::WebContents* tab, SkColor initial_color) { - return new ColorChooserAndroid(identifier, tab, initial_color); -} - // ---------------------------------------------------------------------------- // Native JNI methods // ---------------------------------------------------------------------------- @@ -59,4 +63,4 @@ bool RegisterColorChooserAndroid(JNIEnv* env) { return RegisterNativesImpl(env); } -} // namespace content +} // namespace components diff --git a/content/components/web_contents_delegate_android/color_chooser_android.h b/components/web_contents_delegate_android/color_chooser_android.h index 88cd6c3..7b9cc1a 100644 --- a/content/components/web_contents_delegate_android/color_chooser_android.h +++ b/components/web_contents_delegate_android/color_chooser_android.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CONTENT_COMPONENTS_WEB_CONTENTS_DELEGATE_ANDROID_COLOR_CHOOSER_ANDROID_H_ -#define CONTENT_COMPONENTS_WEB_CONTENTS_DELEGATE_ANDROID_COLOR_CHOOSER_ANDROID_H_ +#ifndef COMPONENTS_WEB_CONTENTS_DELEGATE_ANDROID_COLOR_CHOOSER_ANDROID_H_ +#define COMPONENTS_WEB_CONTENTS_DELEGATE_ANDROID_COLOR_CHOOSER_ANDROID_H_ #include "base/android/jni_android.h" #include "base/basictypes.h" @@ -14,7 +14,7 @@ using base::android::AttachCurrentThread; using base::android::ScopedJavaLocalRef; -namespace content { +namespace components { // Glues the Java (ColorPickerChooser.java) picker with the native part. class ColorChooserAndroid : public content::ColorChooser, @@ -39,6 +39,6 @@ class ColorChooserAndroid : public content::ColorChooser, // Native JNI methods bool RegisterColorChooserAndroid(JNIEnv* env); -} // namespace content +} // namespace components -#endif // CONTENT_COMPONENTS_WEB_CONTENTS_DELEGATE_ANDROID_COLOR_CHOOSER_ANDROID_H_ +#endif // COMPONENTS_WEB_CONTENTS_DELEGATE_ANDROID_COLOR_CHOOSER_ANDROID_H_ diff --git a/content/components/web_contents_delegate_android/component_jni_registrar.cc b/components/web_contents_delegate_android/component_jni_registrar.cc index 333d7bc..ac8b9c3 100644 --- a/content/components/web_contents_delegate_android/component_jni_registrar.cc +++ b/components/web_contents_delegate_android/component_jni_registrar.cc @@ -2,15 +2,17 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/components/web_contents_delegate_android/component_jni_registrar.h" +#include "components/web_contents_delegate_android/component_jni_registrar.h" #include "base/android/jni_android.h" #include "base/android/jni_registrar.h" -#include "content/components/web_contents_delegate_android/web_contents_delegate_android.h" +#include "components/web_contents_delegate_android/color_chooser_android.h" +#include "components/web_contents_delegate_android/web_contents_delegate_android.h" -namespace content { +namespace components { static base::android::RegistrationMethod kComponentRegisteredMethods[] = { + { "ColorChooserAndroid", RegisterColorChooserAndroid }, { "WebContentsDelegateAndroid", RegisterWebContentsDelegateAndroid }, }; @@ -19,5 +21,5 @@ bool RegisterWebContentsDelegateAndroidJni(JNIEnv* env) { kComponentRegisteredMethods, arraysize(kComponentRegisteredMethods)); } -} // namespace content +} // namespace components diff --git a/content/components/web_contents_delegate_android/component_jni_registrar.h b/components/web_contents_delegate_android/component_jni_registrar.h index ee476b3..454a3cf 100644 --- a/content/components/web_contents_delegate_android/component_jni_registrar.h +++ b/components/web_contents_delegate_android/component_jni_registrar.h @@ -2,18 +2,18 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_COMPONENT_WEB_CONTENTS_DELEGATE_ANDROID_COMPONENT_JNI_REGISTRAR_H_ -#define CHROME_BROWSER_COMPONENT_WEB_CONTENTS_DELEGATE_ANDROID_COMPONENT_JNI_REGISTRAR_H_ +#ifndef COMPONENTS_WEB_CONTENTS_DELEGATE_ANDROID_COMPONENT_JNI_REGISTRAR_H_ +#define COMPONENTS_WEB_CONTENTS_DELEGATE_ANDROID_COMPONENT_JNI_REGISTRAR_H_ #include <jni.h> -namespace content { +namespace components { // Register all JNI bindings necessary for the web_contents_delegate_android // component. bool RegisterWebContentsDelegateAndroidJni(JNIEnv* env); -} // namespace content +} // namespace components -#endif // CHROME_BROWSER_COMPONENT_WEB_CONTENTS_DELEGATE_ANDROID_COMPONENT_JNI_REGISTRAR_H_ +#endif // COMPONENTS_WEB_CONTENTS_DELEGATE_ANDROID_COMPONENT_JNI_REGISTRAR_H_ diff --git a/content/components/web_contents_delegate_android/web_contents_delegate_android.cc b/components/web_contents_delegate_android/web_contents_delegate_android.cc index 46fcf16..b13c5ed 100644 --- a/content/components/web_contents_delegate_android/web_contents_delegate_android.cc +++ b/components/web_contents_delegate_android/web_contents_delegate_android.cc @@ -2,22 +2,22 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "content/components/web_contents_delegate_android/web_contents_delegate_android.h" +#include "components/web_contents_delegate_android/web_contents_delegate_android.h" #include <android/keycodes.h> #include "base/android/jni_android.h" #include "base/android/jni_string.h" -#include "content/components/web_contents_delegate_android/color_chooser_android.h" #include "content/public/browser/android/content_view_core.h" -#include "content/public/browser/render_widget_host_view.h" +#include "content/public/browser/color_chooser.h" #include "content/public/browser/invalidate_type.h" +#include "content/public/browser/native_web_keyboard_event.h" #include "content/public/browser/page_navigator.h" -#include "content/public/browser/navigation_controller.h" -#include "content/public/browser/navigation_entry.h" +#include "content/public/browser/render_widget_host_view.h" #include "content/public/browser/web_contents.h" #include "content/public/common/page_transition_types.h" #include "content/public/common/referrer.h" +#include "googleurl/src/gurl.h" #include "jni/WebContentsDelegateAndroid_jni.h" #include "ui/gfx/rect.h" #include "webkit/glue/window_open_disposition.h" @@ -27,8 +27,11 @@ using base::android::ConvertUTF8ToJavaString; using base::android::ConvertUTF16ToJavaString; using base::android::HasClass; using base::android::ScopedJavaLocalRef; +using content::ColorChooser; +using content::WebContents; +using content::WebContentsDelegate; -namespace content { +namespace components { WebContentsDelegateAndroid::WebContentsDelegateAndroid(JNIEnv* env, jobject obj) : weak_java_delegate_(env, obj) { @@ -58,10 +61,10 @@ ColorChooser* WebContentsDelegateAndroid::OpenColorChooser( // RenderViewImpl::decidePolicyForNavigation for more details). WebContents* WebContentsDelegateAndroid::OpenURLFromTab( WebContents* source, - const OpenURLParams& params) { + const content::OpenURLParams& params) { const GURL& url = params.url; WindowOpenDisposition disposition = params.disposition; - PageTransition transition( + content::PageTransition transition( PageTransitionFromInt(params.transition)); if (!source || (disposition != CURRENT_TAB && @@ -97,7 +100,7 @@ WebContents* WebContentsDelegateAndroid::OpenURLFromTab( void WebContentsDelegateAndroid::NavigationStateChanged( const WebContents* source, unsigned changed_flags) { - if (changed_flags & INVALIDATE_TYPE_TITLE) { + if (changed_flags & content::INVALIDATE_TYPE_TITLE) { JNIEnv* env = AttachCurrentThread(); ScopedJavaLocalRef<jobject> obj = GetJavaDelegate(env); if (obj.is_null()) @@ -241,7 +244,7 @@ void WebContentsDelegateAndroid::UpdateTargetURL(WebContents* source, void WebContentsDelegateAndroid::HandleKeyboardEvent( WebContents* source, - const NativeWebKeyboardEvent& event) { + const content::NativeWebKeyboardEvent& event) { jobject key_event = event.os_event; if (key_event) { JNIEnv* env = AttachCurrentThread(); @@ -269,7 +272,7 @@ void WebContentsDelegateAndroid::ShowRepostFormWarningDialog( if (obj.is_null()) return; ScopedJavaLocalRef<jobject> content_view_core = - ContentViewCore::FromWebContents(source)->GetJavaObject(); + content::ContentViewCore::FromWebContents(source)->GetJavaObject(); if (content_view_core.is_null()) return; Java_WebContentsDelegateAndroid_showRepostFormWarningDialog(env, obj.obj(), @@ -311,4 +314,4 @@ bool RegisterWebContentsDelegateAndroid(JNIEnv* env) { return RegisterNativesImpl(env); } -} // namespace content +} // namespace components diff --git a/content/components/web_contents_delegate_android/web_contents_delegate_android.h b/components/web_contents_delegate_android/web_contents_delegate_android.h index 74291e3..030195c 100644 --- a/content/components/web_contents_delegate_android/web_contents_delegate_android.h +++ b/components/web_contents_delegate_android/web_contents_delegate_android.h @@ -2,27 +2,25 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_COMPONENT_WEB_CONTENTS_DELEGATE_ANDROID_WEB_CONTENTS_DELEGATE_ANDROID_H_ -#define CHROME_BROWSER_COMPONENT_WEB_CONTENTS_DELEGATE_ANDROID_WEB_CONTENTS_DELEGATE_ANDROID_H_ +#ifndef COMPONENTS_WEB_CONTENTS_DELEGATE_ANDROID_WEB_CONTENTS_DELEGATE_ANDROID_H_ +#define COMPONENTS_WEB_CONTENTS_DELEGATE_ANDROID_WEB_CONTENTS_DELEGATE_ANDROID_H_ #include "base/android/jni_helper.h" #include "base/android/scoped_java_ref.h" #include "base/compiler_specific.h" #include "base/memory/scoped_ptr.h" -#include "content/public/browser/native_web_keyboard_event.h" #include "content/public/browser/web_contents_delegate.h" -#include "content/public/browser/web_contents_observer.h" -#include "content/public/common/javascript_message_type.h" -#include "content/public/common/referrer.h" -#include "googleurl/src/gurl.h" -#include "net/base/net_errors.h" + +class GURL; namespace content { -class JavaScriptDialogCreator; -class RenderViewHost; class WebContents; -class WebContentsObserver; +class WebContentsDelegate; struct NativeWebKeyboardEvent; +struct OpenURLParams; +} // namespace content + +namespace components { enum WebContentsDelegateLogLevel { // Equivalent of WebCore::WebConsoleMessage::LevelTip. @@ -40,7 +38,7 @@ enum WebContentsDelegateLogLevel { // delegate for WebContents to forward calls to the java peer. The embedding // application may subclass and override methods on either the C++ or Java side // as required. -class WebContentsDelegateAndroid : public WebContentsDelegate { +class WebContentsDelegateAndroid : public content::WebContentsDelegate { public: WebContentsDelegateAndroid(JNIEnv* env, jobject obj); virtual ~WebContentsDelegateAndroid(); @@ -48,46 +46,47 @@ class WebContentsDelegateAndroid : public WebContentsDelegate { // Binds this WebContentsDelegateAndroid to the passed WebContents instance, // such that when that WebContents is destroyed, this // WebContentsDelegateAndroid instance will be destroyed too. - void SetOwnerWebContents(WebContents* contents); + void SetOwnerWebContents(content::WebContents* contents); // Overridden from WebContentsDelegate: - virtual WebContents* OpenURLFromTab( - WebContents* source, - const OpenURLParams& params) OVERRIDE; + virtual content::WebContents* OpenURLFromTab( + content::WebContents* source, + const content::OpenURLParams& params) OVERRIDE; virtual content::ColorChooser* OpenColorChooser( content::WebContents* source, int color_chooser_id, SkColor color) OVERRIDE; - virtual void NavigationStateChanged(const WebContents* source, + virtual void NavigationStateChanged(const content::WebContents* source, unsigned changed_flags) OVERRIDE; - virtual void AddNewContents(WebContents* source, - WebContents* new_contents, + virtual void AddNewContents(content::WebContents* source, + content::WebContents* new_contents, WindowOpenDisposition disposition, const gfx::Rect& initial_pos, bool user_gesture, bool* was_blocked) OVERRIDE; - virtual void ActivateContents(WebContents* contents) OVERRIDE; - virtual void DeactivateContents(WebContents* contents) OVERRIDE; - virtual void LoadingStateChanged(WebContents* source) OVERRIDE; - virtual void LoadProgressChanged(WebContents* source, + virtual void ActivateContents(content::WebContents* contents) OVERRIDE; + virtual void DeactivateContents(content::WebContents* contents) OVERRIDE; + virtual void LoadingStateChanged(content::WebContents* source) OVERRIDE; + virtual void LoadProgressChanged(content::WebContents* source, double load_progress) OVERRIDE; - virtual void CloseContents(WebContents* source) OVERRIDE; - virtual void MoveContents(WebContents* source, + virtual void CloseContents(content::WebContents* source) OVERRIDE; + virtual void MoveContents(content::WebContents* source, const gfx::Rect& pos) OVERRIDE; - virtual bool AddMessageToConsole(WebContents* source, + virtual bool AddMessageToConsole(content::WebContents* source, int32 level, const string16& message, int32 line_no, const string16& source_id) OVERRIDE; - virtual void UpdateTargetURL(WebContents* source, + virtual void UpdateTargetURL(content::WebContents* source, int32 page_id, const GURL& url) OVERRIDE; virtual void HandleKeyboardEvent( - WebContents* source, - const NativeWebKeyboardEvent& event) OVERRIDE; - virtual bool TakeFocus(WebContents* source, bool reverse) OVERRIDE; + content::WebContents* source, + const content::NativeWebKeyboardEvent& event) OVERRIDE; + virtual bool TakeFocus(content::WebContents* source, bool reverse) OVERRIDE; - virtual void ShowRepostFormWarningDialog(WebContents* source) OVERRIDE; + virtual void ShowRepostFormWarningDialog( + content::WebContents* source) OVERRIDE; virtual void ToggleFullscreenModeForTab(content::WebContents* web_contents, bool enter_fullscreen) OVERRIDE; @@ -106,6 +105,6 @@ class WebContentsDelegateAndroid : public WebContentsDelegate { bool RegisterWebContentsDelegateAndroid(JNIEnv* env); -} // namespace content +} // namespace components -#endif // CHROME_BROWSER_COMPONENT_WEB_CONTENTS_DELEGATE_ANDROID_WEB_CONTENTS_DELEGATE_ANDROID_H_ +#endif // COMPONENTS_WEB_CONTENTS_DELEGATE_ANDROID_WEB_CONTENTS_DELEGATE_ANDROID_H_ diff --git a/content/content.gyp b/content/content.gyp index f295a4f..52cfdf3 100644 --- a/content/content.gyp +++ b/content/content.gyp @@ -34,7 +34,6 @@ 'includes': [ '../build/win_precompile.gypi', 'content_components_navigation_interception.gypi', - 'content_components_web_contents_delegate_android.gypi', 'content_shell.gypi', ], }], |