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

Side by Side Diff: xfa/fwl/cfwl_datetimepicker.cpp

Issue 2571913002: Avoid the ptr.reset(new XXX()) anti-pattern (Closed)
Patch Set: rebase Created 4 years 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
« no previous file with comments | « xfa/fwl/cfwl_combobox.cpp ('k') | xfa/fwl/cfwl_widgetmgr.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/cfwl_datetimepicker.h" 7 #include "xfa/fwl/cfwl_datetimepicker.h"
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 new CFWL_MonthCalendar(m_pOwnerApp, std::move(monthProp), this)); 46 new CFWL_MonthCalendar(m_pOwnerApp, std::move(monthProp), this));
47 47
48 CFX_RectF rtMonthCal = m_pMonthCal->GetAutosizedWidgetRect(); 48 CFX_RectF rtMonthCal = m_pMonthCal->GetAutosizedWidgetRect();
49 rtMonthCal.Set(0, 0, rtMonthCal.width, rtMonthCal.height); 49 rtMonthCal.Set(0, 0, rtMonthCal.width, rtMonthCal.height);
50 m_pMonthCal->SetWidgetRect(rtMonthCal); 50 m_pMonthCal->SetWidgetRect(rtMonthCal);
51 51
52 auto editProp = pdfium::MakeUnique<CFWL_WidgetProperties>(); 52 auto editProp = pdfium::MakeUnique<CFWL_WidgetProperties>();
53 editProp->m_pParent = this; 53 editProp->m_pParent = this;
54 editProp->m_pThemeProvider = m_pProperties->m_pThemeProvider; 54 editProp->m_pThemeProvider = m_pProperties->m_pThemeProvider;
55 55
56 m_pEdit.reset(new CFWL_DateTimeEdit(m_pOwnerApp, std::move(editProp), this)); 56 m_pEdit = pdfium::MakeUnique<CFWL_DateTimeEdit>(m_pOwnerApp,
57 std::move(editProp), this);
57 RegisterEventTarget(m_pMonthCal.get()); 58 RegisterEventTarget(m_pMonthCal.get());
58 RegisterEventTarget(m_pEdit.get()); 59 RegisterEventTarget(m_pEdit.get());
59 } 60 }
60 61
61 CFWL_DateTimePicker::~CFWL_DateTimePicker() { 62 CFWL_DateTimePicker::~CFWL_DateTimePicker() {
62 UnregisterEventTarget(); 63 UnregisterEventTarget();
63 } 64 }
64 65
65 FWL_Type CFWL_DateTimePicker::GetClassID() const { 66 FWL_Type CFWL_DateTimePicker::GetClassID() const {
66 return FWL_Type::DateTimePicker; 67 return FWL_Type::DateTimePicker;
(...skipping 549 matching lines...) Expand 10 before | Expand all | Expand 10 after
616 if (DisForm_IsMonthCalendarVisible()) 617 if (DisForm_IsMonthCalendarVisible())
617 ShowMonthCalendar(false); 618 ShowMonthCalendar(false);
618 if (m_pEdit->GetStates() & FWL_WGTSTATE_Focused) { 619 if (m_pEdit->GetStates() & FWL_WGTSTATE_Focused) {
619 pMsg->m_pSrcTarget = m_pEdit.get(); 620 pMsg->m_pSrcTarget = m_pEdit.get();
620 m_pEdit->GetDelegate()->OnProcessMessage(pMsg); 621 m_pEdit->GetDelegate()->OnProcessMessage(pMsg);
621 } 622 }
622 } 623 }
623 rtInvalidate.Inflate(2, 2); 624 rtInvalidate.Inflate(2, 2);
624 RepaintRect(rtInvalidate); 625 RepaintRect(rtInvalidate);
625 } 626 }
OLDNEW
« no previous file with comments | « xfa/fwl/cfwl_combobox.cpp ('k') | xfa/fwl/cfwl_widgetmgr.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698