refactor: replace deprecated DISALLOW_COPY_AND_ASSIGN (#31633)

This commit is contained in:
Milan Burda 2021-11-03 12:41:45 +01:00 committed by GitHub
parent 2a2a1a834c
commit 65a980c673
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
231 changed files with 918 additions and 576 deletions

View file

@ -35,8 +35,6 @@ class LibnotifyNotification : public Notification {
char*);
NotifyNotification* notification_ = nullptr;
DISALLOW_COPY_AND_ASSIGN(LibnotifyNotification);
};
} // namespace electron

View file

@ -18,8 +18,6 @@ class NotificationPresenterLinux : public NotificationPresenter {
private:
Notification* CreateNotificationObject(
NotificationDelegate* delegate) override;
DISALLOW_COPY_AND_ASSIGN(NotificationPresenterLinux);
};
} // namespace electron

View file

@ -39,8 +39,6 @@ class CocoaNotification : public Notification {
base::scoped_nsobject<NSUserNotification> notification_;
std::map<std::string, unsigned> additional_action_indices_;
unsigned action_index_;
DISALLOW_COPY_AND_ASSIGN(CocoaNotification);
};
} // namespace electron

View file

@ -27,8 +27,6 @@ class NotificationPresenterMac : public NotificationPresenter {
base::scoped_nsobject<NotificationCenterDelegate>
notification_center_delegate_;
DISALLOW_COPY_AND_ASSIGN(NotificationPresenterMac);
};
} // namespace electron

View file

@ -72,6 +72,10 @@ class Notification {
NotificationPresenter* presenter() const { return presenter_; }
const std::string& notification_id() const { return notification_id_; }
// disable copy
Notification(const Notification&) = delete;
Notification& operator=(const Notification&) = delete;
protected:
Notification(NotificationDelegate* delegate,
NotificationPresenter* presenter);
@ -82,8 +86,6 @@ class Notification {
std::string notification_id_;
base::WeakPtrFactory<Notification> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(Notification);
};
} // namespace electron

View file

@ -28,6 +28,10 @@ class NotificationPresenter {
std::set<Notification*> notifications() const { return notifications_; }
// disable copy
NotificationPresenter(const NotificationPresenter&) = delete;
NotificationPresenter& operator=(const NotificationPresenter&) = delete;
protected:
NotificationPresenter();
virtual Notification* CreateNotificationObject(
@ -39,8 +43,6 @@ class NotificationPresenter {
void RemoveNotification(Notification* notification);
std::set<Notification*> notifications_;
DISALLOW_COPY_AND_ASSIGN(NotificationPresenter);
};
} // namespace electron

View file

@ -46,6 +46,10 @@ class NotificationDelegateImpl final : public electron::NotificationDelegate {
explicit NotificationDelegateImpl(const std::string& notification_id)
: notification_id_(notification_id) {}
// disable copy
NotificationDelegateImpl(const NotificationDelegateImpl&) = delete;
NotificationDelegateImpl& operator=(const NotificationDelegateImpl&) = delete;
void NotificationDestroyed() override { delete this; }
void NotificationClick() override {
@ -65,8 +69,6 @@ class NotificationDelegateImpl final : public electron::NotificationDelegate {
private:
std::string notification_id_;
DISALLOW_COPY_AND_ASSIGN(NotificationDelegateImpl);
};
} // namespace

View file

@ -19,6 +19,11 @@ class PlatformNotificationService
explicit PlatformNotificationService(ElectronBrowserClient* browser_client);
~PlatformNotificationService() override;
// disable copy
PlatformNotificationService(const PlatformNotificationService&) = delete;
PlatformNotificationService& operator=(const PlatformNotificationService&) =
delete;
protected:
// content::PlatformNotificationService:
void DisplayNotification(
@ -46,8 +51,6 @@ class PlatformNotificationService
private:
ElectronBrowserClient* browser_client_;
DISALLOW_COPY_AND_ASSIGN(PlatformNotificationService);
};
} // namespace electron

View file

@ -45,8 +45,6 @@ class NotificationPresenterWin : public NotificationPresenter {
NotificationDelegate* delegate) override;
base::ScopedTempDir temp_dir_;
DISALLOW_COPY_AND_ASSIGN(NotificationPresenterWin);
};
} // namespace electron

View file

@ -30,8 +30,6 @@ class NotificationPresenterWin7 : public NotificationPresenter,
void OnNotificationClicked(const Notification& notification) override;
void OnNotificationDismissed(const Notification& notification) override;
DISALLOW_COPY_AND_ASSIGN(NotificationPresenterWin7);
};
} // namespace electron

View file

@ -29,8 +29,6 @@ class Win32Notification : public electron::Notification {
private:
DesktopNotificationController::Notification notification_ref_;
std::string tag_;
DISALLOW_COPY_AND_ASSIGN(Win32Notification);
};
} // namespace electron

View file

@ -106,8 +106,6 @@ class WindowsToastNotification : public Notification {
ComPtr<ToastEventHandler> event_handler_;
ComPtr<ABI::Windows::UI::Notifications::IToastNotification>
toast_notification_;
DISALLOW_COPY_AND_ASSIGN(WindowsToastNotification);
};
class ToastEventHandler : public RuntimeClass<RuntimeClassFlags<ClassicCom>,
@ -118,6 +116,10 @@ class ToastEventHandler : public RuntimeClass<RuntimeClassFlags<ClassicCom>,
explicit ToastEventHandler(Notification* notification);
~ToastEventHandler() override;
// disable copy
ToastEventHandler(const ToastEventHandler&) = delete;
ToastEventHandler& operator=(const ToastEventHandler&) = delete;
IFACEMETHODIMP Invoke(
ABI::Windows::UI::Notifications::IToastNotification* sender,
IInspectable* args) override;
@ -130,8 +132,6 @@ class ToastEventHandler : public RuntimeClass<RuntimeClassFlags<ClassicCom>,
private:
base::WeakPtr<Notification> notification_; // weak ref.
DISALLOW_COPY_AND_ASSIGN(ToastEventHandler);
};
} // namespace electron