Cleanup fwl_* classes and cfx_* classes in fwl.

This CL cleans up the classes in the fwl_* and cfx_* files in fwl/core.

Review-Url: https://codereview.chromium.org/2503513002
diff --git a/xfa/fwl/core/cfx_barcode.cpp b/xfa/fwl/core/cfx_barcode.cpp
index 35a5f32..8d95179 100644
--- a/xfa/fwl/core/cfx_barcode.cpp
+++ b/xfa/fwl/core/cfx_barcode.cpp
@@ -78,24 +78,7 @@
 bool CFX_Barcode::SetWidth(int32_t width) {
   return m_pBCEngine ? m_pBCEngine->SetWidth(width) : false;
 }
-bool CFX_Barcode::CheckContentValidity(const CFX_WideStringC& contents) {
-  switch (GetType()) {
-    case BC_CODE39:
-    case BC_CODABAR:
-    case BC_CODE128:
-    case BC_CODE128_B:
-    case BC_CODE128_C:
-    case BC_EAN8:
-    case BC_EAN13:
-    case BC_UPCA:
-      return m_pBCEngine
-                 ? static_cast<CBC_OneCode*>(m_pBCEngine.get())
-                       ->CheckContentValidity(contents)
-                 : true;
-    default:
-      return true;
-  }
-}
+
 bool CFX_Barcode::SetPrintChecksum(bool checksum) {
   switch (GetType()) {
     case BC_CODE39:
@@ -185,24 +168,7 @@
       return false;
   }
 }
-bool CFX_Barcode::SetFontStyle(int32_t style) {
-  switch (GetType()) {
-    case BC_CODE39:
-    case BC_CODABAR:
-    case BC_CODE128:
-    case BC_CODE128_B:
-    case BC_CODE128_C:
-    case BC_EAN8:
-    case BC_EAN13:
-    case BC_UPCA:
-      return m_pBCEngine ? (static_cast<CBC_OneCode*>(m_pBCEngine.get())
-                                ->SetFontStyle(style),
-                            true)
-                         : false;
-    default:
-      return false;
-  }
-}
+
 bool CFX_Barcode::SetFontColor(FX_ARGB color) {
   switch (GetType()) {
     case BC_CODE39:
@@ -332,7 +298,3 @@
                                int32_t& e) {
   return m_pBCEngine && m_pBCEngine->RenderDevice(device, matrix, e);
 }
-
-bool CFX_Barcode::RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e) {
-  return m_pBCEngine && m_pBCEngine->RenderBitmap(pOutBitmap, e);
-}
diff --git a/xfa/fwl/core/cfx_barcode.h b/xfa/fwl/core/cfx_barcode.h
index 0a454e5..21fb745 100644
--- a/xfa/fwl/core/cfx_barcode.h
+++ b/xfa/fwl/core/cfx_barcode.h
@@ -28,24 +28,29 @@
   bool Create(BC_TYPE type);
   BC_TYPE GetType();
   bool Encode(const CFX_WideStringC& contents, bool isDevice, int32_t& e);
+
   bool RenderDevice(CFX_RenderDevice* device,
                     const CFX_Matrix* matrix,
                     int32_t& e);
-  bool RenderBitmap(CFX_DIBitmap*& pOutBitmap, int32_t& e);
+
   bool SetCharEncoding(BC_CHAR_ENCODING encoding);
+
   bool SetModuleHeight(int32_t moduleHeight);
   bool SetModuleWidth(int32_t moduleWidth);
+
   bool SetHeight(int32_t height);
   bool SetWidth(int32_t width);
-  bool CheckContentValidity(const CFX_WideStringC& contents);
+
   bool SetPrintChecksum(bool checksum);
   bool SetDataLength(int32_t length);
   bool SetCalChecksum(bool state);
+
   bool SetFont(CFX_Font* pFont);
   bool SetFontSize(FX_FLOAT size);
-  bool SetFontStyle(int32_t style);
   bool SetFontColor(FX_ARGB color);
+
   bool SetTextLocation(BC_TEXT_LOC location);
+
   bool SetWideNarrowRatio(int32_t ratio);
   bool SetStartChar(FX_CHAR start);
   bool SetEndChar(FX_CHAR end);
@@ -53,7 +58,7 @@
   bool SetErrorCorrectionLevel(int32_t level);
   bool SetTruncated(bool truncated);
 
- protected:
+ private:
   std::unique_ptr<CBC_CodeBase> m_pBCEngine;
 };
 
diff --git a/xfa/fwl/core/fwl_noteimp.cpp b/xfa/fwl/core/fwl_noteimp.cpp
index 70999d5..c17105a 100644
--- a/xfa/fwl/core/fwl_noteimp.cpp
+++ b/xfa/fwl/core/fwl_noteimp.cpp
@@ -7,71 +7,24 @@
 #include "xfa/fwl/core/fwl_noteimp.h"
 
 #include "core/fxcrt/fx_ext.h"
+#include "third_party/base/ptr_util.h"
 #include "third_party/base/stl_util.h"
 #include "xfa/fwl/core/cfwl_message.h"
 #include "xfa/fwl/core/cfwl_widgetmgr.h"
 #include "xfa/fwl/core/ifwl_app.h"
 #include "xfa/fwl/core/ifwl_tooltip.h"
 
-CFWL_NoteLoop::CFWL_NoteLoop(IFWL_Widget* pForm)
-    : m_pForm(pForm), m_bContinueModal(true) {}
+CFWL_NoteLoop::CFWL_NoteLoop() : m_bContinueModal(true) {}
 
-FWL_Error CFWL_NoteLoop::Idle(int32_t count) {
-#if (_FX_OS_ == _FX_WIN32_DESKTOP_)
-  if (count <= 0) {
-#endif
-    CFWL_EvtIdle ev;
-    const IFWL_App* pApp = m_pForm->GetOwnerApp();
-    if (!pApp)
-      return FWL_Error::Indefinite;
-
-    CFWL_NoteDriver* pDriver = pApp->GetNoteDriver();
-    if (!pDriver)
-      return FWL_Error::Indefinite;
-
-    pDriver->SendEvent(&ev);
-#if (_FX_OS_ == _FX_WIN32_DESKTOP_)
-  }
-#endif
-  return FWL_Error::Indefinite;
-}
-IFWL_Widget* CFWL_NoteLoop::GetForm() {
-  return m_pForm;
-}
-bool CFWL_NoteLoop::ContinueModal() {
-  return m_bContinueModal;
-}
-FWL_Error CFWL_NoteLoop::EndModalLoop() {
-  m_bContinueModal = false;
-  return FWL_Error::Succeeded;
-}
-
-FWL_Error CFWL_NoteLoop::SetMainForm(IFWL_Widget* pForm) {
-  m_pForm = pForm;
-  return FWL_Error::Succeeded;
-}
-void CFWL_NoteLoop::GenerateCommondEvent(uint32_t dwCommand) {
-  CFWL_EvtMenuCommand ev;
-  ev.m_iCommand = dwCommand;
-  const IFWL_App* pApp = m_pForm->GetOwnerApp();
-  if (!pApp)
-    return;
-
-  CFWL_NoteDriver* pDriver = pApp->GetNoteDriver();
-  if (!pDriver)
-    return;
-
-  pDriver->SendEvent(&ev);
-}
 CFWL_NoteDriver::CFWL_NoteDriver()
     : m_pHover(nullptr),
       m_pFocus(nullptr),
       m_pGrab(nullptr),
-      m_pNoteLoop(new CFWL_NoteLoop) {
+      m_pNoteLoop(pdfium::MakeUnique<CFWL_NoteLoop>()) {
   PushNoteLoop(m_pNoteLoop.get());
 }
 CFWL_NoteDriver::~CFWL_NoteDriver() {
-  ClearInvalidEventTargets(true);
+  ClearEventTargets(true);
 }
 
 void CFWL_NoteDriver::SendEvent(CFWL_Event* pNote) {
@@ -85,9 +38,9 @@
   }
 }
 
-FWL_Error CFWL_NoteDriver::RegisterEventTarget(IFWL_Widget* pListener,
-                                               IFWL_Widget* pEventSource,
-                                               uint32_t dwFilter) {
+void CFWL_NoteDriver::RegisterEventTarget(IFWL_Widget* pListener,
+                                          IFWL_Widget* pEventSource,
+                                          uint32_t dwFilter) {
   uint32_t key = pListener->GetEventKey();
   if (key == 0) {
     do {
@@ -96,32 +49,25 @@
     pListener->SetEventKey(key);
   }
   if (!m_eventTargets[key])
-    m_eventTargets[key] = new CFWL_EventTarget(this, pListener);
+    m_eventTargets[key] = new CFWL_EventTarget(pListener);
 
   m_eventTargets[key]->SetEventSource(pEventSource, dwFilter);
-  return FWL_Error::Succeeded;
 }
 
-FWL_Error CFWL_NoteDriver::UnregisterEventTarget(IFWL_Widget* pListener) {
+void CFWL_NoteDriver::UnregisterEventTarget(IFWL_Widget* pListener) {
   uint32_t key = pListener->GetEventKey();
   if (key == 0)
-    return FWL_Error::Indefinite;
+    return;
 
   auto it = m_eventTargets.find(key);
   if (it != m_eventTargets.end())
     it->second->FlagInvalid();
-
-  return FWL_Error::Succeeded;
 }
 
-void CFWL_NoteDriver::ClearEventTargets(bool bRemoveAll) {
-  ClearInvalidEventTargets(bRemoveAll);
-}
-
-FWL_Error CFWL_NoteDriver::PushNoteLoop(CFWL_NoteLoop* pNoteLoop) {
+void CFWL_NoteDriver::PushNoteLoop(CFWL_NoteLoop* pNoteLoop) {
   m_noteLoopQueue.Add(pNoteLoop);
-  return FWL_Error::Succeeded;
 }
+
 CFWL_NoteLoop* CFWL_NoteDriver::PopNoteLoop() {
   int32_t pos = m_noteLoopQueue.GetSize();
   if (pos <= 0)
@@ -165,7 +111,8 @@
   }
   return true;
 }
-FWL_Error CFWL_NoteDriver::Run() {
+
+void CFWL_NoteDriver::Run() {
 #if (_FX_OS_ == _FX_LINUX_DESKTOP_ || _FX_OS_ == _FX_WIN32_DESKTOP_ || \
      _FX_OS_ == _FX_WIN64_)
   CFWL_NoteLoop* pTopLoop = nullptr;
@@ -177,22 +124,8 @@
       continue;
   }
 #endif
-
-  return FWL_Error::Succeeded;
 }
 
-IFWL_Widget* CFWL_NoteDriver::GetFocus() {
-  return m_pFocus;
-}
-IFWL_Widget* CFWL_NoteDriver::GetHover() {
-  return m_pHover;
-}
-void CFWL_NoteDriver::SetHover(IFWL_Widget* pHover) {
-  m_pHover = pHover;
-}
-void CFWL_NoteDriver::SetGrab(IFWL_Widget* pGrab, bool bSet) {
-  m_pGrab = bSet ? pGrab : nullptr;
-}
 void CFWL_NoteDriver::NotifyTargetHide(IFWL_Widget* pNoteTarget) {
   if (m_pFocus == pNoteTarget) {
     m_pFocus = nullptr;
@@ -230,31 +163,27 @@
   }
 }
 
-FWL_Error CFWL_NoteDriver::RegisterForm(IFWL_Widget* pForm) {
-  if (!pForm)
-    return FWL_Error::Indefinite;
-  if (m_forms.Find(pForm) >= 0) {
-    return FWL_Error::Indefinite;
-  }
+void CFWL_NoteDriver::RegisterForm(IFWL_Widget* pForm) {
+  if (!pForm || m_forms.Find(pForm) >= 0)
+    return;
+
   m_forms.Add(pForm);
   if (m_forms.GetSize() == 1) {
     CFWL_NoteLoop* pLoop =
         static_cast<CFWL_NoteLoop*>(m_noteLoopQueue.GetAt(0));
     if (!pLoop)
-      return FWL_Error::Indefinite;
+      return;
     pLoop->SetMainForm(pForm);
   }
-  return FWL_Error::Succeeded;
 }
-FWL_Error CFWL_NoteDriver::UnRegisterForm(IFWL_Widget* pForm) {
+
+void CFWL_NoteDriver::UnRegisterForm(IFWL_Widget* pForm) {
   if (!pForm)
-    return FWL_Error::Indefinite;
+    return;
   int32_t nIndex = m_forms.Find(pForm);
-  if (nIndex < 0) {
-    return FWL_Error::Indefinite;
-  }
+  if (nIndex < 0)
+    return;
   m_forms.RemoveAt(nIndex);
-  return FWL_Error::Succeeded;
 }
 bool CFWL_NoteDriver::QueueMessage(CFWL_Message* pMessage) {
   pMessage->Retain();
@@ -276,15 +205,12 @@
   pMessage->Release();
   return true;
 }
-CFWL_NoteLoop* CFWL_NoteDriver::GetTopLoop() {
+CFWL_NoteLoop* CFWL_NoteDriver::GetTopLoop() const {
   int32_t size = m_noteLoopQueue.GetSize();
   if (size <= 0)
     return nullptr;
   return static_cast<CFWL_NoteLoop*>(m_noteLoopQueue[size - 1]);
 }
-int32_t CFWL_NoteDriver::CountLoop() {
-  return m_noteLoopQueue.GetSize();
-}
 
 bool CFWL_NoteDriver::ProcessMessage(CFWL_Message* pMessage) {
   CFWL_WidgetMgr* pWidgetMgr =
@@ -626,7 +552,7 @@
   return pMessageForm;
 }
 
-void CFWL_NoteDriver::ClearInvalidEventTargets(bool bRemoveAll) {
+void CFWL_NoteDriver::ClearEventTargets(bool bRemoveAll) {
   auto it = m_eventTargets.begin();
   while (it != m_eventTargets.end()) {
     auto old = it++;
@@ -637,9 +563,8 @@
   }
 }
 
-CFWL_EventTarget::CFWL_EventTarget(CFWL_NoteDriver* pNoteDriver,
-                                   IFWL_Widget* pListener)
-    : m_pListener(pListener), m_pNoteDriver(pNoteDriver), m_bInvalid(false) {}
+CFWL_EventTarget::CFWL_EventTarget(IFWL_Widget* pListener)
+    : m_pListener(pListener), m_bInvalid(false) {}
 CFWL_EventTarget::~CFWL_EventTarget() {
   m_eventSources.RemoveAll();
 }
@@ -677,7 +602,8 @@
   return false;
 }
 
-bool CFWL_EventTarget::IsFilterEvent(CFWL_Event* pEvent, uint32_t dwFilter) {
+bool CFWL_EventTarget::IsFilterEvent(CFWL_Event* pEvent,
+                                     uint32_t dwFilter) const {
   if (dwFilter == FWL_EVENT_ALL_MASK)
     return true;
 
@@ -703,50 +629,3 @@
       return !!(dwFilter & FWL_EVENT_CONTROL_MASK);
   }
 }
-
-CFWL_ToolTipContainer* CFWL_ToolTipContainer::s_pInstance = nullptr;
-
-CFWL_ToolTipContainer::CFWL_ToolTipContainer()
-    : m_nInitDelayTime(0), m_nAutoPopDelayTime(2000) {
-  m_fAnchor.Set(0.0, 0.0, 0.0, 0.0);
-}
-
-CFWL_ToolTipContainer::~CFWL_ToolTipContainer() {}
-
-void CFWL_ToolTipContainer::GetCaption(IFWL_Widget* pWidget,
-                                       CFX_WideString& wsCaption) {
-  wsCaption = m_wsCaption;
-}
-
-int32_t CFWL_ToolTipContainer::GetInitialDelay(IFWL_Widget* pWidget) {
-  return m_nInitDelayTime;
-}
-
-int32_t CFWL_ToolTipContainer::GetAutoPopDelay(IFWL_Widget* pWidget) {
-  return m_nAutoPopDelayTime;
-}
-
-CFX_DIBitmap* CFWL_ToolTipContainer::GetToolTipIcon(IFWL_Widget* pWidget) {
-  return nullptr;
-}
-
-CFX_SizeF CFWL_ToolTipContainer::GetToolTipIconSize(IFWL_Widget* pWidget) {
-  return CFX_SizeF();
-}
-
-CFX_RectF CFWL_ToolTipContainer::GetAnchor() {
-  return m_fAnchor;
-}
-
-// static
-CFWL_ToolTipContainer* CFWL_ToolTipContainer::getInstance() {
-  if (!s_pInstance)
-    s_pInstance = new CFWL_ToolTipContainer;
-  return s_pInstance;
-}
-
-// static
-void CFWL_ToolTipContainer::DeleteInstance() {
-  delete s_pInstance;
-  s_pInstance = nullptr;
-}
diff --git a/xfa/fwl/core/fwl_noteimp.h b/xfa/fwl/core/fwl_noteimp.h
index f8f5acb..45a92e7 100644
--- a/xfa/fwl/core/fwl_noteimp.h
+++ b/xfa/fwl/core/fwl_noteimp.h
@@ -12,7 +12,6 @@
 
 #include "xfa/fwl/core/cfwl_event.h"
 #include "xfa/fwl/core/cfwl_message.h"
-#include "xfa/fwl/core/fwl_error.h"
 #include "xfa/fwl/core/ifwl_tooltip.h"
 #include "xfa/fwl/core/ifwl_widget.h"
 #include "xfa/fxgraphics/cfx_graphics.h"
@@ -34,18 +33,15 @@
 
 class CFWL_NoteLoop {
  public:
-  CFWL_NoteLoop(IFWL_Widget* pForm = nullptr);
+  CFWL_NoteLoop();
   ~CFWL_NoteLoop() {}
 
-  FWL_Error Idle(int32_t count);
-  IFWL_Widget* GetForm();
-  bool ContinueModal();
-  FWL_Error EndModalLoop();
-  FWL_Error SetMainForm(IFWL_Widget* pForm);
+  IFWL_Widget* GetForm() const { return m_pForm; }
+  bool ContinueModal() const { return m_bContinueModal; }
+  void EndModalLoop() { m_bContinueModal = false; }
+  void SetMainForm(IFWL_Widget* pForm) { m_pForm = pForm; }
 
- protected:
-  void GenerateCommondEvent(uint32_t dwCommand);
-
+ private:
   IFWL_Widget* m_pForm;
   bool m_bContinueModal;
 };
@@ -56,31 +52,36 @@
   ~CFWL_NoteDriver();
 
   void SendEvent(CFWL_Event* pNote);
-  FWL_Error RegisterEventTarget(IFWL_Widget* pListener,
-                                IFWL_Widget* pEventSource = nullptr,
-                                uint32_t dwFilter = FWL_EVENT_ALL_MASK);
-  FWL_Error UnregisterEventTarget(IFWL_Widget* pListener);
-  void ClearEventTargets(bool bRemoveAll);
-  FWL_Error PushNoteLoop(CFWL_NoteLoop* pNoteLoop);
-  CFWL_NoteLoop* PopNoteLoop();
-  IFWL_Widget* GetFocus();
-  bool SetFocus(IFWL_Widget* pFocus, bool bNotify = false);
-  void SetGrab(IFWL_Widget* pGrab, bool bSet);
-  FWL_Error Run();
 
-  IFWL_Widget* GetHover();
-  void SetHover(IFWL_Widget* pHover);
+  void RegisterEventTarget(IFWL_Widget* pListener,
+                           IFWL_Widget* pEventSource = nullptr,
+                           uint32_t dwFilter = FWL_EVENT_ALL_MASK);
+  void UnregisterEventTarget(IFWL_Widget* pListener);
+  void ClearEventTargets(bool bRemoveAll);
+
+  CFWL_NoteLoop* GetTopLoop() const;
+  void PushNoteLoop(CFWL_NoteLoop* pNoteLoop);
+  CFWL_NoteLoop* PopNoteLoop();
+
+  IFWL_Widget* GetFocus() const { return m_pFocus; }
+  bool SetFocus(IFWL_Widget* pFocus, bool bNotify = false);
+  void SetGrab(IFWL_Widget* pGrab, bool bSet) {
+    m_pGrab = bSet ? pGrab : nullptr;
+  }
+
+  void Run();
+
   void NotifyTargetHide(IFWL_Widget* pNoteTarget);
   void NotifyTargetDestroy(IFWL_Widget* pNoteTarget);
-  FWL_Error RegisterForm(IFWL_Widget* pForm);
-  FWL_Error UnRegisterForm(IFWL_Widget* pForm);
+
+  void RegisterForm(IFWL_Widget* pForm);
+  void UnRegisterForm(IFWL_Widget* pForm);
+
   bool QueueMessage(CFWL_Message* pMessage);
   bool UnqueueMessage(CFWL_NoteLoop* pNoteLoop);
-  CFWL_NoteLoop* GetTopLoop();
-  int32_t CountLoop();
   bool ProcessMessage(CFWL_Message* pMessage);
 
- protected:
+ private:
   bool DispatchMessage(CFWL_Message* pMessage, IFWL_Widget* pMessageForm);
   bool DoActivate(CFWL_MsgActivate* pMsg, IFWL_Widget* pMessageForm);
   bool DoDeactivate(CFWL_MsgDeactivate* pMsg, IFWL_Widget* pMessageForm);
@@ -96,7 +97,6 @@
   void MouseSecondary(CFWL_MsgMouse* pMsg);
   bool IsValidMessage(CFWL_Message* pMessage);
   IFWL_Widget* GetMessageForm(IFWL_Widget* pDstTarget);
-  void ClearInvalidEventTargets(bool bRemoveAll);
 
   CFX_ArrayTemplate<IFWL_Widget*> m_forms;
   CFX_ArrayTemplate<CFWL_Message*> m_noteQueue;
@@ -110,47 +110,22 @@
 
 class CFWL_EventTarget {
  public:
-  CFWL_EventTarget(CFWL_NoteDriver* pNoteDriver, IFWL_Widget* pListener);
+  CFWL_EventTarget(IFWL_Widget* pListener);
   ~CFWL_EventTarget();
 
   int32_t SetEventSource(IFWL_Widget* pSource,
                          uint32_t dwFilter = FWL_EVENT_ALL_MASK);
   bool ProcessEvent(CFWL_Event* pEvent);
-  bool IsFilterEvent(CFWL_Event* pEvent, uint32_t dwFilter);
-  bool IsInvalid() { return m_bInvalid; }
+
+  bool IsInvalid() const { return m_bInvalid; }
   void FlagInvalid() { m_bInvalid = true; }
 
- protected:
+ private:
+  bool IsFilterEvent(CFWL_Event* pEvent, uint32_t dwFilter) const;
+
   CFX_MapPtrTemplate<void*, uint32_t> m_eventSources;
   IFWL_Widget* m_pListener;
-  CFWL_NoteDriver* m_pNoteDriver;
   bool m_bInvalid;
 };
 
-class CFWL_ToolTipContainer final : public IFWL_ToolTipDP {
- public:
-  static CFWL_ToolTipContainer* getInstance();
-  static void DeleteInstance();
-
-  // IFWL_ToolTipDP
-  void GetCaption(IFWL_Widget* pWidget, CFX_WideString& wsCaption) override;
-  int32_t GetInitialDelay(IFWL_Widget* pWidget) override;
-  int32_t GetAutoPopDelay(IFWL_Widget* pWidget) override;
-  CFX_DIBitmap* GetToolTipIcon(IFWL_Widget* pWidget) override;
-  CFX_SizeF GetToolTipIconSize(IFWL_Widget* pWidget) override;
-
- protected:
-  CFWL_ToolTipContainer();
-  ~CFWL_ToolTipContainer() override;
-
-  CFX_RectF GetAnchor();
-
- private:
-  static CFWL_ToolTipContainer* s_pInstance;
-  CFX_WideString m_wsCaption;
-  int32_t m_nInitDelayTime;
-  int32_t m_nAutoPopDelayTime;
-  CFX_RectF m_fAnchor;
-};
-
 #endif  // XFA_FWL_CORE_FWL_NOTEIMP_H_
diff --git a/xfa/fwl/core/ifwl_app.cpp b/xfa/fwl/core/ifwl_app.cpp
index 2612088..0a2b53a 100644
--- a/xfa/fwl/core/ifwl_app.cpp
+++ b/xfa/fwl/core/ifwl_app.cpp
@@ -19,6 +19,4 @@
   ASSERT(m_pAdapterNative);
 }
 
-IFWL_App::~IFWL_App() {
-  CFWL_ToolTipContainer::DeleteInstance();
-}
+IFWL_App::~IFWL_App() {}
diff --git a/xfa/fwl/core/ifwl_form.cpp b/xfa/fwl/core/ifwl_form.cpp
index 4a8d911..9e632a0 100644
--- a/xfa/fwl/core/ifwl_form.cpp
+++ b/xfa/fwl/core/ifwl_form.cpp
@@ -329,7 +329,9 @@
   if (!pDriver)
     return nullptr;
 
-  m_pNoteLoop.reset(new CFWL_NoteLoop(this));
+  m_pNoteLoop = pdfium::MakeUnique<CFWL_NoteLoop>();
+  m_pNoteLoop->SetMainForm(this);
+
   pDriver->PushNoteLoop(m_pNoteLoop.get());
   m_bDoModalFlag = true;
   SetStates(FWL_WGTSTATE_Invisible, false);