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

Unified Diff: xfa/fwl/lightwidget/cfwl_barcode.cpp

Issue 2209153002: Use virtual function to retrieve interface pointer (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: complete changes Created 4 years, 4 months 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
Index: xfa/fwl/lightwidget/cfwl_barcode.cpp
diff --git a/xfa/fwl/lightwidget/cfwl_barcode.cpp b/xfa/fwl/lightwidget/cfwl_barcode.cpp
index 2e29d63f34d6001da7c3cbbad12b38833afdd8c6..87fde8eaa02acadada93a3fe9d094411658784f9 100644
--- a/xfa/fwl/lightwidget/cfwl_barcode.cpp
+++ b/xfa/fwl/lightwidget/cfwl_barcode.cpp
@@ -8,6 +8,14 @@
#include <memory>
+IFWL_Barcode* CFWL_Barcode::GetWidget() {
+ return static_cast<IFWL_Barcode*>(m_pIface.get());
+}
+
+const IFWL_Barcode* CFWL_Barcode::GetWidget() const {
+ return static_cast<IFWL_Barcode*>(m_pIface.get());
+}
+
CFWL_Barcode* CFWL_Barcode::Create() {
return new CFWL_Barcode;
}
@@ -24,7 +32,7 @@ FWL_Error CFWL_Barcode::Initialize(const CFWL_WidgetProperties* pProperties) {
if (ret != FWL_Error::Succeeded) {
return ret;
}
- m_pIface = pBarcode.release();
+ m_pIface = std::move(pBarcode);
CFWL_Widget::Initialize();
return FWL_Error::Succeeded;
}
@@ -34,15 +42,15 @@ CFWL_Barcode::CFWL_Barcode() {}
CFWL_Barcode::~CFWL_Barcode() {}
void CFWL_Barcode::SetType(BC_TYPE type) {
- if (!m_pIface)
+ if (!GetWidget())
Lei Zhang 2016/08/05 17:34:18 auto* pWidget = GetWidget(); if (pWidget) pWidge
Wei Li 2016/08/08 23:55:37 Done.
return;
- static_cast<IFWL_Barcode*>(m_pIface)->SetType(type);
+ GetWidget()->SetType(type);
}
FX_BOOL CFWL_Barcode::IsProtectedType() {
- if (!m_pIface)
+ if (!GetWidget())
Lei Zhang 2016/08/05 17:34:18 auto* pWidget = GetWidget(); return pWidget ? pWid
Wei Li 2016/08/08 23:55:37 Done.
return 0;
- return static_cast<IFWL_Barcode*>(m_pIface)->IsProtectedType();
+ return GetWidget()->IsProtectedType();
}
CFWL_Barcode::CFWL_BarcodeDP::CFWL_BarcodeDP()

Powered by Google App Engine
This is Rietveld 408576698