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

Side by Side Diff: components/password_manager/content/renderer/credential_manager_client.cc

Issue 2947413002: Restrict CM API interface request and message dispatch. (Closed)
Patch Set: Address nit from clamy@. Created 3 years, 5 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 "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>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/logging.h" 13 #include "base/logging.h"
14 #include "base/memory/ptr_util.h" 14 #include "base/memory/ptr_util.h"
15 #include "components/password_manager/core/common/credential_manager_types.h" 15 #include "components/password_manager/core/common/credential_manager_types.h"
16 #include "content/public/common/associated_interface_provider.h"
16 #include "content/public/renderer/render_frame.h" 17 #include "content/public/renderer/render_frame.h"
17 #include "content/public/renderer/render_view.h" 18 #include "content/public/renderer/render_view.h"
18 #include "services/service_manager/public/cpp/interface_provider.h"
19 #include "third_party/WebKit/public/platform/WebCredential.h" 19 #include "third_party/WebKit/public/platform/WebCredential.h"
20 #include "third_party/WebKit/public/platform/WebCredentialManagerError.h" 20 #include "third_party/WebKit/public/platform/WebCredentialManagerError.h"
21 #include "third_party/WebKit/public/platform/WebFederatedCredential.h" 21 #include "third_party/WebKit/public/platform/WebFederatedCredential.h"
22 #include "third_party/WebKit/public/platform/WebPasswordCredential.h" 22 #include "third_party/WebKit/public/platform/WebPasswordCredential.h"
23 #include "third_party/WebKit/public/web/WebView.h" 23 #include "third_party/WebKit/public/web/WebView.h"
24 24
25 namespace password_manager { 25 namespace password_manager {
26 26
27 namespace { 27 namespace {
28 28
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 federation_vector, 266 federation_vector,
267 base::Bind(&RespondToRequestCallback, 267 base::Bind(&RespondToRequestCallback,
268 base::Owned(new RequestCallbacksWrapper(callbacks)))); 268 base::Owned(new RequestCallbacksWrapper(callbacks))));
269 } 269 }
270 270
271 void CredentialManagerClient::ConnectToMojoCMIfNeeded() { 271 void CredentialManagerClient::ConnectToMojoCMIfNeeded() {
272 if (mojo_cm_service_) 272 if (mojo_cm_service_)
273 return; 273 return;
274 274
275 content::RenderFrame* main_frame = render_view()->GetMainRenderFrame(); 275 content::RenderFrame* main_frame = render_view()->GetMainRenderFrame();
276 main_frame->GetRemoteInterfaces()->GetInterface(&mojo_cm_service_); 276 main_frame->GetRemoteAssociatedInterfaces()->GetInterface(&mojo_cm_service_);
277
278 // The remote end of the pipe will be forcibly closed by the browser side
279 // after each main frame navigation. Set up an error handler to reset the
280 // local end so that there will be an attempt at reestablishing the connection
281 // at the next call to the API.
282 mojo_cm_service_.set_connection_error_handler(base::Bind(
283 &CredentialManagerClient::OnMojoConnectionError, base::Unretained(this)));
284 }
285
286 void CredentialManagerClient::OnMojoConnectionError() {
287 mojo_cm_service_.reset();
277 } 288 }
278 289
279 void CredentialManagerClient::OnDestruct() { 290 void CredentialManagerClient::OnDestruct() {
280 delete this; 291 delete this;
281 } 292 }
282 293
283 } // namespace password_manager 294 } // namespace password_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698