| 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/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| 11 #include "base/strings/string_util.h" | 11 #include "base/strings/string_util.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
| 13 #include "base/threading/platform_thread.h" | 13 #include "base/threading/platform_thread.h" |
| 14 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | |
| 15 #include "chrome/browser/password_manager/password_form_manager.h" | 14 #include "chrome/browser/password_manager/password_form_manager.h" |
| 16 #include "chrome/browser/password_manager/password_manager_delegate.h" | 15 #include "chrome/browser/password_manager/password_manager_delegate.h" |
| 17 #include "chrome/browser/password_manager/password_manager_metrics_util.h" | 16 #include "chrome/browser/password_manager/password_manager_metrics_util.h" |
| 18 #include "chrome/browser/profiles/profile.h" | 17 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/browser/ui/passwords/manage_passwords_controller.h" |
| 19 #include "chrome/common/chrome_switches.h" | 19 #include "chrome/common/chrome_switches.h" |
| 20 #include "chrome/common/chrome_version_info.h" | 20 #include "chrome/common/chrome_version_info.h" |
| 21 #include "chrome/common/pref_names.h" | 21 #include "chrome/common/pref_names.h" |
| 22 #include "components/autofill/core/common/autofill_messages.h" | 22 #include "components/autofill/core/common/autofill_messages.h" |
| 23 #include "components/user_prefs/pref_registry_syncable.h" | 23 #include "components/user_prefs/pref_registry_syncable.h" |
| 24 #include "content/public/browser/navigation_details.h" | 24 #include "content/public/browser/navigation_details.h" |
| 25 #include "content/public/browser/user_metrics.h" | 25 #include "content/public/browser/user_metrics.h" |
| 26 #include "content/public/browser/web_contents.h" | 26 #include "content/public/browser/web_contents.h" |
| 27 #include "content/public/common/frame_navigate_params.h" | 27 #include "content/public/common/frame_navigate_params.h" |
| 28 #include "grit/generated_resources.h" | 28 #include "grit/generated_resources.h" |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 333 // automatically save the login data. We prompt when the user hasn't already | 333 // automatically save the login data. We prompt when the user hasn't already |
| 334 // given consent, either through previously accepting the infobar or by having | 334 // given consent, either through previously accepting the infobar or by having |
| 335 // the browser generate the password. | 335 // the browser generate the password. |
| 336 provisional_save_manager_->SubmitPassed(); | 336 provisional_save_manager_->SubmitPassed(); |
| 337 if (provisional_save_manager_->HasGeneratedPassword()) | 337 if (provisional_save_manager_->HasGeneratedPassword()) |
| 338 UMA_HISTOGRAM_COUNTS("PasswordGeneration.Submitted", 1); | 338 UMA_HISTOGRAM_COUNTS("PasswordGeneration.Submitted", 1); |
| 339 | 339 |
| 340 if (ShouldShowSavePasswordInfoBar()) { | 340 if (ShouldShowSavePasswordInfoBar()) { |
| 341 if (CommandLine::ForCurrentProcess()->HasSwitch( | 341 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 342 switches::kEnableSavePasswordBubble)) { | 342 switches::kEnableSavePasswordBubble)) { |
| 343 TabSpecificContentSettings* content_settings = | 343 ManagePasswordsController* manage_passwords_controller = |
| 344 TabSpecificContentSettings::FromWebContents(web_contents()); | 344 ManagePasswordsController::FromWebContents(web_contents()); |
| 345 if (content_settings) { | 345 if (manage_passwords_controller) { |
| 346 content_settings->OnPasswordSubmitted( | 346 manage_passwords_controller->OnPasswordSubmitted( |
| 347 provisional_save_manager_.release()); | 347 provisional_save_manager_.release()); |
| 348 } else { | 348 } else { |
| 349 provisional_save_manager_.reset(); | 349 provisional_save_manager_.reset(); |
| 350 } | 350 } |
| 351 } else { | 351 } else { |
| 352 delegate_->AddSavePasswordInfoBarIfPermitted( | 352 delegate_->AddSavePasswordInfoBarIfPermitted( |
| 353 provisional_save_manager_.release()); | 353 provisional_save_manager_.release()); |
| 354 } | 354 } |
| 355 } else { | 355 } else { |
| 356 provisional_save_manager_->Save(); | 356 provisional_save_manager_->Save(); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 } | 422 } |
| 423 default: | 423 default: |
| 424 FOR_EACH_OBSERVER( | 424 FOR_EACH_OBSERVER( |
| 425 LoginModelObserver, | 425 LoginModelObserver, |
| 426 observers_, | 426 observers_, |
| 427 OnAutofillDataAvailable(preferred_match.username_value, | 427 OnAutofillDataAvailable(preferred_match.username_value, |
| 428 preferred_match.password_value)); | 428 preferred_match.password_value)); |
| 429 break; | 429 break; |
| 430 } | 430 } |
| 431 | 431 |
| 432 TabSpecificContentSettings* content_settings = | 432 ManagePasswordsController* manage_passwords_controller = |
| 433 TabSpecificContentSettings::FromWebContents(web_contents()); | 433 ManagePasswordsController::FromWebContents(web_contents()); |
| 434 if (content_settings) | 434 if (manage_passwords_controller) |
| 435 content_settings->OnPasswordAutofilled(best_matches); | 435 manage_passwords_controller->OnPasswordAutofilled(best_matches); |
| 436 } | 436 } |
| OLD | NEW |