1 // Copyright 2014 PDFium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com 6 7 #include "xfa/fwl/cfwl_timer.h" 8 9 #include "xfa/fwl/cfwl_app.h" 10 #include "xfa/fwl/cfwl_timerinfo.h" 11 #include "xfa/fwl/cfwl_widget.h" 12 #include "xfa/fwl/ifwl_adaptertimermgr.h" 13 #include "xfa/fxfa/cxfa_ffapp.h" 14 CFWL_Timer(CFWL_Widget * parent)15CFWL_Timer::CFWL_Timer(CFWL_Widget* parent) : m_pWidget(parent) {} 16 ~CFWL_Timer()17CFWL_Timer::~CFWL_Timer() {} 18 StartTimer(uint32_t dwElapse,bool bImmediately)19CFWL_TimerInfo* CFWL_Timer::StartTimer(uint32_t dwElapse, bool bImmediately) { 20 const CFWL_App* pApp = m_pWidget->GetOwnerApp(); 21 if (!pApp) 22 return nullptr; 23 24 CXFA_FFApp* pAdapterNative = pApp->GetAdapterNative(); 25 if (!pAdapterNative) 26 return nullptr; 27 28 IFWL_AdapterTimerMgr* pAdapterTimerMgr = pAdapterNative->GetTimerMgr(); 29 if (!pAdapterTimerMgr) 30 return nullptr; 31 32 CFWL_TimerInfo* pTimerInfo = nullptr; 33 pAdapterTimerMgr->Start(this, dwElapse, bImmediately, &pTimerInfo); 34 return pTimerInfo; 35 } 36