Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(616)

Side by Side Diff: chrome/browser/password_manager/chrome_password_manager_client.cc

Issue 1762603002: Switch components/password_manager code from IPC messages to Mojo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: gyp Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 new ChromePasswordManagerClient(contents, autofill_client)); 133 new ChromePasswordManagerClient(contents, autofill_client));
135 } 134 }
136 135
137 ChromePasswordManagerClient::ChromePasswordManagerClient( 136 ChromePasswordManagerClient::ChromePasswordManagerClient(
138 content::WebContents* web_contents, 137 content::WebContents* web_contents,
139 autofill::AutofillClient* autofill_client) 138 autofill::AutofillClient* autofill_client)
140 : content::WebContentsObserver(web_contents), 139 : content::WebContentsObserver(web_contents),
141 profile_(Profile::FromBrowserContext(web_contents->GetBrowserContext())), 140 profile_(Profile::FromBrowserContext(web_contents->GetBrowserContext())),
142 password_manager_(this), 141 password_manager_(this),
143 driver_factory_(nullptr), 142 driver_factory_(nullptr),
144 credential_manager_dispatcher_(web_contents, this), 143 credential_manager_impl_(web_contents, this),
145 observer_(nullptr), 144 observer_(nullptr),
146 credentials_filter_(this, 145 credentials_filter_(this,
147 base::Bind(&GetSyncService, profile_), 146 base::Bind(&GetSyncService, profile_),
148 base::Bind(&GetSigninManager, profile_)) { 147 base::Bind(&GetSigninManager, profile_)) {
149 ContentPasswordManagerDriverFactory::CreateForWebContents(web_contents, this, 148 ContentPasswordManagerDriverFactory::CreateForWebContents(web_contents, this,
150 autofill_client); 149 autofill_client);
151 driver_factory_ = 150 driver_factory_ =
152 ContentPasswordManagerDriverFactory::FromWebContents(web_contents); 151 ContentPasswordManagerDriverFactory::FromWebContents(web_contents);
153 log_manager_ = password_manager::LogManager::Create( 152 log_manager_ = password_manager::LogManager::Create(
154 password_manager::PasswordManagerInternalsServiceFactory:: 153 password_manager::PasswordManagerInternalsServiceFactory::
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 323
325 void ChromePasswordManagerClient::NotifySuccessfulLoginWithExistingPassword( 324 void ChromePasswordManagerClient::NotifySuccessfulLoginWithExistingPassword(
326 const autofill::PasswordForm& form) { 325 const autofill::PasswordForm& form) {
327 if (!possible_auto_sign_in_) 326 if (!possible_auto_sign_in_)
328 return; 327 return;
329 328
330 if (possible_auto_sign_in_->username_value == form.username_value && 329 if (possible_auto_sign_in_->username_value == form.username_value &&
331 possible_auto_sign_in_->password_value == form.password_value && 330 possible_auto_sign_in_->password_value == form.password_value &&
332 possible_auto_sign_in_->origin == form.origin) { 331 possible_auto_sign_in_->origin == form.origin) {
333 PromptUserToEnableAutosigninIfNecessary(); 332 PromptUserToEnableAutosigninIfNecessary();
334 if (form.skip_zero_click && 333 if (form.skip_zero_click && credential_manager_impl_.IsZeroClickAllowed() &&
335 credential_manager_dispatcher_.IsZeroClickAllowed() &&
336 GetPasswordStore()) { 334 GetPasswordStore()) {
337 autofill::PasswordForm update(form); 335 autofill::PasswordForm update(form);
338 update.skip_zero_click = false; 336 update.skip_zero_click = false;
339 GetPasswordStore()->UpdateLogin(update); 337 GetPasswordStore()->UpdateLogin(update);
340 } 338 }
341 } 339 }
342 possible_auto_sign_in_.reset(); 340 possible_auto_sign_in_.reset();
343 } 341 }
344 342
345 void ChromePasswordManagerClient::AutomaticPasswordSave( 343 void ChromePasswordManagerClient::AutomaticPasswordSave(
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 605
608 const password_manager::CredentialsFilter* 606 const password_manager::CredentialsFilter*
609 ChromePasswordManagerClient::GetStoreResultFilter() const { 607 ChromePasswordManagerClient::GetStoreResultFilter() const {
610 return &credentials_filter_; 608 return &credentials_filter_;
611 } 609 }
612 610
613 const password_manager::LogManager* ChromePasswordManagerClient::GetLogManager() 611 const password_manager::LogManager* ChromePasswordManagerClient::GetLogManager()
614 const { 612 const {
615 return log_manager_.get(); 613 return log_manager_.get();
616 } 614 }
615
616 // static
617 void ChromePasswordManagerClient::BindCredentialManager(
618 content::RenderFrameHost* render_frame_host,
619 password_manager::mojom::CredentialManagerRequest request) {
620 content::WebContents* web_contents =
621 content::WebContents::FromRenderFrameHost(render_frame_host);
622 DCHECK(web_contents);
623
624 ChromePasswordManagerClient* instance =
625 ChromePasswordManagerClient::FromWebContents(web_contents);
626 DCHECK(instance);
627 instance->credential_manager_impl_.BindRequest(std::move(request));
628 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698