Bug 754472 - Implement multiple plugin click-to-play UI. r=jaws r=margaret r=dietrich
[gecko.git] / hal / fallback / FallbackScreenConfiguration.cpp
blobde9b66be09d5c3da8355796460b41791311adefd
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/. */
5 #include "Hal.h"
6 #include "mozilla/dom/ScreenOrientation.h"
7 #include "nsIScreenManager.h"
9 namespace mozilla {
10 namespace hal_impl {
12 void
13 EnableScreenConfigurationNotifications()
17 void
18 DisableScreenConfigurationNotifications()
22 void
23 GetCurrentScreenConfiguration(hal::ScreenConfiguration* aScreenConfiguration)
25 nsresult rv;
26 nsCOMPtr<nsIScreenManager> screenMgr =
27 do_GetService("@mozilla.org/gfx/screenmanager;1", &rv);
28 if (NS_FAILED(rv)) {
29 NS_ERROR("Can't find nsIScreenManager!");
30 return;
33 nsIntRect rect;
34 int32_t colorDepth, pixelDepth;
35 dom::ScreenOrientation orientation;
36 nsCOMPtr<nsIScreen> screen;
38 screenMgr->GetPrimaryScreen(getter_AddRefs(screen));
39 screen->GetRect(&rect.x, &rect.y, &rect.width, &rect.height);
40 screen->GetColorDepth(&colorDepth);
41 screen->GetPixelDepth(&pixelDepth);
42 orientation = rect.width >= rect.height
43 ? dom::eScreenOrientation_LandscapePrimary
44 : dom::eScreenOrientation_PortraitPrimary;
46 *aScreenConfiguration =
47 hal::ScreenConfiguration(rect, orientation, colorDepth, pixelDepth);
50 bool
51 LockScreenOrientation(const dom::ScreenOrientation& aOrientation)
53 return false;
56 void
57 UnlockScreenOrientation()
61 } // hal_impl
62 } // mozilla