• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2014 The PDFium Authors
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 #ifndef XFA_FWL_CFWL_APP_H_
8 #define XFA_FWL_CFWL_APP_H_
9 
10 #include "core/fxcrt/cfx_timer.h"
11 #include "fxjs/gc/heap.h"
12 #include "v8/include/cppgc/garbage-collected.h"
13 #include "v8/include/cppgc/member.h"
14 #include "v8/include/cppgc/visitor.h"
15 #include "xfa/fwl/cfwl_widgetmgr.h"
16 
17 class CFWL_NoteDriver;
18 class IFWL_ThemeProvider;
19 
20 class CFWL_App final : public cppgc::GarbageCollected<CFWL_App> {
21  public:
22   class AdapterIface : public cppgc::GarbageCollectedMixin {
23    public:
24     virtual ~AdapterIface() = default;
25     virtual CFWL_WidgetMgr::AdapterIface* GetWidgetMgrAdapter() = 0;
26     virtual CFX_Timer::HandlerIface* GetTimerHandler() = 0;
27     virtual IFWL_ThemeProvider* GetThemeProvider() = 0;
28     virtual cppgc::Heap* GetHeap() = 0;
29   };
30 
31   CONSTRUCT_VIA_MAKE_GARBAGE_COLLECTED;
32   ~CFWL_App();
33 
34   void Trace(cppgc::Visitor* visitor) const;
35 
GetWidgetMgrAdapter()36   CFWL_WidgetMgr::AdapterIface* GetWidgetMgrAdapter() const {
37     return m_pAdapter->GetWidgetMgrAdapter();
38   }
GetTimerHandler()39   CFX_Timer::HandlerIface* GetTimerHandler() const {
40     return m_pAdapter->GetTimerHandler();
41   }
GetThemeProvider()42   IFWL_ThemeProvider* GetThemeProvider() const {
43     return m_pAdapter->GetThemeProvider();
44   }
GetHeap()45   cppgc::Heap* GetHeap() const { return m_pAdapter->GetHeap(); }
GetWidgetMgr()46   CFWL_WidgetMgr* GetWidgetMgr() const { return m_pWidgetMgr; }
GetNoteDriver()47   CFWL_NoteDriver* GetNoteDriver() const { return m_pNoteDriver; }
48 
49  private:
50   explicit CFWL_App(AdapterIface* pAdapter);
51 
52   cppgc::Member<AdapterIface> const m_pAdapter;
53   cppgc::Member<CFWL_WidgetMgr> m_pWidgetMgr;
54   cppgc::Member<CFWL_NoteDriver> m_pNoteDriver;
55 };
56 
57 #endif  // XFA_FWL_CFWL_APP_H_
58