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

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: Don't update histograms in the renderer. 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 "chrome/browser/ui/password_generation_status.h"
Ilya Sherman 2012/07/18 20:48:57 chrome/renderer should not include any headers fro
zysxqn 2012/07/18 22:46:17 Moved to chrome/common and renamed it to password_
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 password_generation::UpdateEventsHistogram(
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 }
125 } 128 }
126 129
127 bool PasswordGenerationManager::ShouldAnalyzeDocument( 130 bool PasswordGenerationManager::ShouldAnalyzeDocument(
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 void PasswordGenerationManager::handleClick(WebKit::WebInputElement& element) { 164 void PasswordGenerationManager::handleClick(WebKit::WebInputElement& element) {
162 gfx::Rect rect(element.decorationElementFor(this).boundsInViewportSpace()); 165 gfx::Rect rect(element.decorationElementFor(this).boundsInViewportSpace());
163 webkit::forms::PasswordForm* password_form( 166 webkit::forms::PasswordForm* password_form(
164 webkit::forms::PasswordFormDomManager::CreatePasswordForm( 167 webkit::forms::PasswordFormDomManager::CreatePasswordForm(
165 element.form())); 168 element.form()));
166 if (password_form) { 169 if (password_form) {
167 Send(new AutofillHostMsg_ShowPasswordGenerationPopup(routing_id(), 170 Send(new AutofillHostMsg_ShowPasswordGenerationPopup(routing_id(),
168 rect, 171 rect,
169 element.maxLength(), 172 element.maxLength(),
170 *password_form)); 173 *password_form));
174 password_generation::UpdateEventsHistogram(
175 password_generation::BUBBLE_SHOWN);
171 } 176 }
172 } 177 }
173 178
174 void PasswordGenerationManager::willDetach( 179 void PasswordGenerationManager::willDetach(
175 const WebKit::WebInputElement& element) { 180 const WebKit::WebInputElement& element) {
176 // No implementation 181 // No implementation
177 } 182 }
178 183
179 bool PasswordGenerationManager::OnMessageReceived(const IPC::Message& message) { 184 bool PasswordGenerationManager::OnMessageReceived(const IPC::Message& message) {
180 bool handled = true; 185 bool handled = true;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 not_blacklisted_password_form_origins_.empty()) { 225 not_blacklisted_password_form_origins_.empty()) {
221 return; 226 return;
222 } 227 }
223 228
224 for (std::vector<GURL>::iterator it = 229 for (std::vector<GURL>::iterator it =
225 not_blacklisted_password_form_origins_.begin(); 230 not_blacklisted_password_form_origins_.begin();
226 it != not_blacklisted_password_form_origins_.end(); ++it) { 231 it != not_blacklisted_password_form_origins_.end(); ++it) {
227 if (*it == account_creation_form_origin_) { 232 if (*it == account_creation_form_origin_) {
228 passwords_[0].decorationElementFor(this).setAttribute("style", 233 passwords_[0].decorationElementFor(this).setAttribute("style",
229 "display:block"); 234 "display:block");
235 password_generation::UpdateEventsHistogram(
236 password_generation::ICON_SHOWN);
230 return; 237 return;
231 } 238 }
232 } 239 }
233 } 240 }
234 241
235 } // namespace autofill 242 } // namespace autofill
OLDNEW
« chrome/browser/ui/password_generation_status.cc ('K') | « chrome/chrome_browser.gypi ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698