Index: android_webview/native/aw_autofill_client.cc |
diff --git a/android_webview/native/aw_autofill_manager_delegate.cc b/android_webview/native/aw_autofill_client.cc |
similarity index 63% |
rename from android_webview/native/aw_autofill_manager_delegate.cc |
rename to android_webview/native/aw_autofill_client.cc |
index 93e04be4163869776e67f52353a17954e220c3a2..651e01a6fdfd3fc87c3421fa6be4a3c2a30add66 100644 |
--- a/android_webview/native/aw_autofill_manager_delegate.cc |
+++ b/android_webview/native/aw_autofill_client.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 "android_webview/native/aw_autofill_manager_delegate.h" |
+#include "android_webview/native/aw_autofill_client.h" |
#include "android_webview/browser/aw_browser_context.h" |
#include "android_webview/browser/aw_content_browser_client.h" |
@@ -21,14 +21,14 @@ |
#include "components/autofill/core/common/autofill_pref_names.h" |
#include "components/user_prefs/user_prefs.h" |
#include "content/public/browser/web_contents.h" |
-#include "jni/AwAutofillManagerDelegate_jni.h" |
+#include "jni/AwAutofillClient_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); |
+DEFINE_WEB_CONTENTS_USER_DATA_KEY(android_webview::AwAutofillClient); |
namespace android_webview { |
@@ -36,51 +36,48 @@ namespace android_webview { |
// 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) { |
+AwAutofillClient::AwAutofillClient(WebContents* contents) |
+ : web_contents_(contents), save_form_data_(false) { |
JNIEnv* env = AttachCurrentThread(); |
ScopedJavaLocalRef<jobject> delegate; |
delegate.Reset( |
- Java_AwAutofillManagerDelegate_create( |
- env, reinterpret_cast<intptr_t>(this))); |
+ Java_AwAutofillClient_create(env, reinterpret_cast<intptr_t>(this))); |
AwContents* aw_contents = AwContents::FromWebContents(web_contents_); |
- aw_contents->SetAwAutofillManagerDelegate(delegate.obj()); |
+ aw_contents->SetAwAutofillClient(delegate.obj()); |
java_ref_ = JavaObjectWeakGlobalRef(env, delegate.obj()); |
} |
-AwAutofillManagerDelegate::~AwAutofillManagerDelegate() { |
+AwAutofillClient::~AwAutofillClient() { |
HideAutofillPopup(); |
} |
-void AwAutofillManagerDelegate::SetSaveFormData(bool enabled) { |
+void AwAutofillClient::SetSaveFormData(bool enabled) { |
save_form_data_ = enabled; |
} |
-bool AwAutofillManagerDelegate::GetSaveFormData() { |
+bool AwAutofillClient::GetSaveFormData() { |
return save_form_data_; |
} |
-PrefService* AwAutofillManagerDelegate::GetPrefs() { |
+PrefService* AwAutofillClient::GetPrefs() { |
return user_prefs::UserPrefs::Get( |
AwContentBrowserClient::GetAwBrowserContext()); |
} |
-autofill::PersonalDataManager* |
-AwAutofillManagerDelegate::GetPersonalDataManager() { |
+autofill::PersonalDataManager* AwAutofillClient::GetPersonalDataManager() { |
return NULL; |
} |
scoped_refptr<autofill::AutofillWebDataService> |
-AwAutofillManagerDelegate::GetDatabase() { |
+AwAutofillClient::GetDatabase() { |
android_webview::AwFormDatabaseService* service = |
static_cast<android_webview::AwBrowserContext*>( |
web_contents_->GetBrowserContext())->GetFormDatabaseService(); |
return service->get_autofill_webdata_service(); |
} |
-void AwAutofillManagerDelegate::ShowAutofillPopup( |
+void AwAutofillClient::ShowAutofillPopup( |
const gfx::RectF& element_bounds, |
base::i18n::TextDirection text_direction, |
const std::vector<base::string16>& values, |
@@ -88,7 +85,6 @@ void AwAutofillManagerDelegate::ShowAutofillPopup( |
const std::vector<base::string16>& icons, |
const std::vector<int>& identifiers, |
base::WeakPtr<autofill::AutofillPopupDelegate> delegate) { |
- |
values_ = values; |
identifiers_ = identifiers; |
delegate_ = delegate; |
@@ -98,13 +94,11 @@ void AwAutofillManagerDelegate::ShowAutofillPopup( |
gfx::RectF element_bounds_in_screen_space = |
element_bounds + client_area.OffsetFromOrigin(); |
- ShowAutofillPopupImpl(element_bounds_in_screen_space, |
- values, |
- labels, |
- identifiers); |
+ ShowAutofillPopupImpl( |
+ element_bounds_in_screen_space, values, labels, identifiers); |
} |
-void AwAutofillManagerDelegate::ShowAutofillPopupImpl( |
+void AwAutofillClient::ShowAutofillPopupImpl( |
const gfx::RectF& element_bounds, |
const std::vector<base::string16>& values, |
const std::vector<base::string16>& labels, |
@@ -118,30 +112,26 @@ void AwAutofillManagerDelegate::ShowAutofillPopupImpl( |
size_t count = values.size(); |
ScopedJavaLocalRef<jobjectArray> data_array = |
- Java_AwAutofillManagerDelegate_createAutofillSuggestionArray(env, count); |
+ Java_AwAutofillClient_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_AwAutofillClient_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()); |
+ Java_AwAutofillClient_showAutofillPopup(env, |
+ obj.obj(), |
+ element_bounds.x(), |
+ element_bounds.y(), |
+ element_bounds.width(), |
+ element_bounds.height(), |
+ data_array.obj()); |
} |
-void AwAutofillManagerDelegate::UpdateAutofillPopupDataListValues( |
+void AwAutofillClient::UpdateAutofillPopupDataListValues( |
const std::vector<base::string16>& values, |
const std::vector<base::string16>& labels) { |
// Leaving as an empty method since updating autofill popup window |
@@ -149,56 +139,58 @@ void AwAutofillManagerDelegate::UpdateAutofillPopupDataListValues( |
// See crrev.com/18102002 if need to implement. |
} |
-void AwAutofillManagerDelegate::HideAutofillPopup() { |
+void AwAutofillClient::HideAutofillPopup() { |
JNIEnv* env = AttachCurrentThread(); |
ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); |
if (obj.is_null()) |
return; |
delegate_.reset(); |
- Java_AwAutofillManagerDelegate_hideAutofillPopup(env, obj.obj()); |
+ Java_AwAutofillClient_hideAutofillPopup(env, obj.obj()); |
} |
-bool AwAutofillManagerDelegate::IsAutocompleteEnabled() { |
+bool AwAutofillClient::IsAutocompleteEnabled() { |
return GetSaveFormData(); |
} |
-void AwAutofillManagerDelegate::DetectAccountCreationForms( |
- const std::vector<autofill::FormStructure*>& forms) {} |
+void AwAutofillClient::DetectAccountCreationForms( |
+ const std::vector<autofill::FormStructure*>& forms) { |
+} |
-void AwAutofillManagerDelegate::DidFillOrPreviewField( |
+void AwAutofillClient::DidFillOrPreviewField( |
const base::string16& autofilled_value, |
- const base::string16& profile_full_name) {} |
+ const base::string16& profile_full_name) { |
+} |
-void AwAutofillManagerDelegate::SuggestionSelected(JNIEnv* env, |
- jobject object, |
- jint position) { |
+void AwAutofillClient::SuggestionSelected(JNIEnv* env, |
+ jobject object, |
+ jint position) { |
if (delegate_) |
delegate_->DidAcceptSuggestion(values_[position], identifiers_[position]); |
} |
-void AwAutofillManagerDelegate::HideRequestAutocompleteDialog() { |
+void AwAutofillClient::HideRequestAutocompleteDialog() { |
NOTIMPLEMENTED(); |
} |
-void AwAutofillManagerDelegate::ShowAutofillSettings() { |
+void AwAutofillClient::ShowAutofillSettings() { |
NOTIMPLEMENTED(); |
} |
-void AwAutofillManagerDelegate::ConfirmSaveCreditCard( |
+void AwAutofillClient::ConfirmSaveCreditCard( |
const autofill::AutofillMetrics& metric_logger, |
const base::Closure& save_card_callback) { |
NOTIMPLEMENTED(); |
} |
-void AwAutofillManagerDelegate::ShowRequestAutocompleteDialog( |
+void AwAutofillClient::ShowRequestAutocompleteDialog( |
const autofill::FormData& form, |
const GURL& source_url, |
const ResultCallback& callback) { |
NOTIMPLEMENTED(); |
} |
-bool RegisterAwAutofillManagerDelegate(JNIEnv* env) { |
+bool RegisterAwAutofillClient(JNIEnv* env) { |
return RegisterNativesImpl(env); |
} |
-} // namespace android_webview |
+} // namespace android_webview |