Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6947)

Unified Diff: chrome/renderer/autofill/password_generation_manager.cc

Issue 10787023: Adding UMA stats. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix the test. Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/renderer/autofill/password_generation_manager.cc
diff --git a/chrome/renderer/autofill/password_generation_manager.cc b/chrome/renderer/autofill/password_generation_manager.cc
index 7e402e2e5e2dadaa116935d02602de58b73bffe0..833e288b49e94d614cda69d247f6694b0d04f36e 100644
--- a/chrome/renderer/autofill/password_generation_manager.cc
+++ b/chrome/renderer/autofill/password_generation_manager.cc
@@ -5,6 +5,9 @@
#include "chrome/renderer/autofill/password_generation_manager.h"
#include "base/logging.h"
+#include "base/metrics/histogram.h"
+#include "base/utf_string_conversions.h"
+#include "chrome/browser/ui/password_generation_status.h"
#include "chrome/common/autofill_messages.h"
#include "chrome/common/net/gaia/gaia_urls.h"
#include "content/public/renderer/render_view.h"
@@ -19,6 +22,8 @@
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h"
#include "ui/gfx/rect.h"
+using namespace password_generation;
Ilya Sherman 2012/07/18 05:36:15 "using namespace" is disallowed by the Chromium st
zysxqn 2012/07/18 19:16:46 Done.
+
namespace autofill {
namespace {
@@ -115,6 +120,8 @@ void PasswordGenerationManager::DidFinishLoad(WebKit::WebFrame* frame) {
std::vector<WebKit::WebInputElement> passwords;
if (GetAccountCreationPasswordFields(forms[i], &passwords)) {
DVLOG(2) << "Account creation form detected";
+ UMA_HISTOGRAM_ENUMERATION("PasswordGeneration.Events",
+ SIGN_UP_DETECTED, EVENT_ENUM_COUNT);
passwords_ = passwords;
account_creation_form_origin_ = password_form->origin;
MaybeShowIcon();
@@ -168,6 +175,8 @@ void PasswordGenerationManager::handleClick(WebKit::WebInputElement& element) {
rect,
element.maxLength(),
*password_form));
+ UMA_HISTOGRAM_ENUMERATION("PasswordGeneration.Events",
+ BUBBLE_SHOWN, EVENT_ENUM_COUNT);
}
}
@@ -181,8 +190,8 @@ bool PasswordGenerationManager::OnMessageReceived(const IPC::Message& message) {
IPC_BEGIN_MESSAGE_MAP(PasswordGenerationManager, message)
IPC_MESSAGE_HANDLER(AutofillMsg_FormNotBlacklisted,
OnFormNotBlacklisted)
- IPC_MESSAGE_HANDLER(AutofillMsg_GeneratedPasswordAccepted,
- OnPasswordAccepted)
+ IPC_MESSAGE_HANDLER(AutofillMsg_PasswordGenerationBubbleClosed,
+ OnPasswordGenerationBubbleClosed)
IPC_MESSAGE_HANDLER(AutofillMsg_PasswordGenerationEnabled,
OnPasswordGenerationEnabled)
IPC_MESSAGE_UNHANDLED(handled = false)
@@ -196,14 +205,29 @@ void PasswordGenerationManager::OnFormNotBlacklisted(
MaybeShowIcon();
}
-void PasswordGenerationManager::OnPasswordAccepted(const string16& password) {
- for (std::vector<WebKit::WebInputElement>::iterator it = passwords_.begin();
+void PasswordGenerationManager::OnPasswordGenerationBubbleClosed(
+ const PasswordGenerationStatus& status) {
+ if (status.password_accepted) {
+ if (status.password_edited)
+ UMA_HISTOGRAM_ENUMERATION("PasswordGeneration.UserActions",
+ ACCEPT_AFTER_EDITING, ACTION_ENUM_COUNT);
+ else
+ UMA_HISTOGRAM_ENUMERATION("PasswordGeneration.UserActions",
+ ACCEPT_ORIGINAL_PASSWORD, ACTION_ENUM_COUNT);
+ for (std::vector<WebKit::WebInputElement>::iterator it = passwords_.begin();
it != passwords_.end(); ++it) {
- it->setValue(password);
- it->setAutofilled(true);
- // Advance focus to the next input field. We assume password fields in
- // an account creation form are always adjacent.
- render_view_->GetWebView()->advanceFocus(false);
+ it->setValue(UTF8ToUTF16(status.generated_password));
+ it->setAutofilled(true);
+ // Advance focus to the next input field. We assume password fields in
+ // an account creation form are always adjacent.
+ render_view_->GetWebView()->advanceFocus(false);
+ }
+ } else if (status.learn_more_visited) {
+ UMA_HISTOGRAM_ENUMERATION("PasswordGeneration.UserActions",
+ LEARN_MORE, ACTION_ENUM_COUNT);
+ } else {
+ UMA_HISTOGRAM_ENUMERATION("PasswordGeneration.UserActions",
+ IGNORE, ACTION_ENUM_COUNT);
}
}
@@ -227,6 +251,8 @@ void PasswordGenerationManager::MaybeShowIcon() {
if (*it == account_creation_form_origin_) {
passwords_[0].decorationElementFor(this).setAttribute("style",
"display:block");
+ UMA_HISTOGRAM_ENUMERATION("PasswordGeneration.Events",
+ ICON_SHOWN, EVENT_ENUM_COUNT);
return;
}
}

Powered by Google App Engine
This is Rietveld 408576698