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/. */
7 #ifndef mozilla_widget_ScreenManager_h
8 #define mozilla_widget_ScreenManager_h
10 #include "nsIScreenManager.h"
12 #include "mozilla/RefPtr.h"
13 #include "mozilla/UniquePtr.h"
14 #include "mozilla/widget/Screen.h"
22 } // namespace mozilla
27 class ScreenManager final
: public nsIScreenManager
{
31 virtual ~Helper() = default;
36 NS_DECL_NSISCREENMANAGER
38 static ScreenManager
& GetSingleton();
39 static already_AddRefed
<ScreenManager
> GetAddRefedSingleton();
41 void SetHelper(UniquePtr
<Helper
> aHelper
);
42 static void Refresh(nsTArray
<RefPtr
<Screen
>>&& aScreens
);
43 void Refresh(nsTArray
<mozilla::dom::ScreenDetails
>&& aScreens
);
44 void CopyScreensToRemote(mozilla::dom::ContentParent
* aContentParent
);
45 already_AddRefed
<Screen
> GetPrimaryScreen();
49 virtual ~ScreenManager();
51 void RefreshInternal(nsTArray
<RefPtr
<Screen
>>&& aScreens
);
52 template <class Range
>
53 void CopyScreensToRemoteRange(Range aRemoteRange
);
54 void CopyScreensToAllRemotesIfIsParent();
56 AutoTArray
<RefPtr
<Screen
>, 4> mScreenList
;
57 UniquePtr
<Helper
> mHelper
;
61 } // namespace mozilla
63 #endif // mozilla_widget_ScreenManager_h