Remove more |new|s, part 8

Change-Id: I0e3f4bd33e66fd48db8371a5cc2f8db964720d08
Reviewed-on: https://pdfium-review.googlesource.com/4731
Reviewed-by: dsinclair <dsinclair@chromium.org>
Commit-Queue: dsinclair <dsinclair@chromium.org>
diff --git a/fxbarcode/cbc_codabar.cpp b/fxbarcode/cbc_codabar.cpp
index 1d671ce..d150121 100644
--- a/fxbarcode/cbc_codabar.cpp
+++ b/fxbarcode/cbc_codabar.cpp
@@ -24,8 +24,10 @@
 #include <memory>
 
 #include "fxbarcode/oned/BC_OnedCodaBarWriter.h"
+#include "third_party/base/ptr_util.h"
 
-CBC_Codabar::CBC_Codabar() : CBC_OneCode(new CBC_OnedCodaBarWriter) {}
+CBC_Codabar::CBC_Codabar()
+    : CBC_OneCode(pdfium::MakeUnique<CBC_OnedCodaBarWriter>()) {}
 
 CBC_Codabar::~CBC_Codabar() {}
 
diff --git a/fxbarcode/cbc_code128.cpp b/fxbarcode/cbc_code128.cpp
index 822aba0..93a4ae8 100644
--- a/fxbarcode/cbc_code128.cpp
+++ b/fxbarcode/cbc_code128.cpp
@@ -24,9 +24,10 @@
 #include <memory>
 
 #include "fxbarcode/oned/BC_OnedCode128Writer.h"
+#include "third_party/base/ptr_util.h"
 
 CBC_Code128::CBC_Code128(BC_TYPE type)
-    : CBC_OneCode(new CBC_OnedCode128Writer(type)) {}
+    : CBC_OneCode(pdfium::MakeUnique<CBC_OnedCode128Writer>(type)) {}
 
 CBC_Code128::~CBC_Code128() {}
 
diff --git a/fxbarcode/cbc_code39.cpp b/fxbarcode/cbc_code39.cpp
index 8b7e08b..97debaa 100644
--- a/fxbarcode/cbc_code39.cpp
+++ b/fxbarcode/cbc_code39.cpp
@@ -24,8 +24,10 @@
 #include <memory>
 
 #include "fxbarcode/oned/BC_OnedCode39Writer.h"
+#include "third_party/base/ptr_util.h"
 
-CBC_Code39::CBC_Code39() : CBC_OneCode(new CBC_OnedCode39Writer) {}
+CBC_Code39::CBC_Code39()
+    : CBC_OneCode(pdfium::MakeUnique<CBC_OnedCode39Writer>()) {}
 
 CBC_Code39::~CBC_Code39() {}
 
diff --git a/fxbarcode/cbc_codebase.cpp b/fxbarcode/cbc_codebase.cpp
index f283473..2278f93 100644
--- a/fxbarcode/cbc_codebase.cpp
+++ b/fxbarcode/cbc_codebase.cpp
@@ -21,9 +21,12 @@
 
 #include "fxbarcode/cbc_codebase.h"
 
+#include <utility>
+
 #include "fxbarcode/BC_Writer.h"
 
-CBC_CodeBase::CBC_CodeBase(CBC_Writer* pWriter) : m_pBCWriter(pWriter) {}
+CBC_CodeBase::CBC_CodeBase(std::unique_ptr<CBC_Writer> pWriter)
+    : m_pBCWriter(std::move(pWriter)) {}
 
 CBC_CodeBase::~CBC_CodeBase() {}
 
diff --git a/fxbarcode/cbc_codebase.h b/fxbarcode/cbc_codebase.h
index 3c6b051..7b83fd7 100644
--- a/fxbarcode/cbc_codebase.h
+++ b/fxbarcode/cbc_codebase.h
@@ -21,7 +21,7 @@
 
 class CBC_CodeBase {
  public:
-  explicit CBC_CodeBase(CBC_Writer* pWriter);
+  explicit CBC_CodeBase(std::unique_ptr<CBC_Writer> pWriter);
   virtual ~CBC_CodeBase();
 
   virtual BC_TYPE GetType() = 0;
diff --git a/fxbarcode/cbc_datamatrix.cpp b/fxbarcode/cbc_datamatrix.cpp
index 60b1f72..f1c98ce 100644
--- a/fxbarcode/cbc_datamatrix.cpp
+++ b/fxbarcode/cbc_datamatrix.cpp
@@ -24,8 +24,10 @@
 #include <memory>
 
 #include "fxbarcode/datamatrix/BC_DataMatrixWriter.h"
+#include "third_party/base/ptr_util.h"
 
-CBC_DataMatrix::CBC_DataMatrix() : CBC_CodeBase(new CBC_DataMatrixWriter) {}
+CBC_DataMatrix::CBC_DataMatrix()
+    : CBC_CodeBase(pdfium::MakeUnique<CBC_DataMatrixWriter>()) {}
 
 CBC_DataMatrix::~CBC_DataMatrix() {}
 
diff --git a/fxbarcode/cbc_ean13.cpp b/fxbarcode/cbc_ean13.cpp
index 73638b9..1c57a87 100644
--- a/fxbarcode/cbc_ean13.cpp
+++ b/fxbarcode/cbc_ean13.cpp
@@ -24,8 +24,10 @@
 #include <memory>
 
 #include "fxbarcode/oned/BC_OnedEAN13Writer.h"
+#include "third_party/base/ptr_util.h"
 
-CBC_EAN13::CBC_EAN13() : CBC_OneCode(new CBC_OnedEAN13Writer) {}
+CBC_EAN13::CBC_EAN13()
+    : CBC_OneCode(pdfium::MakeUnique<CBC_OnedEAN13Writer>()) {}
 
 CBC_EAN13::~CBC_EAN13() {}
 
diff --git a/fxbarcode/cbc_ean8.cpp b/fxbarcode/cbc_ean8.cpp
index e5c26e6..3b4369e 100644
--- a/fxbarcode/cbc_ean8.cpp
+++ b/fxbarcode/cbc_ean8.cpp
@@ -24,8 +24,9 @@
 #include <memory>
 
 #include "fxbarcode/oned/BC_OnedEAN8Writer.h"
+#include "third_party/base/ptr_util.h"
 
-CBC_EAN8::CBC_EAN8() : CBC_OneCode(new CBC_OnedEAN8Writer) {}
+CBC_EAN8::CBC_EAN8() : CBC_OneCode(pdfium::MakeUnique<CBC_OnedEAN8Writer>()) {}
 
 CBC_EAN8::~CBC_EAN8() {}
 
diff --git a/fxbarcode/cbc_onecode.cpp b/fxbarcode/cbc_onecode.cpp
index ec7033a..2d64704 100644
--- a/fxbarcode/cbc_onecode.cpp
+++ b/fxbarcode/cbc_onecode.cpp
@@ -21,9 +21,12 @@
 
 #include "fxbarcode/cbc_onecode.h"
 
+#include <utility>
+
 #include "fxbarcode/oned/BC_OneDimWriter.h"
 
-CBC_OneCode::CBC_OneCode(CBC_Writer* pWriter) : CBC_CodeBase(pWriter) {}
+CBC_OneCode::CBC_OneCode(std::unique_ptr<CBC_Writer> pWriter)
+    : CBC_CodeBase(std::move(pWriter)) {}
 
 CBC_OneCode::~CBC_OneCode() {}
 
diff --git a/fxbarcode/cbc_onecode.h b/fxbarcode/cbc_onecode.h
index 08abe66..e6b5b7b 100644
--- a/fxbarcode/cbc_onecode.h
+++ b/fxbarcode/cbc_onecode.h
@@ -7,6 +7,8 @@
 #ifndef FXBARCODE_CBC_ONECODE_H_
 #define FXBARCODE_CBC_ONECODE_H_
 
+#include <memory>
+
 #include "core/fxcrt/fx_string.h"
 #include "core/fxcrt/fx_system.h"
 #include "fxbarcode/cbc_codebase.h"
@@ -16,7 +18,7 @@
 
 class CBC_OneCode : public CBC_CodeBase {
  public:
-  explicit CBC_OneCode(CBC_Writer* pWriter);
+  explicit CBC_OneCode(std::unique_ptr<CBC_Writer> pWriter);
   ~CBC_OneCode() override;
 
   virtual bool CheckContentValidity(const CFX_WideStringC& contents);
diff --git a/fxbarcode/cbc_pdf417i.cpp b/fxbarcode/cbc_pdf417i.cpp
index 51a3643..23ad3ef 100644
--- a/fxbarcode/cbc_pdf417i.cpp
+++ b/fxbarcode/cbc_pdf417i.cpp
@@ -24,8 +24,10 @@
 #include <memory>
 
 #include "fxbarcode/pdf417/BC_PDF417Writer.h"
+#include "third_party/base/ptr_util.h"
 
-CBC_PDF417I::CBC_PDF417I() : CBC_CodeBase(new CBC_PDF417Writer) {}
+CBC_PDF417I::CBC_PDF417I()
+    : CBC_CodeBase(pdfium::MakeUnique<CBC_PDF417Writer>()) {}
 
 CBC_PDF417I::~CBC_PDF417I() {}
 
diff --git a/fxbarcode/cbc_qrcode.cpp b/fxbarcode/cbc_qrcode.cpp
index 5bdc976..6565623 100644
--- a/fxbarcode/cbc_qrcode.cpp
+++ b/fxbarcode/cbc_qrcode.cpp
@@ -24,8 +24,10 @@
 #include <memory>
 
 #include "fxbarcode/qrcode/BC_QRCodeWriter.h"
+#include "third_party/base/ptr_util.h"
 
-CBC_QRCode::CBC_QRCode() : CBC_CodeBase(new CBC_QRCodeWriter) {}
+CBC_QRCode::CBC_QRCode()
+    : CBC_CodeBase(pdfium::MakeUnique<CBC_QRCodeWriter>()) {}
 
 CBC_QRCode::~CBC_QRCode() {}
 
diff --git a/fxbarcode/cbc_upca.cpp b/fxbarcode/cbc_upca.cpp
index da22469..6c2e08a 100644
--- a/fxbarcode/cbc_upca.cpp
+++ b/fxbarcode/cbc_upca.cpp
@@ -24,8 +24,9 @@
 #include <memory>
 
 #include "fxbarcode/oned/BC_OnedUPCAWriter.h"
+#include "third_party/base/ptr_util.h"
 
-CBC_UPCA::CBC_UPCA() : CBC_OneCode(new CBC_OnedUPCAWriter) {}
+CBC_UPCA::CBC_UPCA() : CBC_OneCode(pdfium::MakeUnique<CBC_OnedUPCAWriter>()) {}
 
 CBC_UPCA::~CBC_UPCA() {}