Chromium Code Reviews| Index: android_webview/native/aw_autofill_manager_delegate.cc |
| diff --git a/android_webview/browser/aw_autofill_manager_delegate.cc b/android_webview/native/aw_autofill_manager_delegate.cc |
| similarity index 68% |
| rename from android_webview/browser/aw_autofill_manager_delegate.cc |
| rename to android_webview/native/aw_autofill_manager_delegate.cc |
| index ec4b95186830a41e9e2f557ebd6791c145e47702..70d2b1d4ba83e650e2c994ac31e103f9600fdf7a 100644 |
| --- a/android_webview/browser/aw_autofill_manager_delegate.cc |
| +++ b/android_webview/native/aw_autofill_manager_delegate.cc |
| @@ -2,19 +2,23 @@ |
| // 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/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/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/browser/autocheckout/whitelist_manager.h" |
| +#include "components/autofill/browser/autofill_external_delegate.h" |
| #include "components/autofill/browser/webdata/autofill_webdata_service.h" |
| #include "components/autofill/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" |
| using content::WebContents; |
| @@ -22,9 +26,14 @@ DEFINE_WEB_CONTENTS_USER_DATA_KEY(android_webview::AwAutofillManagerDelegate); |
| namespace android_webview { |
| -AwAutofillManagerDelegate::AwAutofillManagerDelegate(WebContents* contents) { } |
| +AwAutofillManagerDelegate::AwAutofillManagerDelegate( |
| + WebContents* web_contents) { |
| + web_contents_ = web_contents; |
| +} |
| -AwAutofillManagerDelegate::~AwAutofillManagerDelegate() { } |
| +AwAutofillManagerDelegate::~AwAutofillManagerDelegate() { |
| + HideAutofillPopup(); |
| +} |
| void AwAutofillManagerDelegate::SetSaveFormData(bool enabled) { |
| save_form_data_ = enabled; |
| @@ -88,12 +97,38 @@ void AwAutofillManagerDelegate::ShowAutofillPopup( |
| 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(); |
| + |
| + AwContents* aw_contents = AwContents::FromWebContents(web_contents_); |
| + if (!aw_contents) |
| + return; |
| + aw_contents->ShowAutofillPopup(element_bounds_in_screen_space, |
|
joth
2013/06/04 01:14:46
If moving AwAutofillManagerDelegate into aw/native
sgurun-gerrit only
2013/06/15 01:16:51
Done. I have created the peer from the native side
|
| + values, |
| + labels, |
| + identifiers); |
| } |
| void AwAutofillManagerDelegate::HideAutofillPopup() { |
| + AwContents* aw_contents = AwContents::FromWebContents(web_contents_); |
| + if (!aw_contents) |
| + return; |
| + aw_contents->HideAutofillPopup(); |
|
benm (inactive)
2013/06/04 13:35:18
reset delegate_?
sgurun-gerrit only
2013/06/15 01:16:51
Done.
|
| } |
| void AwAutofillManagerDelegate::UpdateProgressBar(double value) { |
| } |
| +void AwAutofillManagerDelegate::SuggestionSelected(int position) { |
| + delegate_->DidAcceptSuggestion(values_[position], identifiers_[position]); |
|
benm (inactive)
2013/06/04 13:35:18
check delegate_ is set and still valid (as it's we
sgurun-gerrit only
2013/06/15 01:16:51
done
|
| +} |
| + |
| } // namespace android_webview |