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

Side by Side Diff: xfa/fwl/lightwidget/cfwl_barcode.cpp

Issue 2433133002: Remove IFWL_*::Create methods, use new (Closed)
Patch Set: Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 PDFium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6 6
7 #include "xfa/fwl/lightwidget/cfwl_barcode.h" 7 #include "xfa/fwl/lightwidget/cfwl_barcode.h"
8 8
9 #include <memory> 9 #include <memory>
10 10
11 #include "third_party/base/ptr_util.h"
12
11 IFWL_Barcode* CFWL_Barcode::GetWidget() { 13 IFWL_Barcode* CFWL_Barcode::GetWidget() {
12 return static_cast<IFWL_Barcode*>(m_pIface.get()); 14 return static_cast<IFWL_Barcode*>(m_pIface.get());
13 } 15 }
14 16
15 const IFWL_Barcode* CFWL_Barcode::GetWidget() const { 17 const IFWL_Barcode* CFWL_Barcode::GetWidget() const {
16 return static_cast<IFWL_Barcode*>(m_pIface.get()); 18 return static_cast<IFWL_Barcode*>(m_pIface.get());
17 } 19 }
18 20
19 FWL_Error CFWL_Barcode::Initialize(const CFWL_WidgetProperties* pProperties) { 21 FWL_Error CFWL_Barcode::Initialize(const CFWL_WidgetProperties* pProperties) {
20 if (m_pIface) 22 if (m_pIface)
21 return FWL_Error::Indefinite; 23 return FWL_Error::Indefinite;
22 if (pProperties) { 24 if (pProperties) {
23 *m_pProperties = *pProperties; 25 *m_pProperties = *pProperties;
24 } 26 }
25 std::unique_ptr<IFWL_Barcode> pBarcode(IFWL_Barcode::Create( 27 std::unique_ptr<IFWL_Barcode> pBarcode = pdfium::MakeUnique<IFWL_Barcode>(
26 m_pProperties->MakeWidgetImpProperties(&m_barcodeData))); 28 m_pProperties->MakeWidgetImpProperties(&m_barcodeData));
Wei Li 2016/10/19 17:13:07 Nit, is this a bit simpler? std::unique_ptr<IFWL_B
dsinclair 2016/10/19 17:21:28 Done.
27 FWL_Error ret = pBarcode->Initialize(); 29 FWL_Error ret = pBarcode->Initialize();
28 if (ret != FWL_Error::Succeeded) { 30 if (ret != FWL_Error::Succeeded) {
29 return ret; 31 return ret;
30 } 32 }
31 m_pIface = std::move(pBarcode); 33 m_pIface = std::move(pBarcode);
32 CFWL_Widget::Initialize(); 34 CFWL_Widget::Initialize();
33 return FWL_Error::Succeeded; 35 return FWL_Error::Succeeded;
34 } 36 }
35 37
36 CFWL_Barcode::CFWL_Barcode() {} 38 CFWL_Barcode::CFWL_Barcode() {}
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 return m_nECLevel; 104 return m_nECLevel;
103 } 105 }
104 106
105 FX_BOOL CFWL_Barcode::CFWL_BarcodeDP::GetTruncated() { 107 FX_BOOL CFWL_Barcode::CFWL_BarcodeDP::GetTruncated() {
106 return m_bTruncated; 108 return m_bTruncated;
107 } 109 }
108 110
109 uint32_t CFWL_Barcode::CFWL_BarcodeDP::GetBarcodeAttributeMask() { 111 uint32_t CFWL_Barcode::CFWL_BarcodeDP::GetBarcodeAttributeMask() {
110 return m_dwAttributeMask; 112 return m_dwAttributeMask;
111 } 113 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698