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

Unified Diff: components/password_manager/content/browser/credential_manager_impl.cc

Issue 2947413002: Restrict CM API interface request and message dispatch. (Closed)
Patch Set: Reworked tests, added error handler in renderer. Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
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,

Powered by Google App Engine
This is Rietveld 408576698