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

Side by Side Diff: xfa/fwl/lightwidget/cfwl_pushbutton.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_pushbutton.h" 7 #include "xfa/fwl/lightwidget/cfwl_pushbutton.h"
8 8
9 #include <memory> 9 #include <memory>
10 10
11 #include "third_party/base/ptr_util.h"
12
11 IFWL_PushButton* CFWL_PushButton::GetWidget() { 13 IFWL_PushButton* CFWL_PushButton::GetWidget() {
12 return static_cast<IFWL_PushButton*>(m_pIface.get()); 14 return static_cast<IFWL_PushButton*>(m_pIface.get());
13 } 15 }
14 16
15 const IFWL_PushButton* CFWL_PushButton::GetWidget() const { 17 const IFWL_PushButton* CFWL_PushButton::GetWidget() const {
16 return static_cast<IFWL_PushButton*>(m_pIface.get()); 18 return static_cast<IFWL_PushButton*>(m_pIface.get());
17 } 19 }
18 20
19 FWL_Error CFWL_PushButton::Initialize( 21 FWL_Error CFWL_PushButton::Initialize(
20 const CFWL_WidgetProperties* pProperties) { 22 const CFWL_WidgetProperties* pProperties) {
21 if (m_pIface) 23 if (m_pIface)
22 return FWL_Error::Indefinite; 24 return FWL_Error::Indefinite;
23 if (pProperties) { 25 if (pProperties) {
24 *m_pProperties = *pProperties; 26 *m_pProperties = *pProperties;
25 } 27 }
26 std::unique_ptr<IFWL_PushButton> pPushButton(IFWL_PushButton::Create( 28 std::unique_ptr<IFWL_PushButton> pPushButton =
27 m_pProperties->MakeWidgetImpProperties(&m_buttonData), nullptr)); 29 pdfium::MakeUnique<IFWL_PushButton>(
30 m_pProperties->MakeWidgetImpProperties(&m_buttonData));
28 FWL_Error ret = pPushButton->Initialize(); 31 FWL_Error ret = pPushButton->Initialize();
29 if (ret != FWL_Error::Succeeded) { 32 if (ret != FWL_Error::Succeeded) {
30 return ret; 33 return ret;
31 } 34 }
32 m_pIface = std::move(pPushButton); 35 m_pIface = std::move(pPushButton);
33 CFWL_Widget::Initialize(); 36 CFWL_Widget::Initialize();
34 return FWL_Error::Succeeded; 37 return FWL_Error::Succeeded;
35 } 38 }
36 39
37 FWL_Error CFWL_PushButton::GetCaption(CFX_WideString& wsCaption) { 40 FWL_Error CFWL_PushButton::GetCaption(CFX_WideString& wsCaption) {
(...skipping 23 matching lines...) Expand all
61 IFWL_Widget* pWidget, 64 IFWL_Widget* pWidget,
62 CFX_WideString& wsCaption) { 65 CFX_WideString& wsCaption) {
63 wsCaption = m_wsCaption; 66 wsCaption = m_wsCaption;
64 return FWL_Error::Succeeded; 67 return FWL_Error::Succeeded;
65 } 68 }
66 69
67 CFX_DIBitmap* CFWL_PushButton::CFWL_PushButtonDP::GetPicture( 70 CFX_DIBitmap* CFWL_PushButton::CFWL_PushButtonDP::GetPicture(
68 IFWL_Widget* pWidget) { 71 IFWL_Widget* pWidget) {
69 return m_pBitmap; 72 return m_pBitmap;
70 } 73 }
OLDNEW
« xfa/fwl/lightwidget/cfwl_checkbox.cpp ('K') | « xfa/fwl/lightwidget/cfwl_picturebox.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698