IFWL_App::Create() always passed adapter, "fuel" adapter unused

R=thestig@chromium.org

Review URL: https://codereview.chromium.org/1707433002 .
diff --git a/xfa/include/fwl/adapter/fwl_adapternative.h b/xfa/include/fwl/adapter/fwl_adapternative.h
index b914f7b..3ea5c89 100644
--- a/xfa/include/fwl/adapter/fwl_adapternative.h
+++ b/xfa/include/fwl/adapter/fwl_adapternative.h
@@ -4,8 +4,8 @@
 
 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
 
-#ifndef _FWL_ADAPTER_NATIVE_H
-#define _FWL_ADAPTER_NATIVE_H
+#ifndef FWL_ADAPTERNATIVE_H_
+#define FWL_ADAPTERNATIVE_H_
 
 class IFWL_WidgetMgrDelegate;
 class IFWL_AdapterWidgetMgr;
@@ -20,6 +20,5 @@
   virtual IFWL_AdapterThreadMgr* GetThreadMgr() = 0;
   virtual IFWL_AdapterTimerMgr* GetTimerMgr() = 0;
 };
-IFWL_AdapterNative* FWL_CreateFuelAdapterNative();
-void FWL_ReleaseFuelAdapterNative(IFWL_AdapterNative* pAdapterNative);
-#endif
+
+#endif  // FWL_ADAPTERNATIVE_H_
diff --git a/xfa/src/fwl/src/core/fwl_appimp.cpp b/xfa/src/fwl/src/core/fwl_appimp.cpp
index a9d8e28..aced5e6 100644
--- a/xfa/src/fwl/src/core/fwl_appimp.cpp
+++ b/xfa/src/fwl/src/core/fwl_appimp.cpp
@@ -39,46 +39,33 @@
 }
 
 CFWL_AppImp::CFWL_AppImp(IFWL_App* pIface, IFWL_AdapterNative* pAdapter)
-    : CFWL_NoteThreadImp(pIface), m_pWidgetMgr(NULL), m_pThemeProvider(NULL) {
-  if (!pAdapter) {
-    pAdapter = FWL_CreateFuelAdapterNative();
-    m_bFuelAdapter = TRUE;
-  } else {
-    m_bFuelAdapter = FALSE;
-  }
-  m_pAdapterNative = pAdapter;
-}
+    : CFWL_NoteThreadImp(pIface),
+      m_pAdapterNative(pAdapter),
+      m_pThemeProvider(nullptr) {}
+
 CFWL_AppImp::~CFWL_AppImp() {
   CFWL_ToolTipContainer::DeleteInstance();
-  if (m_bFuelAdapter) {
-    FWL_ReleaseFuelAdapterNative(m_pAdapterNative);
-    m_pAdapterNative = NULL;
-  }
-  if (m_pWidgetMgr) {
-    delete m_pWidgetMgr;
-    m_pWidgetMgr = NULL;
-  }
 }
+
 FWL_ERR CFWL_AppImp::Initialize() {
   if (!m_pWidgetMgr) {
-    m_pWidgetMgr = new CFWL_WidgetMgr(m_pAdapterNative);
+    m_pWidgetMgr.reset(new CFWL_WidgetMgr(m_pAdapterNative));
   }
   return FWL_ERR_Succeeded;
 }
 FWL_ERR CFWL_AppImp::Finalize() {
-  delete m_pWidgetMgr;
-  m_pWidgetMgr = NULL;
+  m_pWidgetMgr.reset();
   return FWL_ERR_Succeeded;
 }
-IFWL_AdapterNative* CFWL_AppImp::GetAdapterNative() {
+IFWL_AdapterNative* CFWL_AppImp::GetAdapterNative() const {
   return m_pAdapterNative;
 }
 IFWL_AdapterWidgetMgr* FWL_GetAdapterWidgetMgr() {
   return static_cast<CFWL_WidgetMgr*>(FWL_GetWidgetMgr())
       ->GetAdapterWidgetMgr();
 }
-IFWL_WidgetMgr* CFWL_AppImp::GetWidgetMgr() {
-  return m_pWidgetMgr;
+IFWL_WidgetMgr* CFWL_AppImp::GetWidgetMgr() const {
+  return m_pWidgetMgr.get();
 }
 FWL_ERR CFWL_AppImp::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) {
   m_pThemeProvider = pThemeProvider;
@@ -89,7 +76,7 @@
     ;
   return m_pWidgetMgr->GetAdapterWidgetMgr()->Exit(0);
 }
-IFWL_ThemeProvider* CFWL_AppImp::GetThemeProvider() {
+IFWL_ThemeProvider* CFWL_AppImp::GetThemeProvider() const {
   return m_pThemeProvider;
 }
 IFWL_AdapterNative* FWL_GetAdapterNative() {
diff --git a/xfa/src/fwl/src/core/include/fwl_appimp.h b/xfa/src/fwl/src/core/include/fwl_appimp.h
index 244445d..6278766 100644
--- a/xfa/src/fwl/src/core/include/fwl_appimp.h
+++ b/xfa/src/fwl/src/core/include/fwl_appimp.h
@@ -7,6 +7,8 @@
 #ifndef FWL_APPIMP_H_
 #define FWL_APPIMP_H_
 
+#include <memory>
+
 #include "xfa/src/fwl/src/core/include/fwl_threadimp.h"
 
 class CFWL_WidgetMgr;
@@ -21,17 +23,16 @@
   virtual ~CFWL_AppImp();
   virtual FWL_ERR Initialize();
   virtual FWL_ERR Finalize();
-  virtual IFWL_AdapterNative* GetAdapterNative();
-  virtual IFWL_WidgetMgr* GetWidgetMgr();
-  virtual IFWL_ThemeProvider* GetThemeProvider();
+  virtual IFWL_AdapterNative* GetAdapterNative() const;
+  virtual IFWL_WidgetMgr* GetWidgetMgr() const;
+  virtual IFWL_ThemeProvider* GetThemeProvider() const;
   virtual FWL_ERR SetThemeProvider(IFWL_ThemeProvider* pThemeProvider);
   virtual FWL_ERR Exit(int32_t iExitCode = 0);
 
  protected:
-  CFWL_WidgetMgr* m_pWidgetMgr;
-  IFWL_AdapterNative* m_pAdapterNative;
+  IFWL_AdapterNative* const m_pAdapterNative;
+  std::unique_ptr<CFWL_WidgetMgr> m_pWidgetMgr;
   IFWL_ThemeProvider* m_pThemeProvider;
-  FX_BOOL m_bFuelAdapter;
 };
 
 #endif  // FWL_APPIMP_H_
diff --git a/xfa/src/fxfa/src/app/xfa_fwladapter.cpp b/xfa/src/fxfa/src/app/xfa_fwladapter.cpp
index e5a3e7a..517c491 100644
--- a/xfa/src/fxfa/src/app/xfa_fwladapter.cpp
+++ b/xfa/src/fxfa/src/app/xfa_fwladapter.cpp
@@ -10,10 +10,7 @@
 #include "xfa_ffwidget.h"
 #include "xfa_fffield.h"
 #include "xfa_ffdoc.h"
-IFWL_AdapterNative* FWL_CreateFuelAdapterNative() {
-  return NULL;
-}
-void FWL_ReleaseFuelAdapterNative(IFWL_AdapterNative* native) {}
+
 void FWL_PostMessageToMainRoop(CFWL_Message* pMessage) {}
 FX_BOOL FWL_ShowCaret(IFWL_Widget* pWidget,
                       FX_BOOL bVisible,