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

Side by Side 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: 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/renderer/autofill/password_generation_manager.h" 5 #include "chrome/renderer/autofill/password_generation_manager.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/histogram.h"
8 #include "chrome/common/autofill_messages.h" 9 #include "chrome/common/autofill_messages.h"
9 #include "chrome/common/net/gaia/gaia_urls.h" 10 #include "chrome/common/net/gaia/gaia_urls.h"
10 #include "content/public/renderer/render_view.h" 11 #include "content/public/renderer/render_view.h"
11 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h"
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h"
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormElement.h" 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFormElement.h"
14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h"
15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h" 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebSecurityOrigin.h"
16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
17 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCString.h " 18 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebCString.h "
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 109
109 // Do not generate password for GAIA since it is used to retrieve the 110 // Do not generate password for GAIA since it is used to retrieve the
110 // generated paswords. 111 // generated paswords.
111 GURL realm(password_form->signon_realm); 112 GURL realm(password_form->signon_realm);
112 if (realm == GURL(GaiaUrls::GetInstance()->gaia_login_form_realm())) 113 if (realm == GURL(GaiaUrls::GetInstance()->gaia_login_form_realm()))
113 continue; 114 continue;
114 115
115 std::vector<WebKit::WebInputElement> passwords; 116 std::vector<WebKit::WebInputElement> passwords;
116 if (GetAccountCreationPasswordFields(forms[i], &passwords)) { 117 if (GetAccountCreationPasswordFields(forms[i], &passwords)) {
117 DVLOG(2) << "Account creation form detected"; 118 DVLOG(2) << "Account creation form detected";
119 UMA_HISTOGRAM_COUNTS("PasswordGeneration.AccountCreationFormDetected", 1);
118 passwords_ = passwords; 120 passwords_ = passwords;
119 account_creation_form_origin_ = password_form->origin; 121 account_creation_form_origin_ = password_form->origin;
120 MaybeShowIcon(); 122 MaybeShowIcon();
121 // We assume that there is only one account creation field per URL. 123 // We assume that there is only one account creation field per URL.
122 return; 124 return;
123 } 125 }
124 } 126 }
125 } 127 }
126 128
127 bool PasswordGenerationManager::ShouldAnalyzeDocument( 129 bool PasswordGenerationManager::ShouldAnalyzeDocument(
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 not_blacklisted_password_form_origins_.empty()) { 222 not_blacklisted_password_form_origins_.empty()) {
221 return; 223 return;
222 } 224 }
223 225
224 for (std::vector<GURL>::iterator it = 226 for (std::vector<GURL>::iterator it =
225 not_blacklisted_password_form_origins_.begin(); 227 not_blacklisted_password_form_origins_.begin();
226 it != not_blacklisted_password_form_origins_.end(); ++it) { 228 it != not_blacklisted_password_form_origins_.end(); ++it) {
227 if (*it == account_creation_form_origin_) { 229 if (*it == account_creation_form_origin_) {
228 passwords_[0].decorationElementFor(this).setAttribute("style", 230 passwords_[0].decorationElementFor(this).setAttribute("style",
229 "display:block"); 231 "display:block");
232 UMA_HISTOGRAM_COUNTS("PasswordGeneration.PasswordGenerationIconShown", 1);
230 return; 233 return;
231 } 234 }
232 } 235 }
233 } 236 }
234 237
235 } // namespace autofill 238 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698