| 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> |
| 11 | 11 |
| 12 #include "base/bind.h" | 12 #include "base/bind.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "components/password_manager/content/public/cpp/type_converters.h" | 14 #include "components/password_manager/content/public/cpp/type_converters.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/service_registry.h" | 16 #include "content/public/common/service_registry.h" |
| 17 #include "content/public/renderer/render_frame.h" | 17 #include "content/public/renderer/render_frame.h" |
| 18 #include "content/public/renderer/render_view.h" | 18 #include "content/public/renderer/render_view.h" |
| 19 #include "mojo/common/url_type_converters.h" | |
| 20 #include "third_party/WebKit/public/platform/WebCredential.h" | 19 #include "third_party/WebKit/public/platform/WebCredential.h" |
| 21 #include "third_party/WebKit/public/platform/WebCredentialManagerError.h" | 20 #include "third_party/WebKit/public/platform/WebCredentialManagerError.h" |
| 22 #include "third_party/WebKit/public/platform/WebFederatedCredential.h" | 21 #include "third_party/WebKit/public/platform/WebFederatedCredential.h" |
| 23 #include "third_party/WebKit/public/platform/WebPasswordCredential.h" | 22 #include "third_party/WebKit/public/platform/WebPasswordCredential.h" |
| 24 #include "third_party/WebKit/public/web/WebView.h" | 23 #include "third_party/WebKit/public/web/WebView.h" |
| 25 | 24 |
| 26 namespace password_manager { | 25 namespace password_manager { |
| 27 | 26 |
| 28 namespace { | 27 namespace { |
| 29 | 28 |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 const blink::WebVector<blink::WebURL>& federations, | 193 const blink::WebVector<blink::WebURL>& federations, |
| 195 RequestCallbacks* callbacks) { | 194 RequestCallbacks* callbacks) { |
| 196 DCHECK(callbacks); | 195 DCHECK(callbacks); |
| 197 ConnectToMojoCMIfNeeded(); | 196 ConnectToMojoCMIfNeeded(); |
| 198 | 197 |
| 199 std::vector<GURL> federation_vector; | 198 std::vector<GURL> federation_vector; |
| 200 for (size_t i = 0; i < std::min(federations.size(), kMaxFederations); ++i) | 199 for (size_t i = 0; i < std::min(federations.size(), kMaxFederations); ++i) |
| 201 federation_vector.push_back(federations[i]); | 200 federation_vector.push_back(federations[i]); |
| 202 | 201 |
| 203 mojo_cm_service_->Get( | 202 mojo_cm_service_->Get( |
| 204 zero_click_only, include_passwords, | 203 zero_click_only, include_passwords, std::move(federation_vector), |
| 205 mojo::Array<mojo::String>::From(federation_vector), | |
| 206 base::Bind(&RespondToRequestCallback, | 204 base::Bind(&RespondToRequestCallback, |
| 207 base::Owned(new RequestCallbacksWrapper(callbacks)))); | 205 base::Owned(new RequestCallbacksWrapper(callbacks)))); |
| 208 } | 206 } |
| 209 | 207 |
| 210 void CredentialManagerClient::ConnectToMojoCMIfNeeded() { | 208 void CredentialManagerClient::ConnectToMojoCMIfNeeded() { |
| 211 if (mojo_cm_service_) | 209 if (mojo_cm_service_) |
| 212 return; | 210 return; |
| 213 | 211 |
| 214 content::RenderFrame* main_frame = render_view()->GetMainRenderFrame(); | 212 content::RenderFrame* main_frame = render_view()->GetMainRenderFrame(); |
| 215 main_frame->GetServiceRegistry()->ConnectToRemoteService( | 213 main_frame->GetServiceRegistry()->ConnectToRemoteService( |
| 216 mojo::GetProxy(&mojo_cm_service_)); | 214 mojo::GetProxy(&mojo_cm_service_)); |
| 217 } | 215 } |
| 218 | 216 |
| 219 void CredentialManagerClient::OnDestruct() { | 217 void CredentialManagerClient::OnDestruct() { |
| 220 delete this; | 218 delete this; |
| 221 } | 219 } |
| 222 | 220 |
| 223 } // namespace password_manager | 221 } // namespace password_manager |
| OLD | NEW |