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

Unified Diff: components/password_manager/content/renderer/credential_manager_client.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/renderer/credential_manager_client.cc
diff --git a/components/password_manager/content/renderer/credential_manager_client.cc b/components/password_manager/content/renderer/credential_manager_client.cc
index 1111e03a58dca3567e43b7e77d87c41a393d0597..aa3cbaa72ab60a9e0f4e2eff5820baf52797acdc 100644
--- a/components/password_manager/content/renderer/credential_manager_client.cc
+++ b/components/password_manager/content/renderer/credential_manager_client.cc
@@ -266,6 +266,17 @@ void CredentialManagerClient::ConnectToMojoCMIfNeeded() {
content::RenderFrame* main_frame = render_view()->GetMainRenderFrame();
main_frame->GetRemoteInterfaces()->GetInterface(&mojo_cm_service_);
+
+ // The remote end of the pipe will be forcibly closed by the browser side
+ // after each main frame navigation. Set up an error handler to reset the
+ // local end so that there will be an attempt at reestablishing the connection
+ // at the next call to the API.
+ mojo_cm_service_.set_connection_error_handler(base::Bind(
+ &CredentialManagerClient::OnMojoConnectionError, base::Unretained(this)));
+}
+
+void CredentialManagerClient::OnMojoConnectionError() {
+ mojo_cm_service_.reset();
}
void CredentialManagerClient::OnDestruct() {

Powered by Google App Engine
This is Rietveld 408576698