Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 : /* This Source Code Form is subject to the terms of the Mozilla Public
4 : * License, v. 2.0. If a copy of the MPL was not distributed with this
5 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 :
7 : #ifndef mozilla_widget_ScreenManager_h
8 : #define mozilla_widget_ScreenManager_h
9 :
10 : #include "nsIScreenManager.h"
11 :
12 : #include "mozilla/RefPtr.h"
13 : #include "mozilla/UniquePtr.h"
14 : #include "mozilla/widget/Screen.h"
15 : #include "nsTArray.h"
16 :
17 : namespace mozilla {
18 : namespace dom {
19 : class ContentParent;
20 : class ScreenDetails;
21 : }
22 : }
23 :
24 : namespace mozilla {
25 : namespace widget {
26 :
27 : class ScreenManager final : public nsIScreenManager
28 : {
29 : public:
30 1 : class Helper
31 : {
32 : public:
33 0 : virtual ~Helper() {}
34 : };
35 :
36 : public:
37 : NS_DECL_ISUPPORTS
38 : NS_DECL_NSISCREENMANAGER
39 :
40 : static ScreenManager& GetSingleton();
41 : static already_AddRefed<ScreenManager> GetAddRefedSingleton();
42 :
43 : void SetHelper(UniquePtr<Helper> aHelper);
44 : void Refresh(nsTArray<RefPtr<Screen>>&& aScreens);
45 : void Refresh(nsTArray<mozilla::dom::ScreenDetails>&& aScreens);
46 : void CopyScreensToRemote(mozilla::dom::ContentParent* aContentParent);
47 :
48 : private:
49 : ScreenManager();
50 : virtual ~ScreenManager();
51 :
52 : template<class Range>
53 : void CopyScreensToRemoteRange(Range aRemoteRange);
54 : void CopyScreensToAllRemotesIfIsParent();
55 :
56 : AutoTArray<RefPtr<Screen>, 4> mScreenList;
57 : UniquePtr<Helper> mHelper;
58 : };
59 :
60 :
61 : } // namespace widget
62 : } // namespace mozilla
63 :
64 : #endif // mozilla_widget_ScreenManager_h
|