Commit dd3e9b01 authored by Lei Zhang's avatar Lei Zhang Committed by Commit Bot

Replace DISALLOW_COPY_AND_ASSIGN macros in printing/.

Remove deprecated macro usage and use explicit deletions instead. Also
remove some unnecessary includes for base/macros.h.

Bug: 1010217
Change-Id: I8d1e4d03e93933262f184b7802de4ef1b94ab1e0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2363630Reviewed-by: default avatarDaniel Hosseinian <dhoss@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Cr-Commit-Position: refs/heads/master@{#799850}
parent 3ed7a262
......@@ -33,6 +33,8 @@ constexpr int kCompletedJobsLimit = 3;
class DestinationEnumerator {
public:
DestinationEnumerator() {}
DestinationEnumerator(const DestinationEnumerator&) = delete;
DestinationEnumerator& operator=(const DestinationEnumerator&) = delete;
static int cups_callback(void* user_data, unsigned flags, cups_dest_t* dest) {
cups_dest_t* copied_dest;
......@@ -51,8 +53,6 @@ class DestinationEnumerator {
private:
std::vector<ScopedDestination> dests_;
DISALLOW_COPY_AND_ASSIGN(DestinationEnumerator);
};
} // namespace
......
......@@ -11,7 +11,6 @@
#include <string>
#include <vector>
#include "base/macros.h"
#include "base/memory/weak_ptr.h"
#include "printing/backend/cups_deleters.h"
#include "printing/backend/cups_jobs.h"
......@@ -38,9 +37,9 @@ class PRINTING_EXPORT CupsConnection {
CupsConnection(const GURL& print_server_url,
http_encryption_t encryption,
bool blocking);
CupsConnection(CupsConnection&& connection);
CupsConnection(const CupsConnection&) = delete;
CupsConnection& operator=(const CupsConnection&) = delete;
~CupsConnection();
// Returns a vector of all the printers configure on the CUPS server.
......@@ -74,8 +73,6 @@ class PRINTING_EXPORT CupsConnection {
bool blocking_;
ScopedHttpPtr cups_http_;
DISALLOW_COPY_AND_ASSIGN(CupsConnection);
};
} // namespace printing
......
......@@ -62,9 +62,9 @@ class PRINTING_EXPORT CupsPrinter : public CupsOptionProvider {
// Create a printer with a connection defined by |http| and |dest|.
CupsPrinter(http_t* http, ScopedDestination dest);
CupsPrinter(CupsPrinter&& printer);
CupsPrinter(const CupsPrinter&) = delete;
CupsPrinter& operator=(const CupsPrinter&) = delete;
~CupsPrinter() override;
// Returns true if this is the default printer
......@@ -153,8 +153,6 @@ class PRINTING_EXPORT CupsPrinter : public CupsOptionProvider {
// opaque object containing printer attributes and options
mutable ScopedDestInfo dest_info_;
DISALLOW_COPY_AND_ASSIGN(CupsPrinter);
};
} // namespace printing
......
......@@ -8,7 +8,6 @@
#include "printing/backend/print_backend.h"
#include "base/macros.h"
#include "base/values.h"
namespace printing {
......@@ -17,6 +16,8 @@ class DummyPrintBackend : public PrintBackend {
public:
explicit DummyPrintBackend(const std::string& locale)
: PrintBackend(locale) {}
DummyPrintBackend(const DummyPrintBackend&) = delete;
DummyPrintBackend& operator=(const DummyPrintBackend&) = delete;
bool EnumeratePrinters(PrinterList* printer_list) override { return false; }
......@@ -49,8 +50,6 @@ class DummyPrintBackend : public PrintBackend {
private:
~DummyPrintBackend() override = default;
DISALLOW_COPY_AND_ASSIGN(DummyPrintBackend);
};
// static
......
......@@ -117,14 +117,14 @@ class PRINTING_EXPORT XPSModule {
class PRINTING_EXPORT ScopedXPSInitializer {
public:
ScopedXPSInitializer();
ScopedXPSInitializer(const ScopedXPSInitializer&) = delete;
ScopedXPSInitializer& operator=(const ScopedXPSInitializer&) = delete;
~ScopedXPSInitializer();
bool initialized() const { return initialized_; }
private:
bool initialized_;
DISALLOW_COPY_AND_ASSIGN(ScopedXPSInitializer);
};
// Wrapper class to wrap the XPS Print APIs (these are different from the PTxxx
......
......@@ -12,7 +12,6 @@
#include "base/check_op.h"
#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/macros.h"
#include "base/notreached.h"
#include "base/numerics/safe_conversions.h"
#include "skia/ext/skia_utils_win.h"
......
......@@ -14,7 +14,6 @@
#include "base/compiler_specific.h"
#include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "printing/metafile.h"
namespace base {
......@@ -38,6 +37,8 @@ class PRINTING_EXPORT Emf : public Metafile {
// Generates a virtual HDC that will record every GDI commands and compile
// it in a EMF data stream.
Emf();
Emf(const Emf&) = delete;
Emf& operator=(const Emf&) = delete;
~Emf() override;
// Closes metafile.
......@@ -95,8 +96,6 @@ class PRINTING_EXPORT Emf : public Metafile {
// Valid when generating EMF data through a virtual HDC.
HDC hdc_;
DISALLOW_COPY_AND_ASSIGN(Emf);
};
struct Emf::EnumerationContext {
......@@ -144,7 +143,8 @@ class PRINTING_EXPORT Emf::Enumerator {
// both optional at the same time or must both be valid.
// Warning: |emf| must be kept valid for the time this object is alive.
Enumerator(const Emf& emf, HDC hdc, const RECT* rect);
Enumerator(const Enumerator&) = delete;
Enumerator& operator=(const Enumerator&) = delete;
~Enumerator();
// Retrieves the first Record.
......@@ -170,7 +170,6 @@ class PRINTING_EXPORT Emf::Enumerator {
EnumerationContext context_;
DISALLOW_COPY_AND_ASSIGN(Enumerator);
};
} // namespace printing
......
......@@ -7,7 +7,6 @@
#include <stddef.h>
#include <stdint.h>
#include "base/macros.h"
#include "base/win/scoped_gdi_object.h"
#include "base/win/scoped_hdc.h"
#include "base/win/scoped_select_object.h"
......
......@@ -10,7 +10,6 @@
#include <vector>
#include "base/containers/span.h"
#include "base/macros.h"
#include "build/build_config.h"
#include "printing/mojom/print.mojom-forward.h"
#include "printing/native_drawing_context.h"
......@@ -39,6 +38,8 @@ namespace printing {
class PRINTING_EXPORT MetafilePlayer {
public:
MetafilePlayer();
MetafilePlayer(const MetafilePlayer&) = delete;
MetafilePlayer& operator=(const MetafilePlayer&) = delete;
virtual ~MetafilePlayer();
#if defined(OS_WIN)
......@@ -76,9 +77,6 @@ class PRINTING_EXPORT MetafilePlayer {
// called after the metafile is closed. Returns true if writing succeeded.
virtual bool SaveTo(base::File* file) const = 0;
#endif // defined(OS_ANDROID)
private:
DISALLOW_COPY_AND_ASSIGN(MetafilePlayer);
};
// This class creates a graphics context that renders into a data stream
......@@ -86,6 +84,8 @@ class PRINTING_EXPORT MetafilePlayer {
class PRINTING_EXPORT Metafile : public MetafilePlayer {
public:
Metafile();
Metafile(const Metafile&) = delete;
Metafile& operator=(const Metafile&) = delete;
~Metafile() override;
// Initializes a fresh new metafile for rendering. Returns false on failure.
......@@ -146,9 +146,6 @@ class PRINTING_EXPORT Metafile : public MetafilePlayer {
#if !defined(OS_ANDROID)
bool SaveTo(base::File* file) const override;
#endif // !defined(OS_ANDROID)
private:
DISALLOW_COPY_AND_ASSIGN(Metafile);
};
} // namespace printing
......
......@@ -10,7 +10,6 @@
#include <memory>
#include "base/gtest_prod_util.h"
#include "base/macros.h"
#include "build/build_config.h"
#include "cc/paint/paint_canvas.h"
#include "printing/common/metafile_utils.h"
......@@ -39,6 +38,8 @@ class PRINTING_EXPORT MetafileSkia : public Metafile {
// comments before InitFromData()'s implementation.
MetafileSkia();
MetafileSkia(mojom::SkiaDocumentType type, int document_cookie);
MetafileSkia(const MetafileSkia&) = delete;
MetafileSkia& operator=(const MetafileSkia&) = delete;
~MetafileSkia() override;
// Metafile methods.
......@@ -135,8 +136,6 @@ class PRINTING_EXPORT MetafileSkia : public Metafile {
std::unique_ptr<MetafileSkiaData> data_;
ui::AXTreeUpdate accessibility_tree_;
DISALLOW_COPY_AND_ASSIGN(MetafileSkia);
};
} // namespace printing
......
......@@ -8,7 +8,6 @@
#include <algorithm>
#include <string>
#include "base/macros.h"
#include "base/optional.h"
#include "base/strings/string16.h"
#include "build/build_config.h"
......@@ -79,6 +78,8 @@ class PRINTING_EXPORT PrintSettings {
#endif // defined(OS_LINUX) || defined(OS_CHROMEOS)
PrintSettings();
PrintSettings(const PrintSettings&) = delete;
PrintSettings& operator=(const PrintSettings&) = delete;
~PrintSettings();
// Reinitialize the settings to the default values.
......@@ -327,8 +328,6 @@ class PRINTING_EXPORT PrintSettings {
// PIN code entered by the user.
std::string pin_value_;
#endif
DISALLOW_COPY_AND_ASSIGN(PrintSettings);
};
} // namespace printing
......
......@@ -9,7 +9,6 @@
#include <memory>
#include "base/files/file_path.h"
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/strings/string16.h"
#include "base/synchronization/lock.h"
......@@ -41,6 +40,8 @@ class PRINTING_EXPORT PrintedDocument
PrintedDocument(std::unique_ptr<PrintSettings> settings,
const base::string16& name,
int cookie);
PrintedDocument(const PrintedDocument&) = delete;
PrintedDocument& operator=(const PrintedDocument&) = delete;
#if defined(OS_WIN)
// Indicates that the PDF has been generated and the document is waiting for
......@@ -206,8 +207,6 @@ class PRINTING_EXPORT PrintedDocument
// All the immutable members.
const Immutable immutable_;
DISALLOW_COPY_AND_ASSIGN(PrintedDocument);
};
} // namespace printing
......
......@@ -7,7 +7,6 @@
#include <memory>
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "printing/metafile.h"
#include "ui/gfx/geometry/rect.h"
......@@ -28,6 +27,8 @@ class PRINTING_EXPORT PrintedPage
std::unique_ptr<MetafilePlayer> metafile,
const gfx::Size& page_size,
const gfx::Rect& page_content_rect);
PrintedPage(const PrintedPage&) = delete;
PrintedPage& operator=(const PrintedPage&) = delete;
// Getters
int page_number() const { return page_number_; }
......@@ -59,8 +60,6 @@ class PRINTING_EXPORT PrintedPage
// The printable area of the page.
const gfx::Rect page_content_rect_;
DISALLOW_COPY_AND_ASSIGN(PrintedPage);
};
} // namespace printing
......
......@@ -9,7 +9,6 @@
#include <string>
#include "base/callback.h"
#include "base/macros.h"
#include "base/strings/string16.h"
#include "base/values.h"
#include "build/build_config.h"
......@@ -46,6 +45,8 @@ class PRINTING_EXPORT PrintingContext {
FAILED,
};
PrintingContext(const PrintingContext&) = delete;
PrintingContext& operator=(const PrintingContext&) = delete;
virtual ~PrintingContext();
// Callback of AskUserForSettings, used to notify the PrintJobWorker when
......@@ -155,9 +156,6 @@ class PRINTING_EXPORT PrintingContext {
// The job id for the current job. The value is 0 if no jobs are active.
int job_id_;
private:
DISALLOW_COPY_AND_ASSIGN(PrintingContext);
};
} // namespace printing
......
......@@ -9,7 +9,6 @@
#include "base/android/scoped_java_ref.h"
#include "base/file_descriptor_posix.h"
#include "base/macros.h"
#include "printing/printing_context.h"
namespace ui {
......@@ -25,6 +24,8 @@ class MetafilePlayer;
class PRINTING_EXPORT PrintingContextAndroid : public PrintingContext {
public:
explicit PrintingContextAndroid(Delegate* delegate);
PrintingContextAndroid(const PrintingContextAndroid&) = delete;
PrintingContextAndroid& operator=(const PrintingContextAndroid&) = delete;
~PrintingContextAndroid() override;
// Called when the page is successfully written to a PDF using the file
......@@ -80,8 +81,6 @@ class PRINTING_EXPORT PrintingContextAndroid : public PrintingContext {
PrintSettingsCallback callback_;
int fd_ = base::kInvalidFd;
DISALLOW_COPY_AND_ASSIGN(PrintingContextAndroid);
};
} // namespace printing
......
......@@ -9,7 +9,6 @@
#include <string>
#include <vector>
#include "base/macros.h"
#include "base/optional.h"
#include "printing/backend/cups_connection.h"
#include "printing/backend/cups_deleters.h"
......@@ -21,6 +20,8 @@ namespace printing {
class PRINTING_EXPORT PrintingContextChromeos : public PrintingContext {
public:
explicit PrintingContextChromeos(Delegate* delegate);
PrintingContextChromeos(const PrintingContextChromeos&) = delete;
PrintingContextChromeos& operator=(const PrintingContextChromeos&) = delete;
~PrintingContextChromeos() override;
// PrintingContext implementation.
......@@ -52,8 +53,6 @@ class PRINTING_EXPORT PrintingContextChromeos : public PrintingContext {
std::vector<ScopedCupsOption> cups_options_;
bool send_user_info_;
std::string username_;
DISALLOW_COPY_AND_ASSIGN(PrintingContextChromeos);
};
} // namespace printing
......
......@@ -8,7 +8,6 @@
#include <memory>
#include <string>
#include "base/macros.h"
#include "printing/printing_context.h"
namespace printing {
......@@ -20,6 +19,8 @@ class PrintDialogGtkInterface;
class PRINTING_EXPORT PrintingContextLinux : public PrintingContext {
public:
explicit PrintingContextLinux(Delegate* delegate);
PrintingContextLinux(const PrintingContextLinux&) = delete;
PrintingContextLinux& operator=(const PrintingContextLinux&) = delete;
~PrintingContextLinux() override;
// Sets the function that creates the print dialog.
......@@ -57,8 +58,6 @@ class PRINTING_EXPORT PrintingContextLinux : public PrintingContext {
private:
base::string16 document_name_;
PrintDialogGtkInterface* print_dialog_;
DISALLOW_COPY_AND_ASSIGN(PrintingContextLinux);
};
} // namespace printing
......
......@@ -9,7 +9,6 @@
#include <string>
#include "base/mac/scoped_nsobject.h"
#include "base/macros.h"
#include "printing/mojom/print.mojom.h"
#include "printing/print_job_constants.h"
#include "printing/printing_context.h"
......@@ -21,6 +20,8 @@ namespace printing {
class PRINTING_EXPORT PrintingContextMac : public PrintingContext {
public:
explicit PrintingContextMac(Delegate* delegate);
PrintingContextMac(const PrintingContextMac&) = delete;
PrintingContextMac& operator=(const PrintingContextMac&) = delete;
~PrintingContextMac() override;
// PrintingContext implementation.
......@@ -95,8 +96,6 @@ class PRINTING_EXPORT PrintingContextMac : public PrintingContext {
// The current page's context; only valid between NewPage and PageDone call
// pairs.
CGContext* context_;
DISALLOW_COPY_AND_ASSIGN(PrintingContextMac);
};
} // namespace printing
......
......@@ -7,7 +7,6 @@
#include <string>
#include "base/macros.h"
#include "printing/printing_context.h"
namespace printing {
......@@ -15,6 +14,9 @@ namespace printing {
class PRINTING_EXPORT PrintingContextNoSystemDialog : public PrintingContext {
public:
explicit PrintingContextNoSystemDialog(Delegate* delegate);
PrintingContextNoSystemDialog(const PrintingContextNoSystemDialog&) = delete;
PrintingContextNoSystemDialog& operator=(
const PrintingContextNoSystemDialog&) = delete;
~PrintingContextNoSystemDialog() override;
// PrintingContext implementation.
......@@ -34,9 +36,6 @@ class PRINTING_EXPORT PrintingContextNoSystemDialog : public PrintingContext {
void Cancel() override;
void ReleaseContext() override;
printing::NativeDrawingContext context() const override;
private:
DISALLOW_COPY_AND_ASSIGN(PrintingContextNoSystemDialog);
};
} // namespace printing
......
......@@ -11,7 +11,6 @@
#include <string>
#include "base/macros.h"
#include "printing/printing_context_win.h"
#include "ui/gfx/native_widget_types.h"
......@@ -21,6 +20,10 @@ class PRINTING_EXPORT PrintingContextSystemDialogWin
: public PrintingContextWin {
public:
explicit PrintingContextSystemDialogWin(Delegate* delegate);
PrintingContextSystemDialogWin(const PrintingContextSystemDialogWin&) =
delete;
PrintingContextSystemDialogWin& operator=(
const PrintingContextSystemDialogWin&) = delete;
~PrintingContextSystemDialogWin() override;
// PrintingContext implementation.
......@@ -44,8 +47,6 @@ class PRINTING_EXPORT PrintingContextSystemDialogWin
// Parses the result of a PRINTDLGEX result.
Result ParseDialogResultEx(const PRINTDLGEX& dialog_options);
DISALLOW_COPY_AND_ASSIGN(PrintingContextSystemDialogWin);
};
} // namespace printing
......
......@@ -8,7 +8,6 @@
#include <memory>
#include <string>
#include "base/macros.h"
#include "printing/printing_context.h"
#include "ui/gfx/native_widget_types.h"
......@@ -20,6 +19,8 @@ class PrintSettings;
class PRINTING_EXPORT PrintingContextWin : public PrintingContext {
public:
explicit PrintingContextWin(Delegate* delegate);
PrintingContextWin(const PrintingContextWin&) = delete;
PrintingContextWin& operator=(const PrintingContextWin&) = delete;
~PrintingContextWin() override;
// Prints the document contained in |metafile|.
......@@ -63,8 +64,6 @@ class PRINTING_EXPORT PrintingContextWin : public PrintingContext {
// The selected printer context.
HDC context_;
DISALLOW_COPY_AND_ASSIGN(PrintingContextWin);
};
} // namespace printing
......
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