Commit 42437ff7 authored by Rouslan Solomakhin's avatar Rouslan Solomakhin Committed by Commit Bot

[Web Payment] Modern disallow and more private members.

Before this patch, the classes in payment_app_provider_impl.h/cc used a
combination of the deprecated DISALLOW_COPY_AND_ASSIGN and not
specifying copying behavior.

This patch removes DISALLOW_COPY_AND_ASSIGN and instead explicitly
deletes the copy constructor and assign operator in
payment_app_provider_impl.h/cc.

After this patch, the classes in payment_app_provider_impl.h/cc use the
current style of explicitly deleting their copy constructor and assign
operator.

Bug: 1005076
Change-Id: Ibae5b145927e2fd8e1e751605caf4aaa49b41ce4
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2090491
Commit-Queue: Rouslan Solomakhin <rouslan@chromium.org>
Reviewed-by: default avatarDanyao Wang <danyao@chromium.org>
Cr-Commit-Position: refs/heads/master@{#748733}
parent 0a74021a
......@@ -82,6 +82,12 @@ class InvokePaymentAppCallbackRepository {
return base::Singleton<InvokePaymentAppCallbackRepository>::get();
}
// Disallow copy and assign.
InvokePaymentAppCallbackRepository(
const InvokePaymentAppCallbackRepository& other) = delete;
InvokePaymentAppCallbackRepository& operator=(
const InvokePaymentAppCallbackRepository& other) = delete;
RespondWithCallbacks* GetCallback(BrowserContext* browser_context) {
DCHECK_CURRENTLY_ON(ServiceWorkerContext::GetCoreThreadId());
auto it = invoke_callbacks_.find(browser_context);
......@@ -103,8 +109,8 @@ class InvokePaymentAppCallbackRepository {
}
private:
InvokePaymentAppCallbackRepository() {}
~InvokePaymentAppCallbackRepository() {}
InvokePaymentAppCallbackRepository() = default;
~InvokePaymentAppCallbackRepository() = default;
friend struct base::DefaultSingletonTraits<
InvokePaymentAppCallbackRepository>;
......@@ -146,6 +152,10 @@ class RespondWithCallbacks : public PaymentHandlerResponseCallback {
weak_ptr_factory_.GetWeakPtr()));
}
// Disallow copy and assign.
RespondWithCallbacks(const RespondWithCallbacks& other) = delete;
RespondWithCallbacks& operator=(const RespondWithCallbacks& other) = delete;
mojo::PendingRemote<PaymentHandlerResponseCallback>
BindNewPipeAndPassRemote() {
return receiver_.BindNewPipeAndPassRemote();
......@@ -239,7 +249,7 @@ class RespondWithCallbacks : public PaymentHandlerResponseCallback {
}
private:
~RespondWithCallbacks() override {}
~RespondWithCallbacks() override = default;
void ClearCallbackRepositoryAndCloseWindow() {
DCHECK_CURRENTLY_ON(ServiceWorkerContext::GetCoreThreadId());
......@@ -266,8 +276,6 @@ class RespondWithCallbacks : public PaymentHandlerResponseCallback {
mojo::Receiver<PaymentHandlerResponseCallback> receiver_{this};
base::WeakPtrFactory<RespondWithCallbacks> weak_ptr_factory_{this};
DISALLOW_COPY_AND_ASSIGN(RespondWithCallbacks);
};
void DidGetAllPaymentAppsOnCoreThread(
......
......@@ -5,7 +5,6 @@
#ifndef CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_PROVIDER_IMPL_H_
#define CONTENT_BROWSER_PAYMENTS_PAYMENT_APP_PROVIDER_IMPL_H_
#include "base/macros.h"
#include "base/memory/singleton.h"
#include "content/common/content_export.h"
#include "content/public/browser/payment_app_provider.h"
......@@ -17,6 +16,11 @@ class CONTENT_EXPORT PaymentAppProviderImpl : public PaymentAppProvider {
public:
static PaymentAppProviderImpl* GetInstance();
// Disallow copy and assign.
PaymentAppProviderImpl(const PaymentAppProviderImpl& other) = delete;
PaymentAppProviderImpl& operator=(const PaymentAppProviderImpl& other) =
delete;
// PaymentAppProvider implementation:
// Should be accessed only on the UI thread.
void GetAllPaymentApps(BrowserContext* browser_context,
......@@ -75,8 +79,6 @@ class CONTENT_EXPORT PaymentAppProviderImpl : public PaymentAppProvider {
// Map to maintain at most one opened window per browser context.
std::map<BrowserContext*, std::unique_ptr<PaymentHandlerWindowObserver>>
payment_handler_windows_;
DISALLOW_COPY_AND_ASSIGN(PaymentAppProviderImpl);
};
} // namespace content
......
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