| 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" |
| 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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 NOTREACHED(); | 233 NOTREACHED(); |
| 233 provisional_save_manager_.reset(); | 234 provisional_save_manager_.reset(); |
| 234 return; | 235 return; |
| 235 } | 236 } |
| 236 | 237 |
| 237 // Looks like a successful login attempt. Either show an infobar or | 238 // 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 | 239 // 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 | 240 // given consent, either through previously accepting the infobar or by having |
| 240 // the browser generate the password. | 241 // the browser generate the password. |
| 241 provisional_save_manager_->SubmitPassed(); | 242 provisional_save_manager_->SubmitPassed(); |
| 243 if (provisional_save_manager_->HasGeneratedPassword()) |
| 244 UMA_HISTOGRAM_COUNTS("PasswordGeneration.Submitted", 1); |
| 242 if (provisional_save_manager_->IsNewLogin() && | 245 if (provisional_save_manager_->IsNewLogin() && |
| 243 !provisional_save_manager_->HasGeneratedPassword()) { | 246 !provisional_save_manager_->HasGeneratedPassword()) { |
| 244 delegate_->AddSavePasswordInfoBarIfPermitted( | 247 delegate_->AddSavePasswordInfoBarIfPermitted( |
| 245 provisional_save_manager_.release()); | 248 provisional_save_manager_.release()); |
| 246 } else { | 249 } else { |
| 247 provisional_save_manager_->Save(); | 250 provisional_save_manager_->Save(); |
| 248 provisional_save_manager_.reset(); | 251 provisional_save_manager_.reset(); |
| 249 } | 252 } |
| 250 } | 253 } |
| 251 | 254 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 271 if (observer_) { | 274 if (observer_) { |
| 272 observer_->OnAutofillDataAvailable(preferred_match.username_value, | 275 observer_->OnAutofillDataAvailable(preferred_match.username_value, |
| 273 preferred_match.password_value); | 276 preferred_match.password_value); |
| 274 } | 277 } |
| 275 } | 278 } |
| 276 } | 279 } |
| 277 | 280 |
| 278 bool PasswordManager::IsFillingEnabled() const { | 281 bool PasswordManager::IsFillingEnabled() const { |
| 279 return delegate_->GetProfile() && *password_manager_enabled_; | 282 return delegate_->GetProfile() && *password_manager_enabled_; |
| 280 } | 283 } |
| OLD | NEW |