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 = [
"+components/strings/grit/components_strings.h",
"+google_apis/gaia/gaia_urls.h",
"+net",
"+mojo/public",
"+third_party/protobuf",
"+third_party/skia",
"+third_party/zlib/google",
......
......@@ -98,13 +98,13 @@ bool ContentAutofillDriver::RendererIsAvailable() {
}
void ContentAutofillDriver::ConnectToAuthenticator(
blink::mojom::InternalAuthenticatorRequest request) {
mojo::PendingReceiver<blink::mojom::InternalAuthenticator> receiver) {
#if defined(OS_ANDROID)
render_frame_host_->GetJavaInterfaces()->GetInterface(std::move(request));
render_frame_host_->GetJavaInterfaces()->GetInterface(std::move(receiver));
#else
authenticator_impl_ = std::make_unique<content::InternalAuthenticatorImpl>(
render_frame_host_, url::Origin::Create(payments::GetBaseSecureUrl()));
authenticator_impl_->Bind(std::move(request));
authenticator_impl_->Bind(std::move(receiver));
#endif
}
......
......@@ -19,6 +19,7 @@
#include "components/autofill/core/browser/autofill_manager.h"
#include "mojo/public/cpp/bindings/associated_receiver.h"
#include "mojo/public/cpp/bindings/associated_remote.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
namespace content {
class NavigationHandle;
......@@ -59,7 +60,8 @@ class ContentAutofillDriver : public AutofillDriver,
scoped_refptr<network::SharedURLLoaderFactory> GetURLLoaderFactory() override;
bool RendererIsAvailable() override;
void ConnectToAuthenticator(
blink::mojom::InternalAuthenticatorRequest request) override;
mojo::PendingReceiver<blink::mojom::InternalAuthenticator> receiver)
override;
void SendFormDataToRenderer(int query_id,
RendererFormDataAction action,
const FormData& data) override;
......
......@@ -10,6 +10,7 @@
#include "base/memory/scoped_refptr.h"
#include "build/build_config.h"
#include "components/autofill/core/common/form_data.h"
#include "mojo/public/cpp/bindings/pending_receiver.h"
#if !defined(OS_IOS)
#include "third_party/blink/public/mojom/webauthn/internal_authenticator.mojom.h"
......@@ -65,7 +66,7 @@ class AutofillDriver {
#if !defined(OS_IOS)
// Binds the mojom request in order to facilitate WebAuthn flows.
virtual void ConnectToAuthenticator(
blink::mojom::InternalAuthenticatorRequest request) = 0;
mojo::PendingReceiver<blink::mojom::InternalAuthenticator> receiver) = 0;
#endif
// Forwards |data| to the renderer. |query_id| is the id of the renderer's
......
......@@ -96,7 +96,7 @@ void CreditCardFIDOAuthenticator::IsUserVerifiable(
if (base::FeatureList::IsEnabled(
features::kAutofillCreditCardAuthentication)) {
autofill_driver_->ConnectToAuthenticator(
mojo::MakeRequest(&authenticator_));
authenticator_.BindNewPipeAndPassReceiver());
authenticator_->IsUserVerifyingPlatformAuthenticatorAvailable(
std::move(callback));
} else {
......@@ -133,7 +133,8 @@ void CreditCardFIDOAuthenticator::SyncUserOptIn(
void CreditCardFIDOAuthenticator::GetAssertion(
PublicKeyCredentialRequestOptionsPtr request_options) {
autofill_driver_->ConnectToAuthenticator(mojo::MakeRequest(&authenticator_));
autofill_driver_->ConnectToAuthenticator(
authenticator_.BindNewPipeAndPassReceiver());
authenticator_->GetAssertion(
std::move(request_options),
base::BindOnce(&CreditCardFIDOAuthenticator::OnDidGetAssertion,
......@@ -142,7 +143,8 @@ void CreditCardFIDOAuthenticator::GetAssertion(
void CreditCardFIDOAuthenticator::MakeCredential(
PublicKeyCredentialCreationOptionsPtr creation_options) {
autofill_driver_->ConnectToAuthenticator(mojo::MakeRequest(&authenticator_));
autofill_driver_->ConnectToAuthenticator(
authenticator_.BindNewPipeAndPassReceiver());
authenticator_->MakeCredential(
std::move(creation_options),
base::BindOnce(&CreditCardFIDOAuthenticator::OnDidMakeCredential,
......
......@@ -14,6 +14,7 @@
#include "components/autofill/core/browser/payments/full_card_request.h"
#include "components/autofill/core/browser/payments/payments_client.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"
namespace autofill {
......@@ -21,7 +22,7 @@ namespace autofill {
using blink::mojom::AuthenticatorStatus;
using blink::mojom::GetAssertionAuthenticatorResponse;
using blink::mojom::GetAssertionAuthenticatorResponsePtr;
using blink::mojom::InternalAuthenticatorPtr;
using blink::mojom::InternalAuthenticator;
using blink::mojom::MakeCredentialAuthenticatorResponse;
using blink::mojom::MakeCredentialAuthenticatorResponsePtr;
using blink::mojom::PublicKeyCredentialCreationOptions;
......@@ -192,7 +193,7 @@ class CreditCardFIDOAuthenticator
payments::PaymentsClient* const payments_client_;
// Authenticator pointer to facilitate WebAuthn.
InternalAuthenticatorPtr authenticator_;
mojo::Remote<InternalAuthenticator> authenticator_;
// Responsible for getting the full card details, including the PAN and the
// CVC.
......
......@@ -45,7 +45,7 @@ bool TestAutofillDriver::RendererIsAvailable() {
#if !defined(OS_IOS)
void TestAutofillDriver::ConnectToAuthenticator(
blink::mojom::InternalAuthenticatorRequest request) {}
mojo::PendingReceiver<blink::mojom::InternalAuthenticator> receiver) {}
#endif
void TestAutofillDriver::SendFormDataToRenderer(int query_id,
......
......@@ -10,6 +10,7 @@
#include "base/memory/scoped_refptr.h"
#include "build/build_config.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"
namespace autofill {
......@@ -28,7 +29,8 @@ class TestAutofillDriver : public AutofillDriver {
bool RendererIsAvailable() override;
#if !defined(OS_IOS)
void ConnectToAuthenticator(
blink::mojom::InternalAuthenticatorRequest request) override;
mojo::PendingReceiver<blink::mojom::InternalAuthenticator> receiver)
override;
#endif
void SendFormDataToRenderer(int query_id,
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