summaryrefslogtreecommitdiff
path: root/xfa/fxfa/app/xfa_ffpushbutton.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2017-04-14 17:07:09 -0700
committerChromium commit bot <commit-bot@chromium.org>2017-04-18 14:11:29 +0000
commit5f28b86694455e5ef37736b73fe17d2c271ac721 (patch)
tree46c93dd9028d12f813f56ad8d1b12fee818de7a4 /xfa/fxfa/app/xfa_ffpushbutton.cpp
parent0f9b0a9d72a46cf708866aebc5f1103087b3d2c2 (diff)
downloadpdfium-5f28b86694455e5ef37736b73fe17d2c271ac721.tar.xz
Use unique_ptr for m_pNormalWidget
Change-Id: I8f28171b55c625061bb047899dbfcd4a61004e09 Reviewed-on: https://pdfium-review.googlesource.com/4253 Commit-Queue: dsinclair <dsinclair@chromium.org> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'xfa/fxfa/app/xfa_ffpushbutton.cpp')
-rw-r--r--xfa/fxfa/app/xfa_ffpushbutton.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/xfa/fxfa/app/xfa_ffpushbutton.cpp b/xfa/fxfa/app/xfa_ffpushbutton.cpp
index fa5c0dc9a1..5e9c33db14 100644
--- a/xfa/fxfa/app/xfa_ffpushbutton.cpp
+++ b/xfa/fxfa/app/xfa_ffpushbutton.cpp
@@ -6,6 +6,9 @@
#include "xfa/fxfa/app/xfa_ffpushbutton.h"
+#include <utility>
+
+#include "third_party/base/ptr_util.h"
#include "xfa/fwl/cfwl_notedriver.h"
#include "xfa/fwl/cfwl_pushbutton.h"
#include "xfa/fwl/cfwl_widgetmgr.h"
@@ -41,27 +44,30 @@ void CXFA_FFPushButton::RenderWidget(CFX_Graphics* pGS,
CFX_RectF rtWidget = GetRectWithoutRotate();
CFX_Matrix mt(1, 0, 0, 1, rtWidget.left, rtWidget.top);
mt.Concat(mtRotate);
- GetApp()->GetWidgetMgrDelegate()->OnDrawWidget(m_pNormalWidget, pGS, &mt);
+ GetApp()->GetWidgetMgrDelegate()->OnDrawWidget(m_pNormalWidget.get(), pGS,
+ &mt);
}
bool CXFA_FFPushButton::LoadWidget() {
ASSERT(!m_pNormalWidget);
- CFWL_PushButton* pPushButton = new CFWL_PushButton(GetFWLApp());
+ auto pNew = pdfium::MakeUnique<CFWL_PushButton>(GetFWLApp());
+ CFWL_PushButton* pPushButton = pNew.get();
m_pOldDelegate = pPushButton->GetDelegate();
pPushButton->SetDelegate(this);
-
- m_pNormalWidget = pPushButton;
+ m_pNormalWidget = std::move(pNew);
m_pNormalWidget->SetLayoutItem(this);
CFWL_NoteDriver* pNoteDriver =
m_pNormalWidget->GetOwnerApp()->GetNoteDriver();
- pNoteDriver->RegisterEventTarget(m_pNormalWidget, m_pNormalWidget);
+ pNoteDriver->RegisterEventTarget(m_pNormalWidget.get(),
+ m_pNormalWidget.get());
m_pNormalWidget->LockUpdate();
UpdateWidgetProperty();
LoadHighlightCaption();
m_pNormalWidget->UnlockUpdate();
return CXFA_FFField::LoadWidget();
}
+
void CXFA_FFPushButton::UpdateWidgetProperty() {
uint32_t dwStyleEx = 0;
switch (m_pDataAcc->GetButtonHighlight()) {