Chromium Code Reviews| OLD | NEW |
|---|---|
| 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" |
| 14 #include "chrome/browser/ui/password_generation_status.h" | |
| 13 #include "chrome/common/autofill_messages.h" | 15 #include "chrome/common/autofill_messages.h" |
| 14 #include "chrome/common/pref_names.h" | 16 #include "chrome/common/pref_names.h" |
| 15 #include "content/public/browser/user_metrics.h" | 17 #include "content/public/browser/user_metrics.h" |
| 16 #include "content/public/browser/web_contents.h" | 18 #include "content/public/browser/web_contents.h" |
| 17 #include "content/public/common/frame_navigate_params.h" | 19 #include "content/public/common/frame_navigate_params.h" |
| 18 #include "grit/generated_resources.h" | 20 #include "grit/generated_resources.h" |
| 19 | 21 |
| 20 using content::UserMetricsAction; | 22 using content::UserMetricsAction; |
| 21 using content::WebContents; | 23 using content::WebContents; |
| 22 using webkit::forms::PasswordForm; | 24 using webkit::forms::PasswordForm; |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 232 NOTREACHED(); | 234 NOTREACHED(); |
| 233 provisional_save_manager_.reset(); | 235 provisional_save_manager_.reset(); |
| 234 return; | 236 return; |
| 235 } | 237 } |
| 236 | 238 |
| 237 // Looks like a successful login attempt. Either show an infobar or | 239 // 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 | 240 // 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 | 241 // given consent, either through previously accepting the infobar or by having |
| 240 // the browser generate the password. | 242 // the browser generate the password. |
| 241 provisional_save_manager_->SubmitPassed(); | 243 provisional_save_manager_->SubmitPassed(); |
| 244 if (provisional_save_manager_->HasGeneratedPassword()) | |
| 245 UMA_HISTOGRAM_ENUMERATION("PasswordGeneration.EVENTS", | |
|
Ilya Sherman
2012/07/18 05:36:15
This histogram name does not match the name in oth
zysxqn
2012/07/18 19:16:46
Done.
| |
| 246 password_generation::SUBMITTED, | |
| 247 password_generation::EVENT_ENUM_COUNT); | |
| 242 if (provisional_save_manager_->IsNewLogin() && | 248 if (provisional_save_manager_->IsNewLogin() && |
| 243 !provisional_save_manager_->HasGeneratedPassword()) { | 249 !provisional_save_manager_->HasGeneratedPassword()) { |
| 244 delegate_->AddSavePasswordInfoBarIfPermitted( | 250 delegate_->AddSavePasswordInfoBarIfPermitted( |
| 245 provisional_save_manager_.release()); | 251 provisional_save_manager_.release()); |
| 246 } else { | 252 } else { |
| 247 provisional_save_manager_->Save(); | 253 provisional_save_manager_->Save(); |
| 248 provisional_save_manager_.reset(); | 254 provisional_save_manager_.reset(); |
| 249 } | 255 } |
| 250 } | 256 } |
| 251 | 257 |
| (...skipping 19 matching lines...) Expand all Loading... | |
| 271 if (observer_) { | 277 if (observer_) { |
| 272 observer_->OnAutofillDataAvailable(preferred_match.username_value, | 278 observer_->OnAutofillDataAvailable(preferred_match.username_value, |
| 273 preferred_match.password_value); | 279 preferred_match.password_value); |
| 274 } | 280 } |
| 275 } | 281 } |
| 276 } | 282 } |
| 277 | 283 |
| 278 bool PasswordManager::IsFillingEnabled() const { | 284 bool PasswordManager::IsFillingEnabled() const { |
| 279 return delegate_->GetProfile() && *password_manager_enabled_; | 285 return delegate_->GetProfile() && *password_manager_enabled_; |
| 280 } | 286 } |
| OLD | NEW |