Commit fdecf5aa authored by Miyoung Shin's avatar Miyoung Shin Committed by Commit Bot

Convert InternalAuthenticator to new Mojo types

This CL converts InternalAuthenticator{Ptr, Reqeust} in components
to the new Mojo types.

Bug: 955171
Change-Id: Ibc5ab83b99cb1fbfc6cbee2fdfa04735652e12e5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1773009
Commit-Queue: Vadym Doroshenko <dvadym@chromium.org>
Reviewed-by: default avatarKen Rockot <rockot@google.com>
Reviewed-by: default avatarVadym Doroshenko <dvadym@chromium.org>
Cr-Commit-Position: refs/heads/master@{#691515}
parent 7dfccec4
...@@ -4,6 +4,7 @@ include_rules = [ ...@@ -4,6 +4,7 @@ include_rules = [
"+components/strings/grit/components_strings.h", "+components/strings/grit/components_strings.h",
"+google_apis/gaia/gaia_urls.h", "+google_apis/gaia/gaia_urls.h",
"+net", "+net",
"+mojo/public",
"+third_party/protobuf", "+third_party/protobuf",
"+third_party/skia", "+third_party/skia",
"+third_party/zlib/google", "+third_party/zlib/google",
......
...@@ -98,13 +98,13 @@ bool ContentAutofillDriver::RendererIsAvailable() { ...@@ -98,13 +98,13 @@ bool ContentAutofillDriver::RendererIsAvailable() {
} }
void ContentAutofillDriver::ConnectToAuthenticator( void ContentAutofillDriver::ConnectToAuthenticator(
blink::mojom::InternalAuthenticatorRequest request) { mojo::PendingReceiver<blink::mojom::InternalAuthenticator> receiver) {
#if defined(OS_ANDROID) #if defined(OS_ANDROID)
render_frame_host_->GetJavaInterfaces()->GetInterface(std::move(request)); render_frame_host_->GetJavaInterfaces()->GetInterface(std::move(receiver));
#else #else
authenticator_impl_ = std::make_unique<content::InternalAuthenticatorImpl>( authenticator_impl_ = std::make_unique<content::InternalAuthenticatorImpl>(
render_frame_host_, url::Origin::Create(payments::GetBaseSecureUrl())); render_frame_host_, url::Origin::Create(payments::GetBaseSecureUrl()));
authenticator_impl_->Bind(std::move(request)); authenticator_impl_->Bind(std::move(receiver));
#endif #endif
} }
......
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
#include "components/autofill/core/browser/autofill_manager.h" #include "components/autofill/core/browser/autofill_manager.h"
#include "mojo/public/cpp/bindings/associated_receiver.h" #include "mojo/public/cpp/bindings/associated_receiver.h"
#include "mojo/public/cpp/bindings/associated_remote.h" #include "mojo/public/cpp/bindings/associated_remote.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
namespace content { namespace content {
class NavigationHandle; class NavigationHandle;
...@@ -59,7 +60,8 @@ class ContentAutofillDriver : public AutofillDriver, ...@@ -59,7 +60,8 @@ class ContentAutofillDriver : public AutofillDriver,
scoped_refptr<network::SharedURLLoaderFactory> GetURLLoaderFactory() override; scoped_refptr<network::SharedURLLoaderFactory> GetURLLoaderFactory() override;
bool RendererIsAvailable() override; bool RendererIsAvailable() override;
void ConnectToAuthenticator( void ConnectToAuthenticator(
blink::mojom::InternalAuthenticatorRequest request) override; mojo::PendingReceiver<blink::mojom::InternalAuthenticator> receiver)
override;
void SendFormDataToRenderer(int query_id, void SendFormDataToRenderer(int query_id,
RendererFormDataAction action, RendererFormDataAction action,
const FormData& data) override; const FormData& data) override;
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "base/memory/scoped_refptr.h" #include "base/memory/scoped_refptr.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "components/autofill/core/common/form_data.h" #include "components/autofill/core/common/form_data.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#if !defined(OS_IOS) #if !defined(OS_IOS)
#include "third_party/blink/public/mojom/webauthn/internal_authenticator.mojom.h" #include "third_party/blink/public/mojom/webauthn/internal_authenticator.mojom.h"
...@@ -65,7 +66,7 @@ class AutofillDriver { ...@@ -65,7 +66,7 @@ class AutofillDriver {
#if !defined(OS_IOS) #if !defined(OS_IOS)
// Binds the mojom request in order to facilitate WebAuthn flows. // Binds the mojom request in order to facilitate WebAuthn flows.
virtual void ConnectToAuthenticator( virtual void ConnectToAuthenticator(
blink::mojom::InternalAuthenticatorRequest request) = 0; mojo::PendingReceiver<blink::mojom::InternalAuthenticator> receiver) = 0;
#endif #endif
// Forwards |data| to the renderer. |query_id| is the id of the renderer's // Forwards |data| to the renderer. |query_id| is the id of the renderer's
......
...@@ -96,7 +96,7 @@ void CreditCardFIDOAuthenticator::IsUserVerifiable( ...@@ -96,7 +96,7 @@ void CreditCardFIDOAuthenticator::IsUserVerifiable(
if (base::FeatureList::IsEnabled( if (base::FeatureList::IsEnabled(
features::kAutofillCreditCardAuthentication)) { features::kAutofillCreditCardAuthentication)) {
autofill_driver_->ConnectToAuthenticator( autofill_driver_->ConnectToAuthenticator(
mojo::MakeRequest(&authenticator_)); authenticator_.BindNewPipeAndPassReceiver());
authenticator_->IsUserVerifyingPlatformAuthenticatorAvailable( authenticator_->IsUserVerifyingPlatformAuthenticatorAvailable(
std::move(callback)); std::move(callback));
} else { } else {
...@@ -133,7 +133,8 @@ void CreditCardFIDOAuthenticator::SyncUserOptIn( ...@@ -133,7 +133,8 @@ void CreditCardFIDOAuthenticator::SyncUserOptIn(
void CreditCardFIDOAuthenticator::GetAssertion( void CreditCardFIDOAuthenticator::GetAssertion(
PublicKeyCredentialRequestOptionsPtr request_options) { PublicKeyCredentialRequestOptionsPtr request_options) {
autofill_driver_->ConnectToAuthenticator(mojo::MakeRequest(&authenticator_)); autofill_driver_->ConnectToAuthenticator(
authenticator_.BindNewPipeAndPassReceiver());
authenticator_->GetAssertion( authenticator_->GetAssertion(
std::move(request_options), std::move(request_options),
base::BindOnce(&CreditCardFIDOAuthenticator::OnDidGetAssertion, base::BindOnce(&CreditCardFIDOAuthenticator::OnDidGetAssertion,
...@@ -142,7 +143,8 @@ void CreditCardFIDOAuthenticator::GetAssertion( ...@@ -142,7 +143,8 @@ void CreditCardFIDOAuthenticator::GetAssertion(
void CreditCardFIDOAuthenticator::MakeCredential( void CreditCardFIDOAuthenticator::MakeCredential(
PublicKeyCredentialCreationOptionsPtr creation_options) { PublicKeyCredentialCreationOptionsPtr creation_options) {
autofill_driver_->ConnectToAuthenticator(mojo::MakeRequest(&authenticator_)); autofill_driver_->ConnectToAuthenticator(
authenticator_.BindNewPipeAndPassReceiver());
authenticator_->MakeCredential( authenticator_->MakeCredential(
std::move(creation_options), std::move(creation_options),
base::BindOnce(&CreditCardFIDOAuthenticator::OnDidMakeCredential, base::BindOnce(&CreditCardFIDOAuthenticator::OnDidMakeCredential,
......
...@@ -14,6 +14,7 @@ ...@@ -14,6 +14,7 @@
#include "components/autofill/core/browser/payments/full_card_request.h" #include "components/autofill/core/browser/payments/full_card_request.h"
#include "components/autofill/core/browser/payments/payments_client.h" #include "components/autofill/core/browser/payments/payments_client.h"
#include "device/fido/fido_constants.h" #include "device/fido/fido_constants.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "third_party/blink/public/mojom/webauthn/internal_authenticator.mojom.h" #include "third_party/blink/public/mojom/webauthn/internal_authenticator.mojom.h"
namespace autofill { namespace autofill {
...@@ -21,7 +22,7 @@ namespace autofill { ...@@ -21,7 +22,7 @@ namespace autofill {
using blink::mojom::AuthenticatorStatus; using blink::mojom::AuthenticatorStatus;
using blink::mojom::GetAssertionAuthenticatorResponse; using blink::mojom::GetAssertionAuthenticatorResponse;
using blink::mojom::GetAssertionAuthenticatorResponsePtr; using blink::mojom::GetAssertionAuthenticatorResponsePtr;
using blink::mojom::InternalAuthenticatorPtr; using blink::mojom::InternalAuthenticator;
using blink::mojom::MakeCredentialAuthenticatorResponse; using blink::mojom::MakeCredentialAuthenticatorResponse;
using blink::mojom::MakeCredentialAuthenticatorResponsePtr; using blink::mojom::MakeCredentialAuthenticatorResponsePtr;
using blink::mojom::PublicKeyCredentialCreationOptions; using blink::mojom::PublicKeyCredentialCreationOptions;
...@@ -192,7 +193,7 @@ class CreditCardFIDOAuthenticator ...@@ -192,7 +193,7 @@ class CreditCardFIDOAuthenticator
payments::PaymentsClient* const payments_client_; payments::PaymentsClient* const payments_client_;
// Authenticator pointer to facilitate WebAuthn. // Authenticator pointer to facilitate WebAuthn.
InternalAuthenticatorPtr authenticator_; mojo::Remote<InternalAuthenticator> authenticator_;
// Responsible for getting the full card details, including the PAN and the // Responsible for getting the full card details, including the PAN and the
// CVC. // CVC.
......
...@@ -45,7 +45,7 @@ bool TestAutofillDriver::RendererIsAvailable() { ...@@ -45,7 +45,7 @@ bool TestAutofillDriver::RendererIsAvailable() {
#if !defined(OS_IOS) #if !defined(OS_IOS)
void TestAutofillDriver::ConnectToAuthenticator( void TestAutofillDriver::ConnectToAuthenticator(
blink::mojom::InternalAuthenticatorRequest request) {} mojo::PendingReceiver<blink::mojom::InternalAuthenticator> receiver) {}
#endif #endif
void TestAutofillDriver::SendFormDataToRenderer(int query_id, void TestAutofillDriver::SendFormDataToRenderer(int query_id,
......
...@@ -10,6 +10,7 @@ ...@@ -10,6 +10,7 @@
#include "base/memory/scoped_refptr.h" #include "base/memory/scoped_refptr.h"
#include "build/build_config.h" #include "build/build_config.h"
#include "components/autofill/core/browser/autofill_driver.h" #include "components/autofill/core/browser/autofill_driver.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#include "services/network/test/test_url_loader_factory.h" #include "services/network/test/test_url_loader_factory.h"
namespace autofill { namespace autofill {
...@@ -28,7 +29,8 @@ class TestAutofillDriver : public AutofillDriver { ...@@ -28,7 +29,8 @@ class TestAutofillDriver : public AutofillDriver {
bool RendererIsAvailable() override; bool RendererIsAvailable() override;
#if !defined(OS_IOS) #if !defined(OS_IOS)
void ConnectToAuthenticator( void ConnectToAuthenticator(
blink::mojom::InternalAuthenticatorRequest request) override; mojo::PendingReceiver<blink::mojom::InternalAuthenticator> receiver)
override;
#endif #endif
void SendFormDataToRenderer(int query_id, void SendFormDataToRenderer(int query_id,
RendererFormDataAction action, RendererFormDataAction action,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment