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

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: A typo. 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
« no previous file with comments | « chrome/common/password_generation_util.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "chrome/common/autofill_messages.h" 8 #include "chrome/common/autofill_messages.h"
9 #include "chrome/common/net/gaia/gaia_urls.h" 9 #include "chrome/common/net/gaia/gaia_urls.h"
10 #include "chrome/common/password_generation_util.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 "
18 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h" 19 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebRect.h"
19 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" 20 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h"
(...skipping 88 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 password_generation::LogPasswordGenerationEvent(
120 password_generation::SIGN_UP_DETECTED);
118 passwords_ = passwords; 121 passwords_ = passwords;
119 account_creation_form_origin_ = password_form->origin; 122 account_creation_form_origin_ = password_form->origin;
120 MaybeShowIcon(); 123 MaybeShowIcon();
121 // We assume that there is only one account creation field per URL. 124 // We assume that there is only one account creation field per URL.
122 return; 125 return;
123 } 126 }
124 } 127 }
128 password_generation::LogPasswordGenerationEvent(
129 password_generation::NO_SIGN_UP_DETECTED);
125 } 130 }
126 131
127 bool PasswordGenerationManager::ShouldAnalyzeDocument( 132 bool PasswordGenerationManager::ShouldAnalyzeDocument(
128 const WebKit::WebDocument& document) const { 133 const WebKit::WebDocument& document) const {
129 // Make sure that this security origin is allowed to use password manager. 134 // Make sure that this security origin is allowed to use password manager.
130 // Generating a password that can't be saved is a bad idea. 135 // Generating a password that can't be saved is a bad idea.
131 WebKit::WebSecurityOrigin origin = document.securityOrigin(); 136 WebKit::WebSecurityOrigin origin = document.securityOrigin();
132 if (!origin.canAccessPasswordManager()) { 137 if (!origin.canAccessPasswordManager()) {
133 DVLOG(1) << "No PasswordManager access"; 138 DVLOG(1) << "No PasswordManager access";
134 return false; 139 return false;
(...skipping 26 matching lines...) Expand all
161 void PasswordGenerationManager::handleClick(WebKit::WebInputElement& element) { 166 void PasswordGenerationManager::handleClick(WebKit::WebInputElement& element) {
162 gfx::Rect rect(element.decorationElementFor(this).boundsInViewportSpace()); 167 gfx::Rect rect(element.decorationElementFor(this).boundsInViewportSpace());
163 webkit::forms::PasswordForm* password_form( 168 webkit::forms::PasswordForm* password_form(
164 webkit::forms::PasswordFormDomManager::CreatePasswordForm( 169 webkit::forms::PasswordFormDomManager::CreatePasswordForm(
165 element.form())); 170 element.form()));
166 if (password_form) { 171 if (password_form) {
167 Send(new AutofillHostMsg_ShowPasswordGenerationPopup(routing_id(), 172 Send(new AutofillHostMsg_ShowPasswordGenerationPopup(routing_id(),
168 rect, 173 rect,
169 element.maxLength(), 174 element.maxLength(),
170 *password_form)); 175 *password_form));
176 password_generation::LogPasswordGenerationEvent(
177 password_generation::BUBBLE_SHOWN);
171 } 178 }
172 } 179 }
173 180
174 void PasswordGenerationManager::willDetach( 181 void PasswordGenerationManager::willDetach(
175 const WebKit::WebInputElement& element) { 182 const WebKit::WebInputElement& element) {
176 // No implementation 183 // No implementation
177 } 184 }
178 185
179 bool PasswordGenerationManager::OnMessageReceived(const IPC::Message& message) { 186 bool PasswordGenerationManager::OnMessageReceived(const IPC::Message& message) {
180 bool handled = true; 187 bool handled = true;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 not_blacklisted_password_form_origins_.empty()) { 227 not_blacklisted_password_form_origins_.empty()) {
221 return; 228 return;
222 } 229 }
223 230
224 for (std::vector<GURL>::iterator it = 231 for (std::vector<GURL>::iterator it =
225 not_blacklisted_password_form_origins_.begin(); 232 not_blacklisted_password_form_origins_.begin();
226 it != not_blacklisted_password_form_origins_.end(); ++it) { 233 it != not_blacklisted_password_form_origins_.end(); ++it) {
227 if (*it == account_creation_form_origin_) { 234 if (*it == account_creation_form_origin_) {
228 passwords_[0].decorationElementFor(this).setAttribute("style", 235 passwords_[0].decorationElementFor(this).setAttribute("style",
229 "display:block"); 236 "display:block");
237 password_generation::LogPasswordGenerationEvent(
238 password_generation::ICON_SHOWN);
230 return; 239 return;
231 } 240 }
232 } 241 }
233 } 242 }
234 243
235 } // namespace autofill 244 } // namespace autofill
OLDNEW
« no previous file with comments | « chrome/common/password_generation_util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698