Rename CCodec_BmpModule to fxcodec::BmpModule.

Do IWYU along the way.

BUG=pdfium:1311

Change-Id: I4735d7f707bf11866a35f024e27559efb018f1f9
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/55810
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxcodec/BUILD.gn b/core/fxcodec/BUILD.gn
index 8ccc29d..6cc8bd1 100644
--- a/core/fxcodec/BUILD.gn
+++ b/core/fxcodec/BUILD.gn
@@ -93,8 +93,8 @@
         "bmp/cfx_bmpdecompressor.h",
         "bmp/fx_bmp.cpp",
         "bmp/fx_bmp.h",
-        "codec/ccodec_bmpmodule.cpp",
-        "codec/ccodec_bmpmodule.h",
+        "codec/bmpmodule.cpp",
+        "codec/bmpmodule.h",
       ]
     }
     if (pdf_enable_xfa_gif) {
diff --git a/core/fxcodec/bmp/cfx_bmpcontext.cpp b/core/fxcodec/bmp/cfx_bmpcontext.cpp
index 87f5083..d90bfc3 100644
--- a/core/fxcodec/bmp/cfx_bmpcontext.cpp
+++ b/core/fxcodec/bmp/cfx_bmpcontext.cpp
@@ -6,8 +6,8 @@
 
 #include "core/fxcodec/bmp/cfx_bmpcontext.h"
 
-CFX_BmpContext::CFX_BmpContext(CCodec_BmpModule* pModule,
-                               CCodec_BmpModule::Delegate* pDelegate)
+CFX_BmpContext::CFX_BmpContext(BmpModule* pModule,
+                               BmpModule::Delegate* pDelegate)
     : m_pModule(pModule), m_pDelegate(pDelegate) {}
 
 CFX_BmpContext::~CFX_BmpContext() {}
diff --git a/core/fxcodec/bmp/cfx_bmpcontext.h b/core/fxcodec/bmp/cfx_bmpcontext.h
index 66e3f54..7aa20b3 100644
--- a/core/fxcodec/bmp/cfx_bmpcontext.h
+++ b/core/fxcodec/bmp/cfx_bmpcontext.h
@@ -9,17 +9,17 @@
 
 #include "core/fxcodec/bmp/cfx_bmpdecompressor.h"
 #include "core/fxcodec/bmp/fx_bmp.h"
+#include "core/fxcodec/codec/bmpmodule.h"
 #include "core/fxcrt/unowned_ptr.h"
 
 class CFX_BmpContext final : public CodecModuleIface::Context {
  public:
-  CFX_BmpContext(CCodec_BmpModule* pModule,
-                 CCodec_BmpModule::Delegate* pDelegate);
+  CFX_BmpContext(BmpModule* pModule, BmpModule::Delegate* pDelegate);
   ~CFX_BmpContext() override;
 
   CFX_BmpDecompressor m_Bmp;
-  UnownedPtr<CCodec_BmpModule> const m_pModule;
-  UnownedPtr<CCodec_BmpModule::Delegate> const m_pDelegate;
+  UnownedPtr<BmpModule> const m_pModule;
+  UnownedPtr<BmpModule::Delegate> const m_pDelegate;
 };
 
 #endif  // CORE_FXCODEC_BMP_CFX_BMPCONTEXT_H_
diff --git a/core/fxcodec/bmp/cfx_bmpdecompressor.h b/core/fxcodec/bmp/cfx_bmpdecompressor.h
index 0af4da4..c8c04a3 100644
--- a/core/fxcodec/bmp/cfx_bmpdecompressor.h
+++ b/core/fxcodec/bmp/cfx_bmpdecompressor.h
@@ -12,6 +12,7 @@
 #include <vector>
 
 #include "core/fxcodec/bmp/fx_bmp.h"
+#include "core/fxcrt/retain_ptr.h"
 
 class CFX_BmpContext;
 class CFX_CodecMemory;
diff --git a/core/fxcodec/bmp/fx_bmp.h b/core/fxcodec/bmp/fx_bmp.h
index d013577..82a695a 100644
--- a/core/fxcodec/bmp/fx_bmp.h
+++ b/core/fxcodec/bmp/fx_bmp.h
@@ -7,7 +7,7 @@
 #ifndef CORE_FXCODEC_BMP_FX_BMP_H_
 #define CORE_FXCODEC_BMP_FX_BMP_H_
 
-#include "core/fxcodec/codec/ccodec_bmpmodule.h"
+#include <stdint.h>
 
 #define BMP_WIDTHBYTES(width, bitCount) ((width * bitCount) + 31) / 32 * 4
 #define BMP_PAL_ENCODE(a, r, g, b) \
diff --git a/core/fxcodec/codec/ccodec_bmpmodule.cpp b/core/fxcodec/codec/bmpmodule.cpp
similarity index 61%
rename from core/fxcodec/codec/ccodec_bmpmodule.cpp
rename to core/fxcodec/codec/bmpmodule.cpp
index 56de936..47a3dc4 100644
--- a/core/fxcodec/codec/ccodec_bmpmodule.cpp
+++ b/core/fxcodec/codec/bmpmodule.cpp
@@ -4,7 +4,7 @@
 
 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
 
-#include "core/fxcodec/codec/ccodec_bmpmodule.h"
+#include "core/fxcodec/codec/bmpmodule.h"
 
 #include <utility>
 
@@ -15,25 +15,27 @@
 #include "core/fxge/fx_dib.h"
 #include "third_party/base/ptr_util.h"
 
-CCodec_BmpModule::CCodec_BmpModule() {}
+namespace fxcodec {
 
-CCodec_BmpModule::~CCodec_BmpModule() {}
+BmpModule::BmpModule() = default;
 
-std::unique_ptr<CodecModuleIface::Context> CCodec_BmpModule::Start(
+BmpModule::~BmpModule() = default;
+
+std::unique_ptr<CodecModuleIface::Context> BmpModule::Start(
     Delegate* pDelegate) {
   auto p = pdfium::MakeUnique<CFX_BmpContext>(this, pDelegate);
   p->m_Bmp.context_ptr_ = p.get();
   return p;
 }
 
-int32_t CCodec_BmpModule::ReadHeader(Context* pContext,
-                                     int32_t* width,
-                                     int32_t* height,
-                                     bool* tb_flag,
-                                     int32_t* components,
-                                     int32_t* pal_num,
-                                     std::vector<uint32_t>* palette,
-                                     CFX_DIBAttribute* pAttribute) {
+int32_t BmpModule::ReadHeader(Context* pContext,
+                              int32_t* width,
+                              int32_t* height,
+                              bool* tb_flag,
+                              int32_t* components,
+                              int32_t* pal_num,
+                              std::vector<uint32_t>* palette,
+                              CFX_DIBAttribute* pAttribute) {
   ASSERT(pAttribute);
 
   auto* ctx = static_cast<CFX_BmpContext*>(pContext);
@@ -56,7 +58,7 @@
   return 1;
 }
 
-int32_t CCodec_BmpModule::LoadImage(Context* pContext) {
+int32_t BmpModule::LoadImage(Context* pContext) {
   auto* ctx = static_cast<CFX_BmpContext*>(pContext);
   if (setjmp(ctx->m_Bmp.jmpbuf_))
     return 0;
@@ -64,14 +66,16 @@
   return ctx->m_Bmp.DecodeImage();
 }
 
-FX_FILESIZE CCodec_BmpModule::GetAvailInput(Context* pContext) const {
+FX_FILESIZE BmpModule::GetAvailInput(Context* pContext) const {
   return static_cast<CFX_BmpContext*>(pContext)->m_Bmp.GetAvailInput();
 }
 
-bool CCodec_BmpModule::Input(Context* pContext,
-                             RetainPtr<CFX_CodecMemory> codec_memory,
-                             CFX_DIBAttribute*) {
+bool BmpModule::Input(Context* pContext,
+                      RetainPtr<CFX_CodecMemory> codec_memory,
+                      CFX_DIBAttribute*) {
   auto* ctx = static_cast<CFX_BmpContext*>(pContext);
   ctx->m_Bmp.SetInputBuffer(std::move(codec_memory));
   return true;
 }
+
+}  // namespace fxcodec
diff --git a/core/fxcodec/codec/ccodec_bmpmodule.h b/core/fxcodec/codec/bmpmodule.h
similarity index 80%
rename from core/fxcodec/codec/ccodec_bmpmodule.h
rename to core/fxcodec/codec/bmpmodule.h
index 0948b06..70a1de9 100644
--- a/core/fxcodec/codec/ccodec_bmpmodule.h
+++ b/core/fxcodec/codec/bmpmodule.h
@@ -4,8 +4,8 @@
 
 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
 
-#ifndef CORE_FXCODEC_CODEC_CCODEC_BMPMODULE_H_
-#define CORE_FXCODEC_CODEC_CCODEC_BMPMODULE_H_
+#ifndef CORE_FXCODEC_CODEC_BMPMODULE_H_
+#define CORE_FXCODEC_CODEC_BMPMODULE_H_
 
 #include <memory>
 #include <vector>
@@ -14,7 +14,9 @@
 
 class CFX_DIBAttribute;
 
-class CCodec_BmpModule final : public CodecModuleIface {
+namespace fxcodec {
+
+class BmpModule final : public CodecModuleIface {
  public:
   class Delegate {
    public:
@@ -23,8 +25,8 @@
                                  const std::vector<uint8_t>& row_buf) = 0;
   };
 
-  CCodec_BmpModule();
-  ~CCodec_BmpModule() override;
+  BmpModule();
+  ~BmpModule() override;
 
   // CodecModuleIface:
   FX_FILESIZE GetAvailInput(Context* pContext) const override;
@@ -44,4 +46,8 @@
   int32_t LoadImage(Context* pContext);
 };
 
-#endif  // CORE_FXCODEC_CODEC_CCODEC_BMPMODULE_H_
+}  // namespace fxcodec
+
+using BmpModule = fxcodec::BmpModule;
+
+#endif  // CORE_FXCODEC_CODEC_BMPMODULE_H_
diff --git a/core/fxcodec/codec/ccodec_progressivedecoder.cpp b/core/fxcodec/codec/ccodec_progressivedecoder.cpp
index 2781d62..fc010cd 100644
--- a/core/fxcodec/codec/ccodec_progressivedecoder.cpp
+++ b/core/fxcodec/codec/ccodec_progressivedecoder.cpp
@@ -714,7 +714,7 @@
 
 bool CCodec_ProgressiveDecoder::BmpDetectImageTypeInBuffer(
     CFX_DIBAttribute* pAttribute) {
-  CCodec_BmpModule* pBmpModule = m_pCodecMgr->GetBmpModule();
+  BmpModule* pBmpModule = m_pCodecMgr->GetBmpModule();
   if (!pBmpModule) {
     m_status = FXCODEC_STATUS_ERR_MEMORY;
     return false;
@@ -793,7 +793,7 @@
 }
 
 bool CCodec_ProgressiveDecoder::BmpReadMoreData(
-    CCodec_BmpModule* pBmpModule,
+    BmpModule* pBmpModule,
     CodecModuleIface::Context* pContext,
     FXCODEC_STATUS& err_status) {
   return ReadMoreData(pBmpModule, pContext, false, err_status);
@@ -801,7 +801,7 @@
 
 FXCODEC_STATUS CCodec_ProgressiveDecoder::BmpStartDecode(
     const RetainPtr<CFX_DIBitmap>& pDIBitmap) {
-  CCodec_BmpModule* pBmpModule = m_pCodecMgr->GetBmpModule();
+  BmpModule* pBmpModule = m_pCodecMgr->GetBmpModule();
   if (!pBmpModule) {
     m_pDeviceBitmap = nullptr;
     m_pFile = nullptr;
@@ -819,7 +819,7 @@
 }
 
 FXCODEC_STATUS CCodec_ProgressiveDecoder::BmpContinueDecode() {
-  CCodec_BmpModule* pBmpModule = m_pCodecMgr->GetBmpModule();
+  BmpModule* pBmpModule = m_pCodecMgr->GetBmpModule();
   if (!pBmpModule) {
     m_status = FXCODEC_STATUS_ERR_MEMORY;
     return m_status;
diff --git a/core/fxcodec/codec/ccodec_progressivedecoder.h b/core/fxcodec/codec/ccodec_progressivedecoder.h
index 5430251..b4ec639 100644
--- a/core/fxcodec/codec/ccodec_progressivedecoder.h
+++ b/core/fxcodec/codec/ccodec_progressivedecoder.h
@@ -19,7 +19,7 @@
 #include "core/fxge/fx_dib.h"
 
 #ifdef PDF_ENABLE_XFA_BMP
-#include "core/fxcodec/codec/ccodec_bmpmodule.h"
+#include "core/fxcodec/codec/bmpmodule.h"
 #endif  // PDF_ENABLE_XFA_BMP
 
 #ifdef PDF_ENABLE_XFA_GIF
@@ -43,7 +43,7 @@
 
 class CCodec_ProgressiveDecoder :
 #ifdef PDF_ENABLE_XFA_BMP
-    public CCodec_BmpModule::Delegate,
+    public BmpModule::Delegate,
 #endif  // PDF_ENABLE_XFA_BMP
 #ifdef PDF_ENABLE_XFA_GIF
     public CCodec_GifModule::Delegate,
@@ -173,7 +173,7 @@
 #endif  // PDF_ENABLE_XFA_GIF
 
 #ifdef PDF_ENABLE_XFA_BMP
-  // CCodec_BmpModule::Delegate
+  // BmpModule::Delegate
   bool BmpInputImagePositionBuf(uint32_t rcd_pos) override;
   void BmpReadScanline(uint32_t row_num,
                        const std::vector<uint8_t>& row_buf) override;
@@ -181,7 +181,7 @@
 
  private:
 #ifdef PDF_ENABLE_XFA_BMP
-  bool BmpReadMoreData(CCodec_BmpModule* pBmpModule,
+  bool BmpReadMoreData(BmpModule* pBmpModule,
                        CodecModuleIface::Context* pBmpContext,
                        FXCODEC_STATUS& err_status);
   bool BmpDetectImageTypeInBuffer(CFX_DIBAttribute* pAttribute);
diff --git a/core/fxcodec/codec/fx_codec.cpp b/core/fxcodec/codec/fx_codec.cpp
index abb8017..192d87b 100644
--- a/core/fxcodec/codec/fx_codec.cpp
+++ b/core/fxcodec/codec/fx_codec.cpp
@@ -48,7 +48,7 @@
     : m_pJpegModule(pdfium::MakeUnique<CCodec_JpegModule>()),
       m_pJbig2Module(pdfium::MakeUnique<CCodec_Jbig2Module>()) {
 #ifdef PDF_ENABLE_XFA_BMP
-  SetBmpModule(pdfium::MakeUnique<CCodec_BmpModule>());
+  SetBmpModule(pdfium::MakeUnique<BmpModule>());
 #endif
 
 #ifdef PDF_ENABLE_XFA_GIF
diff --git a/core/fxcodec/fx_codec.h b/core/fxcodec/fx_codec.h
index 8d3bfdd..2a0ad6d 100644
--- a/core/fxcodec/fx_codec.h
+++ b/core/fxcodec/fx_codec.h
@@ -18,7 +18,7 @@
 
 #ifdef PDF_ENABLE_XFA
 #ifdef PDF_ENABLE_XFA_BMP
-#include "core/fxcodec/codec/ccodec_bmpmodule.h"
+#include "core/fxcodec/codec/bmpmodule.h"
 #endif  // PDF_ENABLE_XFA_BMP
 
 #ifdef PDF_ENABLE_XFA_GIF
@@ -66,8 +66,8 @@
   std::unique_ptr<CCodec_ProgressiveDecoder> CreateProgressiveDecoder();
 
 #ifdef PDF_ENABLE_XFA_BMP
-  CCodec_BmpModule* GetBmpModule() const { return m_pBmpModule.get(); }
-  void SetBmpModule(std::unique_ptr<CCodec_BmpModule> module) {
+  BmpModule* GetBmpModule() const { return m_pBmpModule.get(); }
+  void SetBmpModule(std::unique_ptr<BmpModule> module) {
     m_pBmpModule = std::move(module);
   }
 #endif  // PDF_ENABLE_XFA_BMP
@@ -103,7 +103,7 @@
 
 #ifdef PDF_ENABLE_XFA
 #ifdef PDF_ENABLE_XFA_BMP
-  std::unique_ptr<CCodec_BmpModule> m_pBmpModule;
+  std::unique_ptr<BmpModule> m_pBmpModule;
 #endif  // PDF_ENABLE_XFA_BMP
 
 #ifdef PDF_ENABLE_XFA_GIF