Tue, 06 Jan 2015 21:39:09 +0100
Conditionally force memory storage according to privacy.thirdparty.isolate;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
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"
8 #include "nsServiceManagerUtils.h"
10 namespace mozilla {
11 namespace hal_impl {
13 void
14 EnableScreenConfigurationNotifications()
15 {
16 }
18 void
19 DisableScreenConfigurationNotifications()
20 {
21 }
23 void
24 GetCurrentScreenConfiguration(hal::ScreenConfiguration* aScreenConfiguration)
25 {
26 nsresult rv;
27 nsCOMPtr<nsIScreenManager> screenMgr =
28 do_GetService("@mozilla.org/gfx/screenmanager;1", &rv);
29 if (NS_FAILED(rv)) {
30 NS_ERROR("Can't find nsIScreenManager!");
31 return;
32 }
34 nsIntRect rect;
35 int32_t colorDepth, pixelDepth;
36 dom::ScreenOrientation orientation;
37 nsCOMPtr<nsIScreen> screen;
39 screenMgr->GetPrimaryScreen(getter_AddRefs(screen));
40 screen->GetRect(&rect.x, &rect.y, &rect.width, &rect.height);
41 screen->GetColorDepth(&colorDepth);
42 screen->GetPixelDepth(&pixelDepth);
43 orientation = rect.width >= rect.height
44 ? dom::eScreenOrientation_LandscapePrimary
45 : dom::eScreenOrientation_PortraitPrimary;
47 *aScreenConfiguration =
48 hal::ScreenConfiguration(rect, orientation, colorDepth, pixelDepth);
49 }
51 bool
52 LockScreenOrientation(const dom::ScreenOrientation& aOrientation)
53 {
54 return false;
55 }
57 void
58 UnlockScreenOrientation()
59 {
60 }
62 } // hal_impl
63 } // mozilla