summaryrefslogtreecommitdiffstats
path: root/components/autofill/content
diff options
context:
space:
mode:
authordvadym <dvadym@chromium.org>2016-02-23 03:55:27 -0800
committerCommit bot <commit-bot@chromium.org>2016-02-23 11:56:58 +0000
commitc0a523a2e2d85e487c3aa32ad57ac1a3e4694d46 (patch)
tree70a4f74a7a1a175891fdd98c777aa5e55d86d63c /components/autofill/content
parentd9c162ad0a240aa967c247f5be258056d6a4efbf (diff)
downloadchromium_src-c0a523a2e2d85e487c3aa32ad57ac1a3e4694d46.zip
chromium_src-c0a523a2e2d85e487c3aa32ad57ac1a3e4694d46.tar.gz
chromium_src-c0a523a2e2d85e487c3aa32ad57ac1a3e4694d46.tar.bz2
Sending generated vote on password generation.
The generating of password by user is strong indication that the current form is suitable for generation and we can use it for improving our heuristics. This patch adds |generation_event| to uploaded field vote (in AutofillField structure and in AutofillUploadContents proto) with information about generation event which happened. BUG=552420 Review URL: https://codereview.chromium.org/1686063004 Cr-Commit-Position: refs/heads/master@{#376968}
Diffstat (limited to 'components/autofill/content')
-rw-r--r--components/autofill/content/common/autofill_messages.h6
-rw-r--r--components/autofill/content/renderer/password_generation_agent.cc19
-rw-r--r--components/autofill/content/renderer/password_generation_agent.h5
3 files changed, 20 insertions, 10 deletions
diff --git a/components/autofill/content/common/autofill_messages.h b/components/autofill/content/common/autofill_messages.h
index a3de142..8ddc5d8 100644
--- a/components/autofill/content/common/autofill_messages.h
+++ b/components/autofill/content/common/autofill_messages.h
@@ -193,7 +193,7 @@ IPC_MESSAGE_ROUTED0(AutofillMsg_FindFocusedPasswordForm)
// Tells the renderer to find a focused element, and if it is a password field
// eligible for generation then to trigger generation by responding to the
// browser with the message |AutofillHostMsg_ShowPasswordGenerationPopup|.
-IPC_MESSAGE_ROUTED0(AutofillMsg_GeneratePassword)
+IPC_MESSAGE_ROUTED0(AutofillMsg_UserTriggeredGeneratePassword)
// Tells the renderer that this password form is not blacklisted. A form can
// be blacklisted if a user chooses "never save passwords for this site".
@@ -322,9 +322,11 @@ IPC_MESSAGE_ROUTED1(AutofillHostMsg_GenerationAvailableForForm,
// Instructs the browser to show the password generation popup at the
// specified location. This location should be specified in the renderers
// coordinate system. Form is the form associated with the password field.
-IPC_MESSAGE_ROUTED3(AutofillHostMsg_ShowPasswordGenerationPopup,
+IPC_MESSAGE_ROUTED5(AutofillHostMsg_ShowPasswordGenerationPopup,
gfx::RectF /* source location */,
int /* max length of the password */,
+ base::string16, /* password field */
+ bool, /* is manually triggered */
autofill::PasswordForm)
// Instructs the browser to show the popup for editing a generated password.
diff --git a/components/autofill/content/renderer/password_generation_agent.cc b/components/autofill/content/renderer/password_generation_agent.cc
index ded1af0..c161dbc 100644
--- a/components/autofill/content/renderer/password_generation_agent.cc
+++ b/components/autofill/content/renderer/password_generation_agent.cc
@@ -120,6 +120,7 @@ PasswordGenerationAgent::PasswordGenerationAgent(
PasswordAutofillAgent* password_agent)
: content::RenderFrameObserver(render_frame),
password_is_generated_(false),
+ is_manually_triggered_(false),
password_edited_(false),
generation_popup_shown_(false),
editing_popup_shown_(false),
@@ -253,7 +254,8 @@ bool PasswordGenerationAgent::OnMessageReceived(const IPC::Message& message) {
OnPasswordAccepted)
IPC_MESSAGE_HANDLER(AutofillMsg_FoundFormsEligibleForGeneration,
OnFormsEligibleForGenerationFound);
- IPC_MESSAGE_HANDLER(AutofillMsg_GeneratePassword, OnGeneratePassword);
+ IPC_MESSAGE_HANDLER(AutofillMsg_UserTriggeredGeneratePassword,
+ OnUserTriggeredGeneratePassword);
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
@@ -438,11 +440,13 @@ bool PasswordGenerationAgent::TextDidChangeInTextField(
void PasswordGenerationAgent::ShowGenerationPopup() {
Send(new AutofillHostMsg_ShowPasswordGenerationPopup(
- routing_id(),
- render_frame()->GetRenderView()->ElementBoundsInWindow(
- generation_element_),
- generation_element_.maxLength(),
- *generation_form_data_->form));
+ routing_id(),
+ render_frame()->GetRenderView()->ElementBoundsInWindow(
+ generation_element_),
+ generation_element_.maxLength(),
+ generation_element_.nameForAutofill(),
+ is_manually_triggered_,
+ *generation_form_data_->form));
generation_popup_shown_ = true;
}
@@ -459,7 +463,7 @@ void PasswordGenerationAgent::HidePopup() {
Send(new AutofillHostMsg_HidePasswordGenerationPopup(routing_id()));
}
-void PasswordGenerationAgent::OnGeneratePassword() {
+void PasswordGenerationAgent::OnUserTriggeredGeneratePassword() {
blink::WebDocument doc = render_frame()->GetWebFrame()->document();
if (doc.isNull())
return;
@@ -485,6 +489,7 @@ void PasswordGenerationAgent::OnGeneratePassword() {
password_elements, element->nameForAutofill());
generation_form_data_.reset(new AccountCreationFormData(
make_linked_ptr(password_form.release()), password_elements));
+ is_manually_triggered_ = true;
ShowGenerationPopup();
}
diff --git a/components/autofill/content/renderer/password_generation_agent.h b/components/autofill/content/renderer/password_generation_agent.h
index b9c7f3c..e2a239f 100644
--- a/components/autofill/content/renderer/password_generation_agent.h
+++ b/components/autofill/content/renderer/password_generation_agent.h
@@ -104,7 +104,7 @@ class PasswordGenerationAgent : public content::RenderFrameObserver {
// Sets |generation_element_| to the focused password field and shows a
// generation popup at this field.
- void OnGeneratePassword();
+ void OnUserTriggeredGeneratePassword();
// Stores forms that are candidates for account creation.
AccountCreationFormDataList possible_account_creation_forms_;
@@ -129,6 +129,9 @@ class PasswordGenerationAgent : public content::RenderFrameObserver {
// password.
bool password_is_generated_;
+ // True if password generation was manually triggered.
+ bool is_manually_triggered_;
+
// True if a password was generated and the user edited it. Used for UMA
// stats.
bool password_edited_;