diff options
29 files changed, 138 insertions, 426 deletions
diff --git a/android_webview/android_webview.gyp b/android_webview/android_webview.gyp index b78816a..f8ed864 100644 --- a/android_webview/android_webview.gyp +++ b/android_webview/android_webview.gyp @@ -84,6 +84,8 @@ '<(SHARED_INTERMEDIATE_DIR)/ui/ui_resources/', ], 'sources': [ + 'browser/aw_autofill_manager_delegate.cc', + 'browser/aw_autofill_manager_delegate.h', 'browser/aw_browser_context.cc', 'browser/aw_browser_context.h', 'browser/aw_browser_main_parts.cc', diff --git a/android_webview/browser/aw_autofill_manager_delegate.cc b/android_webview/browser/aw_autofill_manager_delegate.cc new file mode 100644 index 0000000..2f51637 --- /dev/null +++ b/android_webview/browser/aw_autofill_manager_delegate.cc @@ -0,0 +1,116 @@ +// 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 "android_webview/browser/aw_autofill_manager_delegate.h" +#include "android_webview/browser/aw_browser_context.h" +#include "android_webview/browser/aw_content_browser_client.h" +#include "android_webview/browser/aw_pref_store.h" +#include "base/logging.h" +#include "base/prefs/pref_registry_simple.h" +#include "base/prefs/pref_service.h" +#include "base/prefs/pref_service_builder.h" +#include "components/autofill/content/browser/autocheckout/whitelist_manager.h" +#include "components/autofill/core/browser/webdata/autofill_webdata_service.h" +#include "components/autofill/core/common/autofill_pref_names.h" +#include "components/user_prefs/user_prefs.h" +#include "content/public/browser/web_contents.h" + +using content::WebContents; + +DEFINE_WEB_CONTENTS_USER_DATA_KEY(android_webview::AwAutofillManagerDelegate); + +namespace android_webview { + +AwAutofillManagerDelegate::AwAutofillManagerDelegate(WebContents* contents) + : web_contents_(contents), + save_form_data_(false) { +} + +AwAutofillManagerDelegate::~AwAutofillManagerDelegate() { } + +void AwAutofillManagerDelegate::SetSaveFormData(bool enabled) { + save_form_data_ = enabled; +} + +bool AwAutofillManagerDelegate::GetSaveFormData() { + return save_form_data_; +} + +PrefService* AwAutofillManagerDelegate::GetPrefs() { + return user_prefs::UserPrefs::Get( + AwContentBrowserClient::GetAwBrowserContext()); +} + +autofill::PersonalDataManager* +AwAutofillManagerDelegate::GetPersonalDataManager() { + return NULL; +} + +autofill::autocheckout::WhitelistManager* +AwAutofillManagerDelegate::GetAutocheckoutWhitelistManager() const { + return NULL; +} + +void AwAutofillManagerDelegate::HideRequestAutocompleteDialog() { +} + +void AwAutofillManagerDelegate::OnAutocheckoutError() { +} + +void AwAutofillManagerDelegate::OnAutocheckoutSuccess() { +} + +void AwAutofillManagerDelegate::ShowAutofillSettings() { +} + +void AwAutofillManagerDelegate::ConfirmSaveCreditCard( + const autofill::AutofillMetrics& metric_logger, + const autofill::CreditCard& credit_card, + const base::Closure& save_card_callback) { +} + +void AwAutofillManagerDelegate::ShowAutocheckoutBubble( + const gfx::RectF& bounding_box, + bool is_google_user, + const base::Callback<void(bool)>& callback) { +} + +void AwAutofillManagerDelegate::HideAutocheckoutBubble() { +} + +void AwAutofillManagerDelegate::ShowRequestAutocompleteDialog( + const autofill::FormData& form, + const GURL& source_url, + autofill::DialogType dialog_type, + const base::Callback<void(const autofill::FormStructure*, + const std::string&)>& callback) { +} + +void AwAutofillManagerDelegate::ShowAutofillPopup( + const gfx::RectF& element_bounds, + base::i18n::TextDirection text_direction, + const std::vector<string16>& values, + const std::vector<string16>& labels, + const std::vector<string16>& icons, + const std::vector<int>& identifiers, + base::WeakPtr<autofill::AutofillPopupDelegate> delegate) { +} + +void AwAutofillManagerDelegate::HideAutofillPopup() { +} + +void AwAutofillManagerDelegate::AddAutocheckoutStep( + autofill::AutocheckoutStepType step_type) { +} + +void AwAutofillManagerDelegate::UpdateAutocheckoutStep( + autofill::AutocheckoutStepType step_type, + autofill::AutocheckoutStepStatus step_status) { +} + +bool AwAutofillManagerDelegate::IsAutocompleteEnabled() { + return GetSaveFormData(); +} + +} // namespace android_webview diff --git a/android_webview/native/aw_autofill_manager_delegate.h b/android_webview/browser/aw_autofill_manager_delegate.h index 301dd23..e9ec7c5 100644 --- a/android_webview/native/aw_autofill_manager_delegate.h +++ b/android_webview/browser/aw_autofill_manager_delegate.h @@ -1,14 +1,10 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// 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 ANDROID_WEBVIEW_BROWSER_AW_AUTOFILL_MANAGER_DELEGATE_H_ #define ANDROID_WEBVIEW_BROWSER_AW_AUTOFILL_MANAGER_DELEGATE_H_ -#include <jni.h> -#include <vector> - -#include "base/android/jni_helper.h" #include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/prefs/pref_registry_simple.h" @@ -33,10 +29,6 @@ namespace content { class WebContents; } -namespace gfx { -class RectF; -} - class PersonalDataManager; class PrefService; @@ -99,33 +91,18 @@ class AwAutofillManagerDelegate autofill::AutocheckoutStepType step_type, autofill::AutocheckoutStepStatus step_status) OVERRIDE; - void SuggestionSelected(JNIEnv* env, - jobject obj, - jint position); private: - AwAutofillManagerDelegate(content::WebContents* web_contents); + AwAutofillManagerDelegate(content::WebContents* contents); friend class content::WebContentsUserData<AwAutofillManagerDelegate>; - void ShowAutofillPopupImpl(const gfx::RectF& element_bounds, - const std::vector<string16>& values, - const std::vector<string16>& labels, - const std::vector<int>& identifiers); - // The web_contents associated with this delegate. content::WebContents* web_contents_; - bool save_form_data_; - JavaObjectWeakGlobalRef java_ref_; - // The current Autofill query values. - std::vector<string16> values_; - std::vector<int> identifiers_; - base::WeakPtr<autofill::AutofillPopupDelegate> delegate_; + bool save_form_data_; DISALLOW_COPY_AND_ASSIGN(AwAutofillManagerDelegate); }; -bool RegisterAwAutofillManagerDelegate(JNIEnv* env); - } // namespace android_webview #endif // ANDROID_WEBVIEW_BROWSER_AW_AUTOFILL_MANAGER_DELEGATE_H_ diff --git a/android_webview/browser/aw_browser_context.h b/android_webview/browser/aw_browser_context.h index 4f281c1..8962e49 100644 --- a/android_webview/browser/aw_browser_context.h +++ b/android_webview/browser/aw_browser_context.h @@ -7,6 +7,7 @@ #include <vector> +#include "android_webview/browser/aw_autofill_manager_delegate.h" #include "android_webview/browser/aw_download_manager_delegate.h" #include "base/basictypes.h" #include "base/compiler_specific.h" @@ -109,6 +110,7 @@ class AwBrowserContext : public content::BrowserContext, geolocation_permission_context_; scoped_ptr<AwQuotaManagerBridge> quota_manager_bridge_; scoped_ptr<AwFormDatabaseService> form_database_service_; + scoped_ptr<AwAutofillManagerDelegate> autofill_manager_delegate_; AwDownloadManagerDelegate download_manager_delegate_; diff --git a/android_webview/java/src/org/chromium/android_webview/AwAutofillManagerDelegate.java b/android_webview/java/src/org/chromium/android_webview/AwAutofillManagerDelegate.java deleted file mode 100644 index c526e58..0000000 --- a/android_webview/java/src/org/chromium/android_webview/AwAutofillManagerDelegate.java +++ /dev/null @@ -1,123 +0,0 @@ -// Copyright 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. - -package org.chromium.android_webview; - -import android.content.Context; -import android.view.View; -import android.view.ViewGroup; -import android.widget.AbsoluteLayout; - -import org.chromium.base.CalledByNative; -import org.chromium.base.JNINamespace; -import org.chromium.content.browser.ContentViewCore; -import org.chromium.ui.ViewAndroidDelegate; -import org.chromium.ui.autofill.AutofillPopup; -import org.chromium.ui.autofill.AutofillSuggestion; - -// Java counterpart to the AwAutofillManagerDelegate. This class is owned by -// AwContents and has a weak reference from native side. -@JNINamespace("android_webview") -public class AwAutofillManagerDelegate { - - private final int mNativeAwAutofillManagerDelegate; - private AutofillPopup mAutofillPopup; - private ViewGroup mContainerView; - private double mDIPScale; - private ContentViewCore mContentViewCore; - - @CalledByNative - public static AwAutofillManagerDelegate create(int nativeDelegate) { - return new AwAutofillManagerDelegate(nativeDelegate); - } - - private AwAutofillManagerDelegate(int nativeAwAutofillManagerDelegate) { - mNativeAwAutofillManagerDelegate = nativeAwAutofillManagerDelegate; - } - - public void init(ContentViewCore contentViewCore, double DIPScale) { - mContentViewCore = contentViewCore; - mContainerView = contentViewCore.getContainerView(); - mDIPScale = DIPScale; - } - - @CalledByNative - private void showAutofillPopup(float x, float y, float width, float height, - AutofillSuggestion[] suggestions) { - - if (mContentViewCore == null) return; - - if (mAutofillPopup == null) { - mAutofillPopup = new AutofillPopup( - mContentViewCore.getContext(), - getViewAndroidDelegate(), - new AutofillPopup.AutofillPopupDelegate() { - public void requestHide() { } - public void suggestionSelected(int listIndex) { - nativeSuggestionSelected(mNativeAwAutofillManagerDelegate, listIndex); - } - }); - } - mAutofillPopup.setAnchorRect(x, y, width, height); - mAutofillPopup.show(suggestions); - } - - @CalledByNative - public void hideAutofillPopup() { - if (mAutofillPopup == null) - return; - mAutofillPopup.hide(); - mAutofillPopup = null; - } - - private ViewAndroidDelegate getViewAndroidDelegate() { - return new ViewAndroidDelegate() { - @Override - public View acquireAnchorView() { - View anchorView = new View(mContentViewCore.getContext()); - mContainerView.addView(anchorView); - return anchorView; - } - - @Override - public void setAnchorViewPosition( - View view, float x, float y, float width, float height) { - assert(view.getParent() == mContainerView); - - int leftMargin = (int)Math.round(x * mDIPScale); - int topMargin = (int)mContentViewCore.getRenderCoordinates().getContentOffsetYPix() - + (int)Math.round(y * mDIPScale); - - AbsoluteLayout.LayoutParams lp = new AbsoluteLayout.LayoutParams((int)width, - (int)height, leftMargin, topMargin); - view.setLayoutParams(lp); - } - - @Override - public void releaseAnchorView(View anchorView) { - mContainerView.removeView(anchorView); - } - }; - } - - @CalledByNative - private static AutofillSuggestion[] createAutofillSuggestionArray(int size) { - return new AutofillSuggestion[size]; - } - - /** - * @param array AutofillSuggestion array that should get a new suggestion added. - * @param index Index in the array where to place a new suggestion. - * @param name Name of the suggestion. - * @param label Label of the suggestion. - * @param uniqueId Unique suggestion id. - */ - @CalledByNative - private static void addToAutofillSuggestionArray(AutofillSuggestion[] array, int index, - String name, String label, int uniqueId) { - array[index] = new AutofillSuggestion(name, label, uniqueId); - } - - private native void nativeSuggestionSelected(int nativeAwAutofillManagerDelegate, int position); -} diff --git a/android_webview/java/src/org/chromium/android_webview/AwContents.java b/android_webview/java/src/org/chromium/android_webview/AwContents.java index f2f80b6..9da7fd5 100644 --- a/android_webview/java/src/org/chromium/android_webview/AwContents.java +++ b/android_webview/java/src/org/chromium/android_webview/AwContents.java @@ -153,8 +153,6 @@ public class AwContents { private boolean mContainerViewFocused; private boolean mWindowFocused; - private AwAutofillManagerDelegate mAwAutofillManagerDelegate; - private static final class DestroyRunnable implements Runnable { private int mNativeAwContents; private DestroyRunnable(int nativeAwContents) { @@ -1332,14 +1330,6 @@ public class AwContents { return mContentViewCore.performAccessibilityAction(action, arguments); } - /** - * @see android.webkit.WebView#clearFormData() - */ - public void hideAutofillPopup() { - if (mAwAutofillManagerDelegate != null) - mAwAutofillManagerDelegate.hideAutofillPopup(); - } - //-------------------------------------------------------------------------------------------- // Methods called from native via JNI //-------------------------------------------------------------------------------------------- @@ -1479,12 +1469,6 @@ public class AwContents { mScrollOffsetManager.scrollContainerViewTo(x, y); } - @CalledByNative - private void setAwAutofillManagerDelegate(AwAutofillManagerDelegate delegate) { - mAwAutofillManagerDelegate = delegate; - delegate.init(mContentViewCore, mDIPScale); - } - // ------------------------------------------------------------------------------------------- // Helper methods // ------------------------------------------------------------------------------------------- diff --git a/android_webview/native/DEPS b/android_webview/native/DEPS index b45be10..2622847 100644 --- a/android_webview/native/DEPS +++ b/android_webview/native/DEPS @@ -5,8 +5,6 @@ include_rules = [ # Components that Android WebView depends on. "+components/autofill/content/browser", "+components/autofill/core/browser", - "+components/autofill/core/common", "+components/navigation_interception", - "+components/user_prefs", "+components/web_contents_delegate_android", ] diff --git a/android_webview/native/android_webview_jni_registrar.cc b/android_webview/native/android_webview_jni_registrar.cc index 9202999..05f4388 100644 --- a/android_webview/native/android_webview_jni_registrar.cc +++ b/android_webview/native/android_webview_jni_registrar.cc @@ -5,7 +5,6 @@ #include "android_webview/native/android_webview_jni_registrar.h" #include "android_webview/native/android_protocol_handler.h" -#include "android_webview/native/aw_autofill_manager_delegate.h" #include "android_webview/native/aw_contents.h" #include "android_webview/native/aw_contents_client_bridge.h" #include "android_webview/native/aw_contents_io_thread_client_impl.h" @@ -28,7 +27,6 @@ namespace android_webview { static base::android::RegistrationMethod kWebViewRegisteredMethods[] = { // Register JNI for android_webview classes. { "AndroidProtocolHandler", RegisterAndroidProtocolHandler }, - { "AwAutofillManagerDelegate", RegisterAwAutofillManagerDelegate }, { "AwContents", RegisterAwContents }, { "AwContentsClientBridge", RegisterAwContentsClientBridge }, { "AwContentsIoThreadClientImpl", RegisterAwContentsIoThreadClientImpl}, diff --git a/android_webview/native/aw_autofill_manager_delegate.cc b/android_webview/native/aw_autofill_manager_delegate.cc deleted file mode 100644 index ca650e8..0000000 --- a/android_webview/native/aw_autofill_manager_delegate.cc +++ /dev/null @@ -1,219 +0,0 @@ -// Copyright 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 "android_webview/native/aw_autofill_manager_delegate.h" - -#include "android_webview/browser/aw_browser_context.h" -#include "android_webview/browser/aw_content_browser_client.h" -#include "android_webview/browser/aw_pref_store.h" -#include "android_webview/native/aw_contents.h" -#include "base/android/jni_android.h" -#include "base/android/jni_string.h" -#include "base/android/scoped_java_ref.h" -#include "base/logging.h" -#include "base/prefs/pref_registry_simple.h" -#include "base/prefs/pref_service.h" -#include "base/prefs/pref_service_builder.h" -#include "components/autofill/content/browser/autocheckout/whitelist_manager.h" -#include "components/autofill/core/browser/autofill_popup_delegate.h" -#include "components/autofill/core/common/autofill_pref_names.h" -#include "components/user_prefs/user_prefs.h" -#include "content/public/browser/web_contents.h" -#include "content/public/browser/web_contents_view.h" -#include "jni/AwAutofillManagerDelegate_jni.h" - -using base::android::AttachCurrentThread; -using base::android::ConvertUTF16ToJavaString; -using base::android::ScopedJavaLocalRef; -using content::WebContents; - -DEFINE_WEB_CONTENTS_USER_DATA_KEY(android_webview::AwAutofillManagerDelegate); - -namespace android_webview { - -// Ownership: The native object is created (if autofill enabled) and owned by -// AwContents. The native object creates the java peer which handles most -// autofill functionality at the java side. The java peer is owned by Java -// AwContents. The native object only maintains a weak ref to it. -AwAutofillManagerDelegate::AwAutofillManagerDelegate(WebContents* contents) - : web_contents_(contents), - save_form_data_(false) { - JNIEnv* env = AttachCurrentThread(); - ScopedJavaLocalRef<jobject> delegate; - delegate.Reset( - Java_AwAutofillManagerDelegate_create(env, reinterpret_cast<jint>(this))); - - AwContents* aw_contents = AwContents::FromWebContents(web_contents_); - aw_contents->SetAwAutofillManagerDelegate(delegate.obj()); - java_ref_ = JavaObjectWeakGlobalRef(env, delegate.obj()); -} - -AwAutofillManagerDelegate::~AwAutofillManagerDelegate() { - HideAutofillPopup(); -} - -void AwAutofillManagerDelegate::SetSaveFormData(bool enabled) { - save_form_data_ = enabled; -} - -bool AwAutofillManagerDelegate::GetSaveFormData() { - return save_form_data_; -} - -PrefService* AwAutofillManagerDelegate::GetPrefs() { - return user_prefs::UserPrefs::Get( - AwContentBrowserClient::GetAwBrowserContext()); -} - -autofill::PersonalDataManager* -AwAutofillManagerDelegate::GetPersonalDataManager() { - return NULL; -} - -autofill::autocheckout::WhitelistManager* -AwAutofillManagerDelegate::GetAutocheckoutWhitelistManager() const { - return NULL; -} - -void AwAutofillManagerDelegate::ShowAutofillPopup( - const gfx::RectF& element_bounds, - base::i18n::TextDirection text_direction, - const std::vector<string16>& values, - const std::vector<string16>& labels, - const std::vector<string16>& icons, - const std::vector<int>& identifiers, - base::WeakPtr<autofill::AutofillPopupDelegate> delegate) { - - values_ = values; - identifiers_ = identifiers; - delegate_ = delegate; - - // Convert element_bounds to be in screen space. - gfx::Rect client_area; - web_contents_->GetView()->GetContainerBounds(&client_area); - gfx::RectF element_bounds_in_screen_space = - element_bounds + client_area.OffsetFromOrigin(); - - ShowAutofillPopupImpl(element_bounds_in_screen_space, - values, - labels, - identifiers); -} - -void AwAutofillManagerDelegate::ShowAutofillPopupImpl( - const gfx::RectF& element_bounds, - const std::vector<string16>& values, - const std::vector<string16>& labels, - const std::vector<int>& identifiers) { - JNIEnv* env = AttachCurrentThread(); - ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); - if (obj.is_null()) - return; - - // We need an array of AutofillSuggestion. - size_t count = values.size(); - - ScopedJavaLocalRef<jobjectArray> data_array = - Java_AwAutofillManagerDelegate_createAutofillSuggestionArray(env, count); - - for (size_t i = 0; i < count; ++i) { - ScopedJavaLocalRef<jstring> name = ConvertUTF16ToJavaString(env, values[i]); - ScopedJavaLocalRef<jstring> label = - ConvertUTF16ToJavaString(env, labels[i]); - Java_AwAutofillManagerDelegate_addToAutofillSuggestionArray( - env, - data_array.obj(), - i, - name.obj(), - label.obj(), - identifiers[i]); - } - - Java_AwAutofillManagerDelegate_showAutofillPopup( - env, - obj.obj(), - element_bounds.x(), - element_bounds.y(), element_bounds.width(), - element_bounds.height(), data_array.obj()); -} - -void AwAutofillManagerDelegate::HideAutofillPopup() { - JNIEnv* env = AttachCurrentThread(); - ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); - if (obj.is_null()) - return; - delegate_.reset(); - Java_AwAutofillManagerDelegate_hideAutofillPopup(env, obj.obj()); -} - -bool AwAutofillManagerDelegate::IsAutocompleteEnabled() { - return GetSaveFormData(); -} - -void AwAutofillManagerDelegate::SuggestionSelected(JNIEnv* env, - jobject object, - jint position) { - if (delegate_) - delegate_->DidAcceptSuggestion(values_[position], identifiers_[position]); -} - -void AwAutofillManagerDelegate::HideRequestAutocompleteDialog() { - NOTREACHED(); -} - -void AwAutofillManagerDelegate::OnAutocheckoutError() { - NOTREACHED(); -} - -void AwAutofillManagerDelegate::OnAutocheckoutSuccess() { - NOTREACHED(); -} - -void AwAutofillManagerDelegate::ShowAutofillSettings() { - NOTREACHED(); -} - -void AwAutofillManagerDelegate::ConfirmSaveCreditCard( - const autofill::AutofillMetrics& metric_logger, - const autofill::CreditCard& credit_card, - const base::Closure& save_card_callback) { - NOTREACHED(); -} - -void AwAutofillManagerDelegate::ShowAutocheckoutBubble( - const gfx::RectF& bounding_box, - bool is_google_user, - const base::Callback<void(bool)>& callback) { - NOTREACHED(); -} - -void AwAutofillManagerDelegate::HideAutocheckoutBubble() { - NOTREACHED(); -} - -void AwAutofillManagerDelegate::ShowRequestAutocompleteDialog( - const autofill::FormData& form, - const GURL& source_url, - autofill::DialogType dialog_type, - const base::Callback<void(const autofill::FormStructure*, - const std::string&)>& callback) { - NOTREACHED(); -} - -void AwAutofillManagerDelegate::AddAutocheckoutStep( - autofill::AutocheckoutStepType step_type) { - NOTREACHED(); -} - -void AwAutofillManagerDelegate::UpdateAutocheckoutStep( - autofill::AutocheckoutStepType step_type, - autofill::AutocheckoutStepStatus step_status) { - NOTREACHED(); -} - -bool RegisterAwAutofillManagerDelegate(JNIEnv* env) { - return RegisterNativesImpl(env) >= 0; -} - -} // namespace android_webview diff --git a/android_webview/native/aw_contents.cc b/android_webview/native/aw_contents.cc index f87a8dd..93f9f91 100644 --- a/android_webview/native/aw_contents.cc +++ b/android_webview/native/aw_contents.cc @@ -11,7 +11,6 @@ #include "android_webview/browser/net_disk_cache_remover.h" #include "android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.h" #include "android_webview/common/aw_hit_test_data.h" -#include "android_webview/native/aw_autofill_manager_delegate.h" #include "android_webview/native/aw_browser_dependency_factory.h" #include "android_webview/native/aw_contents_client_bridge.h" #include "android_webview/native/aw_contents_io_thread_client_impl.h" @@ -193,7 +192,7 @@ void AwContents::InitAutofillIfNecessary(bool enabled) { // Do not initialize if the feature is not enabled. if (!enabled) return; - // Check if the autofill driver already exists. + // Check if the autofill manager already exists. content::WebContents* web_contents = web_contents_.get(); if (AutofillDriverImpl::FromWebContents(web_contents)) return; @@ -208,14 +207,6 @@ void AwContents::InitAutofillIfNecessary(bool enabled) { AutofillManager::DISABLE_AUTOFILL_DOWNLOAD_MANAGER); } -void AwContents::SetAwAutofillManagerDelegate(jobject delegate) { - JNIEnv* env = AttachCurrentThread(); - ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); - if (obj.is_null()) - return; - Java_AwContents_setAwAutofillManagerDelegate(env, obj.obj(), delegate); -} - AwContents::~AwContents() { DCHECK(AwContents::FromWebContents(web_contents_.get()) == this); web_contents_->RemoveUserData(kAwContentsUserDataKey); diff --git a/android_webview/native/aw_contents.h b/android_webview/native/aw_contents.h index 40e3551..f5a6742 100644 --- a/android_webview/native/aw_contents.h +++ b/android_webview/native/aw_contents.h @@ -158,8 +158,6 @@ class AwContents : public FindHelper::Listener, void SetSaveFormData(bool enabled); - // Sets the java delegate - void SetAwAutofillManagerDelegate(jobject delegate); private: void InitAutofillIfNecessary(bool enabled); diff --git a/android_webview/native/webview_native.gyp b/android_webview/native/webview_native.gyp index 5090d7c..35a5cb5 100644 --- a/android_webview/native/webview_native.gyp +++ b/android_webview/native/webview_native.gyp @@ -34,8 +34,6 @@ 'android_protocol_handler.h', 'android_webview_jni_registrar.cc', 'android_webview_jni_registrar.h', - 'aw_autofill_manager_delegate.cc', - 'aw_autofill_manager_delegate.h', 'aw_browser_dependency_factory.cc', 'aw_browser_dependency_factory.h', 'aw_contents.cc', @@ -87,7 +85,6 @@ 'type': 'none', 'sources': [ '../java/src/org/chromium/android_webview/AndroidProtocolHandler.java', - '../java/src/org/chromium/android_webview/AwAutofillManagerDelegate.java', '../java/src/org/chromium/android_webview/AwContents.java', '../java/src/org/chromium/android_webview/AwContentsClientBridge.java', '../java/src/org/chromium/android_webview/AwContentsIoThreadClient.java', diff --git a/chrome/android/java/res/drawable-hdpi/autofill_popup_background_down.9.png b/chrome/android/java/res/drawable-hdpi/autofill_popup_background_down.9.png Binary files differnew file mode 100644 index 0000000..62478fc --- /dev/null +++ b/chrome/android/java/res/drawable-hdpi/autofill_popup_background_down.9.png diff --git a/chrome/android/java/res/drawable-hdpi/autofill_popup_background_up.9.png b/chrome/android/java/res/drawable-hdpi/autofill_popup_background_up.9.png Binary files differnew file mode 100644 index 0000000..290f526 --- /dev/null +++ b/chrome/android/java/res/drawable-hdpi/autofill_popup_background_up.9.png diff --git a/chrome/android/java/res/drawable-ldpi/autofill_popup_background_down.9.png b/chrome/android/java/res/drawable-ldpi/autofill_popup_background_down.9.png Binary files differnew file mode 100644 index 0000000..0fb3b87 --- /dev/null +++ b/chrome/android/java/res/drawable-ldpi/autofill_popup_background_down.9.png diff --git a/chrome/android/java/res/drawable-ldpi/autofill_popup_background_up.9.png b/chrome/android/java/res/drawable-ldpi/autofill_popup_background_up.9.png Binary files differnew file mode 100644 index 0000000..4ab1786 --- /dev/null +++ b/chrome/android/java/res/drawable-ldpi/autofill_popup_background_up.9.png diff --git a/chrome/android/java/res/drawable-xhdpi/autofill_popup_background_down.9.png b/chrome/android/java/res/drawable-xhdpi/autofill_popup_background_down.9.png Binary files differnew file mode 100644 index 0000000..ab4d02c --- /dev/null +++ b/chrome/android/java/res/drawable-xhdpi/autofill_popup_background_down.9.png diff --git a/chrome/android/java/res/drawable-xhdpi/autofill_popup_background_up.9.png b/chrome/android/java/res/drawable-xhdpi/autofill_popup_background_up.9.png Binary files differnew file mode 100644 index 0000000..cf3f9e6 --- /dev/null +++ b/chrome/android/java/res/drawable-xhdpi/autofill_popup_background_up.9.png diff --git a/ui/android/java/res/drawable/autofill_popup_background.xml b/chrome/android/java/res/drawable/autofill_popup_background.xml index 0f8d38b..0f8d38b 100644 --- a/ui/android/java/res/drawable/autofill_popup_background.xml +++ b/chrome/android/java/res/drawable/autofill_popup_background.xml diff --git a/chrome/android/java/res/drawable/autofill_popup_background_down.9.png b/chrome/android/java/res/drawable/autofill_popup_background_down.9.png Binary files differnew file mode 100644 index 0000000..2022fd7 --- /dev/null +++ b/chrome/android/java/res/drawable/autofill_popup_background_down.9.png diff --git a/chrome/android/java/res/drawable/autofill_popup_background_up.9.png b/chrome/android/java/res/drawable/autofill_popup_background_up.9.png Binary files differnew file mode 100644 index 0000000..62fc5a6 --- /dev/null +++ b/chrome/android/java/res/drawable/autofill_popup_background_up.9.png diff --git a/ui/android/java/res/layout/autofill_text.xml b/chrome/android/java/res/layout/autofill_text.xml index 4a69862..f8c28b3 100644 --- a/ui/android/java/res/layout/autofill_text.xml +++ b/chrome/android/java/res/layout/autofill_text.xml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="utf-8"?> -<!-- Copyright 2013 The Chromium Authors. All rights reserved. +<!-- 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. diff --git a/ui/android/java/res/values-v17/styles.xml b/chrome/android/java/res/values-v17/styles.xml index 8295ddf..8295ddf 100644 --- a/ui/android/java/res/values-v17/styles.xml +++ b/chrome/android/java/res/values-v17/styles.xml diff --git a/ui/android/java/src/org/chromium/ui/autofill/AutofillListAdapter.java b/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillListAdapter.java index 62203dc..0e1df16 100644 --- a/ui/android/java/src/org/chromium/ui/autofill/AutofillListAdapter.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillListAdapter.java @@ -1,20 +1,18 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// 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.ui.autofill; +package org.chromium.chrome.browser.autofill; import android.content.Context; import android.text.TextUtils; - import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; import android.widget.ArrayAdapter; import android.widget.TextView; -import org.chromium.ui.R; +import org.chromium.chrome.R; import java.util.ArrayList; diff --git a/ui/android/java/src/org/chromium/ui/autofill/AutofillPopup.java b/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillPopup.java index 7cec3c1..7601be8 100644 --- a/ui/android/java/src/org/chromium/ui/autofill/AutofillPopup.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillPopup.java @@ -1,8 +1,8 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// 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.ui.autofill; +package org.chromium.chrome.browser.autofill; import android.content.Context; import android.graphics.Paint; @@ -17,7 +17,7 @@ import android.widget.TextView; import java.util.ArrayList; -import org.chromium.ui.R; +import org.chromium.chrome.R; import org.chromium.ui.ViewAndroidDelegate; /** @@ -140,6 +140,7 @@ public class AutofillPopup extends ListPopupWindow implements AdapterView.OnItem setAdapter(new AutofillListAdapter(mContext, cleanedData)); // Once the mAnchorRect is resized and placed correctly, it will show the Autofill popup. mAnchorWidth = Math.max(getDesiredWidth(cleanedData), mAnchorWidth); + mViewAndroidDelegate.setAnchorViewPosition(mAnchorView, mAnchorX, mAnchorY, mAnchorWidth, mAnchorHeight); } diff --git a/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillPopupGlue.java b/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillPopupGlue.java index fc8f4ed..4a2f941 100644 --- a/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillPopupGlue.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillPopupGlue.java @@ -6,12 +6,10 @@ package org.chromium.chrome.browser.autofill; import org.chromium.base.CalledByNative; import org.chromium.base.JNINamespace; +import org.chromium.chrome.browser.autofill.AutofillPopup.AutofillPopupDelegate; import org.chromium.ui.ViewAndroid; import org.chromium.ui.ViewAndroidDelegate; import org.chromium.ui.WindowAndroid; -import org.chromium.ui.autofill.AutofillPopup; -import org.chromium.ui.autofill.AutofillPopup.AutofillPopupDelegate; -import org.chromium.ui.autofill.AutofillSuggestion; /** * JNI call glue for AutofillExternalDelagate C++ and Java objects. diff --git a/ui/android/java/src/org/chromium/ui/autofill/AutofillSuggestion.java b/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillSuggestion.java index 51669ea..5ea57ed 100644 --- a/ui/android/java/src/org/chromium/ui/autofill/AutofillSuggestion.java +++ b/chrome/android/java/src/org/chromium/chrome/browser/autofill/AutofillSuggestion.java @@ -1,8 +1,8 @@ -// Copyright 2013 The Chromium Authors. All rights reserved. +// 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.ui.autofill; +package org.chromium.chrome.browser.autofill; /** * Autofill suggestion container used to store information needed for each Autofill popup entry. diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillTest.java b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillTest.java index 94d2b53..d324b9f 100644 --- a/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillTest.java +++ b/chrome/android/javatests/src/org/chromium/chrome/browser/autofill/AutofillTest.java @@ -7,6 +7,9 @@ package org.chromium.chrome.browser.autofill; import android.test.suitebuilder.annotation.SmallTest; import org.chromium.base.test.util.Feature; +import org.chromium.chrome.browser.autofill.AutofillPopup; +import org.chromium.chrome.browser.autofill.AutofillPopup.AutofillPopupDelegate; +import org.chromium.chrome.browser.autofill.AutofillSuggestion; import org.chromium.chrome.testshell.ChromiumTestShellActivity; import org.chromium.chrome.testshell.ChromiumTestShellTestBase; import org.chromium.content.browser.test.util.TouchCommon; @@ -15,9 +18,6 @@ import org.chromium.content.browser.test.util.Criteria; import org.chromium.content.browser.test.util.CriteriaHelper; import org.chromium.ui.ViewAndroidDelegate; import org.chromium.ui.WindowAndroid; -import org.chromium.ui.autofill.AutofillPopup; -import org.chromium.ui.autofill.AutofillPopup.AutofillPopupDelegate; -import org.chromium.ui.autofill.AutofillSuggestion; import java.util.concurrent.atomic.AtomicBoolean; diff --git a/ui/android/java/resource_map/org/chromium/ui/R.java b/ui/android/java/resource_map/org/chromium/ui/R.java index 0c61b4b..0577d39 100644 --- a/ui/android/java/resource_map/org/chromium/ui/R.java +++ b/ui/android/java/resource_map/org/chromium/ui/R.java @@ -27,8 +27,6 @@ public final class R { public static int color_picker_dialog_title; } public static final class id { - public static int autofill_label; - public static int autofill_sublabel; public static int selected_color_view; public static int title; public static int more_colors_button; @@ -41,7 +39,6 @@ public final class R { public static int seek_bar; } public static final class layout { - public static int autofill_text; public static int color_picker_dialog_title; public static int color_picker_dialog_content; public static int color_picker_advanced_component; @@ -49,7 +46,4 @@ public final class R { public static final class drawable { public static int color_picker_advanced_select_handle; } - public static final class style { - public static int AutofillPopupWindow; - } } |