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" |
36 #include "components/password_manager/core/browser/browser_save_password_progres
s_logger.h" | 37 #include "components/password_manager/core/browser/browser_save_password_progres
s_logger.h" |
37 #include "components/password_manager/core/browser/log_manager.h" | 38 #include "components/password_manager/core/browser/log_manager.h" |
38 #include "components/password_manager/core/browser/log_receiver.h" | 39 #include "components/password_manager/core/browser/log_receiver.h" |
39 #include "components/password_manager/core/browser/password_bubble_experiment.h" | 40 #include "components/password_manager/core/browser/password_bubble_experiment.h" |
40 #include "components/password_manager/core/browser/password_form_manager.h" | 41 #include "components/password_manager/core/browser/password_form_manager.h" |
41 #include "components/password_manager/core/browser/password_manager_internals_se
rvice.h" | 42 #include "components/password_manager/core/browser/password_manager_internals_se
rvice.h" |
42 #include "components/password_manager/core/browser/password_manager_metrics_util
.h" | 43 #include "components/password_manager/core/browser/password_manager_metrics_util
.h" |
43 #include "components/password_manager/core/browser/password_manager_settings_mig
ration_experiment.h" | 44 #include "components/password_manager/core/browser/password_manager_settings_mig
ration_experiment.h" |
44 #include "components/password_manager/core/browser/password_manager_util.h" | 45 #include "components/password_manager/core/browser/password_manager_util.h" |
45 #include "components/password_manager/core/common/credential_manager_types.h" | 46 #include "components/password_manager/core/common/credential_manager_types.h" |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 new ChromePasswordManagerClient(contents, autofill_client)); | 134 new ChromePasswordManagerClient(contents, autofill_client)); |
134 } | 135 } |
135 | 136 |
136 ChromePasswordManagerClient::ChromePasswordManagerClient( | 137 ChromePasswordManagerClient::ChromePasswordManagerClient( |
137 content::WebContents* web_contents, | 138 content::WebContents* web_contents, |
138 autofill::AutofillClient* autofill_client) | 139 autofill::AutofillClient* autofill_client) |
139 : content::WebContentsObserver(web_contents), | 140 : content::WebContentsObserver(web_contents), |
140 profile_(Profile::FromBrowserContext(web_contents->GetBrowserContext())), | 141 profile_(Profile::FromBrowserContext(web_contents->GetBrowserContext())), |
141 password_manager_(this), | 142 password_manager_(this), |
142 driver_factory_(nullptr), | 143 driver_factory_(nullptr), |
143 credential_manager_impl_(web_contents, this), | 144 credential_manager_dispatcher_(web_contents, this), |
144 observer_(nullptr), | 145 observer_(nullptr), |
145 credentials_filter_(this, | 146 credentials_filter_(this, |
146 base::Bind(&GetSyncService, profile_), | 147 base::Bind(&GetSyncService, profile_), |
147 base::Bind(&GetSigninManager, profile_)) { | 148 base::Bind(&GetSigninManager, profile_)) { |
148 ContentPasswordManagerDriverFactory::CreateForWebContents(web_contents, this, | 149 ContentPasswordManagerDriverFactory::CreateForWebContents(web_contents, this, |
149 autofill_client); | 150 autofill_client); |
150 driver_factory_ = | 151 driver_factory_ = |
151 ContentPasswordManagerDriverFactory::FromWebContents(web_contents); | 152 ContentPasswordManagerDriverFactory::FromWebContents(web_contents); |
152 log_manager_ = password_manager::LogManager::Create( | 153 log_manager_ = password_manager::LogManager::Create( |
153 password_manager::PasswordManagerInternalsServiceFactory:: | 154 password_manager::PasswordManagerInternalsServiceFactory:: |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 | 322 |
322 void ChromePasswordManagerClient::NotifySuccessfulLoginWithExistingPassword( | 323 void ChromePasswordManagerClient::NotifySuccessfulLoginWithExistingPassword( |
323 const autofill::PasswordForm& form) { | 324 const autofill::PasswordForm& form) { |
324 if (!possible_auto_sign_in_) | 325 if (!possible_auto_sign_in_) |
325 return; | 326 return; |
326 | 327 |
327 if (possible_auto_sign_in_->username_value == form.username_value && | 328 if (possible_auto_sign_in_->username_value == form.username_value && |
328 possible_auto_sign_in_->password_value == form.password_value && | 329 possible_auto_sign_in_->password_value == form.password_value && |
329 possible_auto_sign_in_->origin == form.origin) { | 330 possible_auto_sign_in_->origin == form.origin) { |
330 PromptUserToEnableAutosigninIfNecessary(); | 331 PromptUserToEnableAutosigninIfNecessary(); |
331 if (form.skip_zero_click && credential_manager_impl_.IsZeroClickAllowed() && | 332 if (form.skip_zero_click && |
| 333 credential_manager_dispatcher_.IsZeroClickAllowed() && |
332 GetPasswordStore()) { | 334 GetPasswordStore()) { |
333 autofill::PasswordForm update(form); | 335 autofill::PasswordForm update(form); |
334 update.skip_zero_click = false; | 336 update.skip_zero_click = false; |
335 GetPasswordStore()->UpdateLogin(update); | 337 GetPasswordStore()->UpdateLogin(update); |
336 } | 338 } |
337 } | 339 } |
338 possible_auto_sign_in_.reset(); | 340 possible_auto_sign_in_.reset(); |
339 } | 341 } |
340 | 342 |
341 void ChromePasswordManagerClient::AutomaticPasswordSave( | 343 void ChromePasswordManagerClient::AutomaticPasswordSave( |
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 | 605 |
604 const password_manager::CredentialsFilter* | 606 const password_manager::CredentialsFilter* |
605 ChromePasswordManagerClient::GetStoreResultFilter() const { | 607 ChromePasswordManagerClient::GetStoreResultFilter() const { |
606 return &credentials_filter_; | 608 return &credentials_filter_; |
607 } | 609 } |
608 | 610 |
609 const password_manager::LogManager* ChromePasswordManagerClient::GetLogManager() | 611 const password_manager::LogManager* ChromePasswordManagerClient::GetLogManager() |
610 const { | 612 const { |
611 return log_manager_.get(); | 613 return log_manager_.get(); |
612 } | 614 } |
613 | |
614 // static | |
615 void ChromePasswordManagerClient::BindCredentialManager( | |
616 content::RenderFrameHost* render_frame_host, | |
617 password_manager::mojom::CredentialManagerRequest request) { | |
618 content::WebContents* web_contents = | |
619 content::WebContents::FromRenderFrameHost(render_frame_host); | |
620 DCHECK(web_contents); | |
621 | |
622 ChromePasswordManagerClient* instance = | |
623 ChromePasswordManagerClient::FromWebContents(web_contents); | |
624 DCHECK(instance); | |
625 instance->credential_manager_impl_.BindRequest(std::move(request)); | |
626 } | |
OLD | NEW |