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

Side by Side Diff: chrome/browser/password_manager/password_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/browser/password_manager/password_manager.h" 5 #include "chrome/browser/password_manager/password_manager.h"
6 6
7 #include "base/metrics/histogram.h"
7 #include "base/threading/platform_thread.h" 8 #include "base/threading/platform_thread.h"
8 #include "base/utf_string_conversions.h" 9 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/password_manager/password_form_manager.h" 10 #include "chrome/browser/password_manager/password_form_manager.h"
10 #include "chrome/browser/password_manager/password_manager_delegate.h" 11 #include "chrome/browser/password_manager/password_manager_delegate.h"
11 #include "chrome/browser/prefs/pref_service.h" 12 #include "chrome/browser/prefs/pref_service.h"
12 #include "chrome/browser/profiles/profile.h" 13 #include "chrome/browser/profiles/profile.h"
13 #include "chrome/common/autofill_messages.h" 14 #include "chrome/common/autofill_messages.h"
14 #include "chrome/common/pref_names.h" 15 #include "chrome/common/pref_names.h"
15 #include "content/public/browser/user_metrics.h" 16 #include "content/public/browser/user_metrics.h"
16 #include "content/public/browser/web_contents.h" 17 #include "content/public/browser/web_contents.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 bool ssl_valid = (form.origin.SchemeIsSecure() && 91 bool ssl_valid = (form.origin.SchemeIsSecure() &&
91 !delegate_->DidLastPageLoadEncounterSSLErrors()); 92 !delegate_->DidLastPageLoadEncounterSSLErrors());
92 PasswordFormManager* manager = 93 PasswordFormManager* manager =
93 new PasswordFormManager(delegate_->GetProfile(), 94 new PasswordFormManager(delegate_->GetProfile(),
94 this, 95 this,
95 web_contents(), 96 web_contents(),
96 form, 97 form,
97 ssl_valid); 98 ssl_valid);
98 pending_login_managers_.push_back(manager); 99 pending_login_managers_.push_back(manager);
99 manager->SetHasGeneratedPassword(); 100 manager->SetHasGeneratedPassword();
100 // TODO(gcasto): Add UMA stats to track this.
Garrett Casto 2012/07/16 22:32:39 This comment was meant for this particular case, s
zysxqn 2012/07/18 01:01:00 Oops, misunderstood your meaning here. Put it back
101 } 101 }
102 102
103 bool PasswordManager::IsSavingEnabled() const { 103 bool PasswordManager::IsSavingEnabled() const {
104 return IsFillingEnabled() && !delegate_->GetProfile()->IsOffTheRecord(); 104 return IsFillingEnabled() && !delegate_->GetProfile()->IsOffTheRecord();
105 } 105 }
106 106
107 void PasswordManager::ProvisionallySavePassword(const PasswordForm& form) { 107 void PasswordManager::ProvisionallySavePassword(const PasswordForm& form) {
108 if (!IsSavingEnabled()) 108 if (!IsSavingEnabled())
109 return; 109 return;
110 110
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 NOTREACHED(); 232 NOTREACHED();
233 provisional_save_manager_.reset(); 233 provisional_save_manager_.reset();
234 return; 234 return;
235 } 235 }
236 236
237 // Looks like a successful login attempt. Either show an infobar or 237 // Looks like a successful login attempt. Either show an infobar or
238 // automatically save the login data. We prompt when the user hasn't already 238 // automatically save the login data. We prompt when the user hasn't already
239 // given consent, either through previously accepting the infobar or by having 239 // given consent, either through previously accepting the infobar or by having
240 // the browser generate the password. 240 // the browser generate the password.
241 provisional_save_manager_->SubmitPassed(); 241 provisional_save_manager_->SubmitPassed();
242 if (provisional_save_manager_->HasGeneratedPassword())
243 UMA_HISTOGRAM_COUNTS("PasswordGeneration.GeneratedPasswordSubmitted", 1);
242 if (provisional_save_manager_->IsNewLogin() && 244 if (provisional_save_manager_->IsNewLogin() &&
243 !provisional_save_manager_->HasGeneratedPassword()) { 245 !provisional_save_manager_->HasGeneratedPassword()) {
244 delegate_->AddSavePasswordInfoBarIfPermitted( 246 delegate_->AddSavePasswordInfoBarIfPermitted(
245 provisional_save_manager_.release()); 247 provisional_save_manager_.release());
246 } else { 248 } else {
247 provisional_save_manager_->Save(); 249 provisional_save_manager_->Save();
248 provisional_save_manager_.reset(); 250 provisional_save_manager_.reset();
249 } 251 }
250 } 252 }
251 253
(...skipping 19 matching lines...) Expand all
271 if (observer_) { 273 if (observer_) {
272 observer_->OnAutofillDataAvailable(preferred_match.username_value, 274 observer_->OnAutofillDataAvailable(preferred_match.username_value,
273 preferred_match.password_value); 275 preferred_match.password_value);
274 } 276 }
275 } 277 }
276 } 278 }
277 279
278 bool PasswordManager::IsFillingEnabled() const { 280 bool PasswordManager::IsFillingEnabled() const {
279 return delegate_->GetProfile() && *password_manager_enabled_; 281 return delegate_->GetProfile() && *password_manager_enabled_;
280 } 282 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698