summaryrefslogtreecommitdiff
path: root/xfa/fwl/core/ifwl_widget.cpp
diff options
context:
space:
mode:
authordsinclair <dsinclair@chromium.org>2016-11-01 18:48:19 -0700
committerCommit bot <commit-bot@chromium.org>2016-11-01 18:48:20 -0700
commit6fe8795d9022105a0061a0a81be9a49d49fda345 (patch)
treeb1fc8d51560fbf0a9e4a163f887e763f565d5234 /xfa/fwl/core/ifwl_widget.cpp
parent919e48d877e503f1ca250bc37324c9f7dc96d7a9 (diff)
downloadpdfium-6fe8795d9022105a0061a0a81be9a49d49fda345.tar.xz
Fold IFWL*::{Initialize|Finalize} into constructor/destructor
This Cl moves the ::Initialize method into the constructors and the ::Finalize method into the destructors. The |m_pDelegate| is made private and a unique_ptr. A |SetDelegate| and |GetDelegate| method are added. Review-Url: https://codereview.chromium.org/2464703006
Diffstat (limited to 'xfa/fwl/core/ifwl_widget.cpp')
-rw-r--r--xfa/fwl/core/ifwl_widget.cpp20
1 files changed, 8 insertions, 12 deletions
diff --git a/xfa/fwl/core/ifwl_widget.cpp b/xfa/fwl/core/ifwl_widget.cpp
index da90c4892d..961c02497b 100644
--- a/xfa/fwl/core/ifwl_widget.cpp
+++ b/xfa/fwl/core/ifwl_widget.cpp
@@ -30,7 +30,6 @@ IFWL_Widget::IFWL_Widget(const IFWL_App* app,
: m_pOwnerApp(app),
m_pWidgetMgr(app->GetWidgetMgr()),
m_pProperties(new CFWL_WidgetImpProperties(properties)),
- m_pDelegate(nullptr),
m_pCurDelegate(nullptr),
m_pOuter(pOuter),
m_pLayoutItem(nullptr),
@@ -38,21 +37,18 @@ IFWL_Widget::IFWL_Widget(const IFWL_App* app,
m_iLock(0),
m_nEventKey(0) {
ASSERT(m_pWidgetMgr);
-}
-
-IFWL_Widget::~IFWL_Widget() {}
-void IFWL_Widget::Initialize() {
IFWL_Widget* pParent = m_pProperties->m_pParent;
m_pWidgetMgr->InsertWidget(pParent, this);
- if (!IsChild()) {
- IFWL_Widget* pOwner = m_pProperties->m_pOwner;
- if (pOwner)
- m_pWidgetMgr->SetOwner(pOwner, this);
- }
+ if (IsChild())
+ return;
+
+ IFWL_Widget* pOwner = m_pProperties->m_pOwner;
+ if (pOwner)
+ m_pWidgetMgr->SetOwner(pOwner, this);
}
-void IFWL_Widget::Finalize() {
+IFWL_Widget::~IFWL_Widget() {
NotifyDriver();
m_pWidgetMgr->RemoveWidget(this);
}
@@ -354,7 +350,7 @@ FWL_Error IFWL_Widget::SetThemeProvider(IFWL_ThemeProvider* pThemeProvider) {
IFWL_WidgetDelegate* IFWL_Widget::GetCurrentDelegate() {
if (!m_pCurDelegate)
- m_pCurDelegate = m_pDelegate;
+ m_pCurDelegate = m_pDelegate.get();
return m_pCurDelegate;
}