Line data Source code
1 : /* This Source Code Form is subject to the terms of the Mozilla Public
2 : * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 : * You can obtain one at http://mozilla.org/MPL/2.0/. */
4 :
5 : #ifndef WEBRTC_MODULES_DESKTOP_CAPTURE_DEVICE_INFO_H_
6 : #define WEBRTC_MODULES_DESKTOP_CAPTURE_DEVICE_INFO_H_
7 :
8 : #include <map>
9 : #include "webrtc/modules/desktop_capture/desktop_capture_types.h"
10 :
11 : namespace webrtc {
12 :
13 : class DesktopDisplayDevice {
14 : public:
15 : DesktopDisplayDevice();
16 : ~DesktopDisplayDevice();
17 :
18 : void setScreenId(const ScreenId screenId);
19 : void setDeviceName(const char *deviceNameUTF8);
20 : void setUniqueIdName(const char *deviceUniqueIdUTF8);
21 : void setPid(pid_t pid);
22 :
23 : ScreenId getScreenId();
24 : const char *getDeviceName();
25 : const char *getUniqueIdName();
26 : pid_t getPid();
27 :
28 : DesktopDisplayDevice& operator= (DesktopDisplayDevice& other);
29 :
30 : protected:
31 : ScreenId screenId_;
32 : char* deviceNameUTF8_;
33 : char* deviceUniqueIdUTF8_;
34 : pid_t pid_;
35 : };
36 :
37 : typedef std::map<intptr_t,DesktopDisplayDevice*> DesktopDisplayDeviceList;
38 :
39 : class DesktopApplication {
40 : public:
41 : DesktopApplication();
42 : ~DesktopApplication();
43 :
44 : void setProcessId(const ProcessId processId);
45 : void setProcessPathName(const char *appPathNameUTF8);
46 : void setUniqueIdName(const char *appUniqueIdUTF8);
47 : void setProcessAppName(const char *appNameUTF8);
48 : void setWindowCount(const uint32_t count);
49 :
50 : ProcessId getProcessId();
51 : const char *getProcessPathName();
52 : const char *getUniqueIdName();
53 : const char *getProcessAppName();
54 : uint32_t getWindowCount();
55 :
56 : DesktopApplication& operator= (DesktopApplication& other);
57 :
58 : protected:
59 : ProcessId processId_;
60 : char* processPathNameUTF8_;
61 : char* applicationNameUTF8_;
62 : char* processUniqueIdUTF8_;
63 : uint32_t windowCount_;
64 : };
65 :
66 : typedef std::map<intptr_t, DesktopApplication*> DesktopApplicationList;
67 :
68 0 : class DesktopDeviceInfo {
69 : public:
70 0 : virtual ~DesktopDeviceInfo() {};
71 :
72 : virtual int32_t Init() = 0;
73 : virtual int32_t Refresh() = 0;
74 : virtual int32_t getDisplayDeviceCount() = 0;
75 : virtual int32_t getDesktopDisplayDeviceInfo(int32_t nIndex,
76 : DesktopDisplayDevice & desktopDisplayDevice) = 0;
77 : virtual int32_t getWindowCount() = 0;
78 : virtual int32_t getWindowInfo(int32_t nindex,
79 : DesktopDisplayDevice &windowDevice) = 0;
80 : virtual int32_t getApplicationCount() = 0;
81 : virtual int32_t getApplicationInfo(int32_t nIndex,
82 : DesktopApplication & desktopApplication) = 0;
83 : };
84 :
85 : class DesktopDeviceInfoImpl : public DesktopDeviceInfo {
86 : public:
87 : DesktopDeviceInfoImpl();
88 : ~DesktopDeviceInfoImpl();
89 :
90 : virtual int32_t Init();
91 : virtual int32_t Refresh();
92 : virtual int32_t getDisplayDeviceCount();
93 : virtual int32_t getDesktopDisplayDeviceInfo(int32_t nIndex,
94 : DesktopDisplayDevice & desktopDisplayDevice);
95 : virtual int32_t getWindowCount();
96 : virtual int32_t getWindowInfo(int32_t nindex,
97 : DesktopDisplayDevice &windowDevice);
98 : virtual int32_t getApplicationCount();
99 : virtual int32_t getApplicationInfo(int32_t nIndex,
100 : DesktopApplication & desktopApplication);
101 :
102 : static DesktopDeviceInfo * Create();
103 : protected:
104 : DesktopDisplayDeviceList desktop_display_list_;
105 : DesktopDisplayDeviceList desktop_window_list_;
106 : DesktopApplicationList desktop_application_list_;
107 :
108 : void CleanUp();
109 : void CleanUpWindowList();
110 : void CleanUpApplicationList();
111 : void CleanUpScreenList();
112 :
113 : void InitializeWindowList();
114 : virtual void InitializeApplicationList() = 0;
115 : virtual void InitializeScreenList() = 0;
116 :
117 : void RefreshWindowList();
118 : void RefreshApplicationList();
119 : void RefreshScreenList();
120 :
121 : };
122 : };
123 :
124 : #endif
|