| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/chrome_password_manager_client.h" | 5 #include "chrome/browser/password_manager/chrome_password_manager_client.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 #include "chrome/common/features.h" | 26 #include "chrome/common/features.h" |
| 27 #include "chrome/common/url_constants.h" | 27 #include "chrome/common/url_constants.h" |
| 28 #include "components/autofill/content/browser/content_autofill_driver.h" | 28 #include "components/autofill/content/browser/content_autofill_driver.h" |
| 29 #include "components/autofill/content/browser/content_autofill_driver_factory.h" | 29 #include "components/autofill/content/browser/content_autofill_driver_factory.h" |
| 30 #include "components/autofill/content/common/autofill_messages.h" | 30 #include "components/autofill/content/common/autofill_messages.h" |
| 31 #include "components/autofill/core/browser/password_generator.h" | 31 #include "components/autofill/core/browser/password_generator.h" |
| 32 #include "components/autofill/core/common/password_form.h" | 32 #include "components/autofill/core/common/password_form.h" |
| 33 #include "components/browser_sync/browser/profile_sync_service.h" | 33 #include "components/browser_sync/browser/profile_sync_service.h" |
| 34 #include "components/password_manager/content/browser/content_password_manager_d
river.h" | 34 #include "components/password_manager/content/browser/content_password_manager_d
river.h" |
| 35 #include "components/password_manager/content/browser/password_manager_internals
_service_factory.h" | 35 #include "components/password_manager/content/browser/password_manager_internals
_service_factory.h" |
| 36 #include "components/password_manager/content/common/credential_manager_messages
.h" | |
| 37 #include "components/password_manager/core/browser/browser_save_password_progres
s_logger.h" | 36 #include "components/password_manager/core/browser/browser_save_password_progres
s_logger.h" |
| 38 #include "components/password_manager/core/browser/log_manager.h" | 37 #include "components/password_manager/core/browser/log_manager.h" |
| 39 #include "components/password_manager/core/browser/log_receiver.h" | 38 #include "components/password_manager/core/browser/log_receiver.h" |
| 40 #include "components/password_manager/core/browser/password_bubble_experiment.h" | 39 #include "components/password_manager/core/browser/password_bubble_experiment.h" |
| 41 #include "components/password_manager/core/browser/password_form_manager.h" | 40 #include "components/password_manager/core/browser/password_form_manager.h" |
| 42 #include "components/password_manager/core/browser/password_manager_internals_se
rvice.h" | 41 #include "components/password_manager/core/browser/password_manager_internals_se
rvice.h" |
| 43 #include "components/password_manager/core/browser/password_manager_metrics_util
.h" | 42 #include "components/password_manager/core/browser/password_manager_metrics_util
.h" |
| 44 #include "components/password_manager/core/browser/password_manager_settings_mig
ration_experiment.h" | 43 #include "components/password_manager/core/browser/password_manager_settings_mig
ration_experiment.h" |
| 45 #include "components/password_manager/core/browser/password_manager_util.h" | 44 #include "components/password_manager/core/browser/password_manager_util.h" |
| 46 #include "components/password_manager/core/common/credential_manager_types.h" | 45 #include "components/password_manager/core/common/credential_manager_types.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 new ChromePasswordManagerClient(contents, autofill_client)); | 134 new ChromePasswordManagerClient(contents, autofill_client)); |
| 136 } | 135 } |
| 137 | 136 |
| 138 ChromePasswordManagerClient::ChromePasswordManagerClient( | 137 ChromePasswordManagerClient::ChromePasswordManagerClient( |
| 139 content::WebContents* web_contents, | 138 content::WebContents* web_contents, |
| 140 autofill::AutofillClient* autofill_client) | 139 autofill::AutofillClient* autofill_client) |
| 141 : content::WebContentsObserver(web_contents), | 140 : content::WebContentsObserver(web_contents), |
| 142 profile_(Profile::FromBrowserContext(web_contents->GetBrowserContext())), | 141 profile_(Profile::FromBrowserContext(web_contents->GetBrowserContext())), |
| 143 password_manager_(this), | 142 password_manager_(this), |
| 144 driver_factory_(nullptr), | 143 driver_factory_(nullptr), |
| 145 credential_manager_dispatcher_(web_contents, this), | 144 credential_manager_impl_(web_contents, this), |
| 146 observer_(nullptr), | 145 observer_(nullptr), |
| 147 credentials_filter_(this, | 146 credentials_filter_(this, |
| 148 base::Bind(&GetSyncService, profile_), | 147 base::Bind(&GetSyncService, profile_), |
| 149 base::Bind(&GetSigninManager, profile_)) { | 148 base::Bind(&GetSigninManager, profile_)) { |
| 150 ContentPasswordManagerDriverFactory::CreateForWebContents(web_contents, this, | 149 ContentPasswordManagerDriverFactory::CreateForWebContents(web_contents, this, |
| 151 autofill_client); | 150 autofill_client); |
| 152 driver_factory_ = | 151 driver_factory_ = |
| 153 ContentPasswordManagerDriverFactory::FromWebContents(web_contents); | 152 ContentPasswordManagerDriverFactory::FromWebContents(web_contents); |
| 154 log_manager_ = password_manager::LogManager::Create( | 153 log_manager_ = password_manager::LogManager::Create( |
| 155 password_manager::PasswordManagerInternalsServiceFactory:: | 154 password_manager::PasswordManagerInternalsServiceFactory:: |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 | 328 |
| 330 void ChromePasswordManagerClient::NotifySuccessfulLoginWithExistingPassword( | 329 void ChromePasswordManagerClient::NotifySuccessfulLoginWithExistingPassword( |
| 331 const autofill::PasswordForm& form) { | 330 const autofill::PasswordForm& form) { |
| 332 if (!possible_auto_sign_in_) | 331 if (!possible_auto_sign_in_) |
| 333 return; | 332 return; |
| 334 | 333 |
| 335 if (possible_auto_sign_in_->username_value == form.username_value && | 334 if (possible_auto_sign_in_->username_value == form.username_value && |
| 336 possible_auto_sign_in_->password_value == form.password_value && | 335 possible_auto_sign_in_->password_value == form.password_value && |
| 337 possible_auto_sign_in_->origin == form.origin) { | 336 possible_auto_sign_in_->origin == form.origin) { |
| 338 PromptUserToEnableAutosigninIfNecessary(); | 337 PromptUserToEnableAutosigninIfNecessary(); |
| 339 if (form.skip_zero_click && | 338 if (form.skip_zero_click && credential_manager_impl_.IsZeroClickAllowed() && |
| 340 credential_manager_dispatcher_.IsZeroClickAllowed() && | |
| 341 GetPasswordStore()) { | 339 GetPasswordStore()) { |
| 342 autofill::PasswordForm update(form); | 340 autofill::PasswordForm update(form); |
| 343 update.skip_zero_click = false; | 341 update.skip_zero_click = false; |
| 344 GetPasswordStore()->UpdateLogin(update); | 342 GetPasswordStore()->UpdateLogin(update); |
| 345 } | 343 } |
| 346 } | 344 } |
| 347 possible_auto_sign_in_.reset(); | 345 possible_auto_sign_in_.reset(); |
| 348 } | 346 } |
| 349 | 347 |
| 350 void ChromePasswordManagerClient::AutomaticPasswordSave( | 348 void ChromePasswordManagerClient::AutomaticPasswordSave( |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 | 610 |
| 613 const password_manager::CredentialsFilter* | 611 const password_manager::CredentialsFilter* |
| 614 ChromePasswordManagerClient::GetStoreResultFilter() const { | 612 ChromePasswordManagerClient::GetStoreResultFilter() const { |
| 615 return &credentials_filter_; | 613 return &credentials_filter_; |
| 616 } | 614 } |
| 617 | 615 |
| 618 const password_manager::LogManager* ChromePasswordManagerClient::GetLogManager() | 616 const password_manager::LogManager* ChromePasswordManagerClient::GetLogManager() |
| 619 const { | 617 const { |
| 620 return log_manager_.get(); | 618 return log_manager_.get(); |
| 621 } | 619 } |
| 620 |
| 621 // static |
| 622 void ChromePasswordManagerClient::BindCredentialManager( |
| 623 content::RenderFrameHost* render_frame_host, |
| 624 password_manager::mojom::CredentialManagerRequest request) { |
| 625 content::WebContents* web_contents = |
| 626 content::WebContents::FromRenderFrameHost(render_frame_host); |
| 627 DCHECK(web_contents); |
| 628 |
| 629 ChromePasswordManagerClient* instance = |
| 630 ChromePasswordManagerClient::FromWebContents(web_contents); |
| 631 DCHECK(instance); |
| 632 instance->credential_manager_impl_.BindRequest(std::move(request)); |
| 633 } |
| OLD | NEW |