| 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 "components/password_manager/content/renderer/credential_manager_client
.h" | 5 #include "components/password_manager/content/renderer/credential_manager_client
.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 base::Bind(&RespondToRequestCallback, | 259 base::Bind(&RespondToRequestCallback, |
| 260 base::Owned(new RequestCallbacksWrapper(callbacks)))); | 260 base::Owned(new RequestCallbacksWrapper(callbacks)))); |
| 261 } | 261 } |
| 262 | 262 |
| 263 void CredentialManagerClient::ConnectToMojoCMIfNeeded() { | 263 void CredentialManagerClient::ConnectToMojoCMIfNeeded() { |
| 264 if (mojo_cm_service_) | 264 if (mojo_cm_service_) |
| 265 return; | 265 return; |
| 266 | 266 |
| 267 content::RenderFrame* main_frame = render_view()->GetMainRenderFrame(); | 267 content::RenderFrame* main_frame = render_view()->GetMainRenderFrame(); |
| 268 main_frame->GetRemoteInterfaces()->GetInterface(&mojo_cm_service_); | 268 main_frame->GetRemoteInterfaces()->GetInterface(&mojo_cm_service_); |
| 269 |
| 270 // The remote end of the pipe will be forcibly closed by the browser side |
| 271 // after each main frame navigation. Set up an error handler to reset the |
| 272 // local end so that there will be an attempt at reestablishing the connection |
| 273 // at the next call to the API. |
| 274 mojo_cm_service_.set_connection_error_handler(base::Bind( |
| 275 &CredentialManagerClient::OnMojoConnectionError, base::Unretained(this))); |
| 276 } |
| 277 |
| 278 void CredentialManagerClient::OnMojoConnectionError() { |
| 279 mojo_cm_service_.reset(); |
| 269 } | 280 } |
| 270 | 281 |
| 271 void CredentialManagerClient::OnDestruct() { | 282 void CredentialManagerClient::OnDestruct() { |
| 272 delete this; | 283 delete this; |
| 273 } | 284 } |
| 274 | 285 |
| 275 } // namespace password_manager | 286 } // namespace password_manager |
| OLD | NEW |