Chromium Code Reviews| Index: components/password_manager/content/browser/credential_manager_impl.cc |
| diff --git a/components/password_manager/content/browser/credential_manager_impl.cc b/components/password_manager/content/browser/credential_manager_impl.cc |
| index d78025d7226635b14e1f21be113fe5a3d3360591..47c77770dcdf6c27846ed7882cbdd00dc8b1d9c3 100644 |
| --- a/components/password_manager/content/browser/credential_manager_impl.cc |
| +++ b/components/password_manager/content/browser/credential_manager_impl.cc |
| @@ -40,7 +40,10 @@ void RunMojoGetCallback(mojom::CredentialManager::GetCallback callback, |
| CredentialManagerImpl::CredentialManagerImpl(content::WebContents* web_contents, |
| PasswordManagerClient* client) |
| - : WebContentsObserver(web_contents), client_(client), weak_factory_(this) { |
| + : WebContentsObserver(web_contents), |
| + client_(client), |
| + binding_(this), |
| + weak_factory_(this) { |
| DCHECK(web_contents); |
| auto_signin_enabled_.Init(prefs::kCredentialsEnableAutosignin, |
| client_->GetPrefs()); |
| @@ -50,7 +53,18 @@ CredentialManagerImpl::~CredentialManagerImpl() {} |
| void CredentialManagerImpl::BindRequest( |
| mojom::CredentialManagerRequest request) { |
| - bindings_.AddBinding(this, std::move(request)); |
| + // This can happen if the pipe broke and the renderer is now reconnecting. |
| + if (binding_.is_bound()) |
| + binding_.Close(); |
|
dcheng
2017/06/28 19:04:49
I'm confused how we could get here--shouldn't the
engedy
2017/06/28 19:26:34
I was trying to be on the safe side here -- my thi
dcheng
2017/06/29 06:43:49
One common alternative is to add an explicit conne
engedy
2017/06/30 19:41:55
Yep, added error handler.
|
| + binding_.Bind(std::move(request)); |
| +} |
| + |
| +bool CredentialManagerImpl::HasBinding() const { |
| + return binding_.is_bound(); |
| +} |
| + |
| +void CredentialManagerImpl::DisconnectBinding() { |
| + binding_.Close(); |
| } |
| void CredentialManagerImpl::Store(const CredentialInfo& credential, |