Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Unified Diff: xfa/fwl/core/ifwl_combolist.cpp

Issue 2464703006: Fold IFWL*::{Initialize|Finalize} into constructor/destructor (Closed)
Patch Set: Rebase to master Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « xfa/fwl/core/ifwl_combolist.h ('k') | xfa/fwl/core/ifwl_datetimecalendar.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: xfa/fwl/core/ifwl_combolist.cpp
diff --git a/xfa/fwl/core/ifwl_combolist.cpp b/xfa/fwl/core/ifwl_combolist.cpp
index 23392a5c70c7e28895711bdb9f38758776f2d18d..0fdc5ac6d9973853bf5bc037852ffa5126e69167 100644
--- a/xfa/fwl/core/ifwl_combolist.cpp
+++ b/xfa/fwl/core/ifwl_combolist.cpp
@@ -6,6 +6,7 @@
#include "xfa/fwl/core/ifwl_combolist.h"
+#include "third_party/base/ptr_util.h"
#include "xfa/fwl/core/ifwl_combobox.h"
#include "xfa/fwl/core/ifwl_comboedit.h"
@@ -14,20 +15,7 @@ IFWL_ComboList::IFWL_ComboList(const IFWL_App* app,
IFWL_Widget* pOuter)
: IFWL_ListBox(app, properties, pOuter), m_bNotifyOwner(TRUE) {
ASSERT(pOuter);
-}
-
-void IFWL_ComboList::Initialize() {
- IFWL_ListBox::Initialize();
-
- // Delete the delegate that was created by IFWL_ListBox::Initialize ...
- delete m_pDelegate;
- m_pDelegate = new CFWL_ComboListImpDelegate(this);
-}
-
-void IFWL_ComboList::Finalize() {
- delete m_pDelegate;
- m_pDelegate = nullptr;
- IFWL_ListBox::Finalize();
+ SetDelegate(pdfium::MakeUnique<CFWL_ComboListImpDelegate>(this));
}
int32_t IFWL_ComboList::MatchItem(const CFX_WideString& wsMatch) {
@@ -195,7 +183,7 @@ int32_t CFWL_ComboListImpDelegate::OnDropListMouseMove(CFWL_MsgMouse* pMsg) {
} else if (m_pOwner->m_bNotifyOwner) {
m_pOwner->ClientToOuter(pMsg->m_fx, pMsg->m_fy);
IFWL_ComboBox* pOuter = static_cast<IFWL_ComboBox*>(m_pOwner->m_pOuter);
- pOuter->m_pDelegate->OnProcessMessage(pMsg);
+ pOuter->GetDelegate()->OnProcessMessage(pMsg);
}
return 1;
}
@@ -213,7 +201,7 @@ int32_t CFWL_ComboListImpDelegate::OnDropListLButtonUp(CFWL_MsgMouse* pMsg) {
IFWL_ComboBox* pOuter = static_cast<IFWL_ComboBox*>(m_pOwner->m_pOuter);
if (m_pOwner->m_bNotifyOwner) {
m_pOwner->ClientToOuter(pMsg->m_fx, pMsg->m_fy);
- pOuter->m_pDelegate->OnProcessMessage(pMsg);
+ pOuter->GetDelegate()->OnProcessMessage(pMsg);
} else {
if (m_pOwner->IsShowScrollBar(TRUE) && m_pOwner->m_pVertScrollBar) {
CFX_RectF rect;
@@ -255,7 +243,7 @@ int32_t CFWL_ComboListImpDelegate::OnDropListKey(CFWL_MsgKey* pKey) {
}
if (bPropagate) {
pKey->m_pDstTarget = m_pOwner->m_pOuter;
- pOuter->m_pDelegate->OnProcessMessage(pKey);
+ pOuter->GetDelegate()->OnProcessMessage(pKey);
return 1;
}
return 0;
« no previous file with comments | « xfa/fwl/core/ifwl_combolist.h ('k') | xfa/fwl/core/ifwl_datetimecalendar.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698