summaryrefslogtreecommitdiff
path: root/fpdfsdk/formfiller/cffl_combobox.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fpdfsdk/formfiller/cffl_combobox.cpp')
-rw-r--r--fpdfsdk/formfiller/cffl_combobox.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/fpdfsdk/formfiller/cffl_combobox.cpp b/fpdfsdk/formfiller/cffl_combobox.cpp
index 830e64713a..69cc66bbc8 100644
--- a/fpdfsdk/formfiller/cffl_combobox.cpp
+++ b/fpdfsdk/formfiller/cffl_combobox.cpp
@@ -6,12 +6,15 @@
#include "fpdfsdk/formfiller/cffl_combobox.h"
+#include <utility>
+
#include "fpdfsdk/cpdfsdk_common.h"
#include "fpdfsdk/cpdfsdk_formfillenvironment.h"
#include "fpdfsdk/cpdfsdk_widget.h"
#include "fpdfsdk/formfiller/cba_fontmap.h"
#include "fpdfsdk/formfiller/cffl_interactiveformfiller.h"
#include "fpdfsdk/pwl/cpwl_combo_box.h"
+#include "third_party/base/ptr_util.h"
CFFL_ComboBox::CFFL_ComboBox(CPDFSDK_FormFillEnvironment* pApp,
CPDFSDK_Widget* pWidget)
@@ -41,8 +44,9 @@ CPWL_Wnd::CreateParams CFFL_ComboBox::GetCreateParam() {
return cp;
}
-CPWL_Wnd* CFFL_ComboBox::NewPDFWindow(const CPWL_Wnd::CreateParams& cp) {
- auto* pWnd = new CPWL_ComboBox();
+std::unique_ptr<CPWL_Wnd> CFFL_ComboBox::NewPDFWindow(
+ const CPWL_Wnd::CreateParams& cp) {
+ auto pWnd = pdfium::MakeUnique<CPWL_ComboBox>();
pWnd->AttachFFLData(this);
pWnd->Create(cp);
@@ -57,13 +61,12 @@ CPWL_Wnd* CFFL_ComboBox::NewPDFWindow(const CPWL_Wnd::CreateParams& cp) {
else
swText = m_pWidget->GetOptionLabel(nCurSel);
- for (int32_t i = 0, sz = m_pWidget->CountOptions(); i < sz; i++) {
+ for (int32_t i = 0, sz = m_pWidget->CountOptions(); i < sz; i++)
pWnd->AddString(m_pWidget->GetOptionLabel(i));
- }
pWnd->SetSelect(nCurSel);
pWnd->SetText(swText);
- return pWnd;
+ return std::move(pWnd);
}
bool CFFL_ComboBox::OnChar(CPDFSDK_Annot* pAnnot,