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 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim:expandtab:shiftwidth=2:tabstop=2:
3 */
4 /* This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
8 #ifndef nsWinUtils_h_
9 #define nsWinUtils_h_
11 #include <windows.h>
13 #include "nsIDOMCSSStyleDeclaration.h"
14 #include "nsCOMPtr.h"
15 #include "nsRefPtrHashtable.h"
17 class nsIArray;
18 class nsIContent;
20 namespace mozilla {
21 namespace a11y {
23 class DocAccessible;
25 const LPCWSTR kClassNameRoot = L"MozillaUIWindowClass";
26 const LPCWSTR kClassNameTabContent = L"MozillaContentWindowClass";
28 class nsWinUtils
29 {
30 public:
31 /**
32 * Return computed styles declaration for the given node.
33 *
34 * @note Please use it carefully since it can shutdown the accessible tree
35 * you operate on.
36 */
37 static already_AddRefed<nsIDOMCSSStyleDeclaration>
38 GetComputedStyleDeclaration(nsIContent* aContent);
40 /**
41 * Start window emulation if presence of specific AT is detected.
42 */
43 static bool MaybeStartWindowEmulation();
45 /**
46 * Free resources used for window emulation.
47 */
48 static void ShutdownWindowEmulation();
50 /**
51 * Return true if window emulation is started.
52 */
53 static bool IsWindowEmulationStarted();
55 /**
56 * Helper to register window class.
57 */
58 static void RegisterNativeWindow(LPCWSTR aWindowClass);
60 /**
61 * Helper to create a window.
62 */
63 static HWND CreateNativeWindow(LPCWSTR aWindowClass, HWND aParentWnd,
64 int aX, int aY, int aWidth, int aHeight,
65 bool aIsActive);
67 /**
68 * Helper to show window.
69 */
70 static void ShowNativeWindow(HWND aWnd);
72 /**
73 * Helper to hide window.
74 */
75 static void HideNativeWindow(HWND aWnd);
77 /**
78 * Cache for HWNDs of windows created for document accessibles in windows
79 * emulation mode.
80 */
81 static nsRefPtrHashtable<nsPtrHashKey<void>, DocAccessible>* sHWNDCache;
82 };
84 } // namespace a11y
85 } // namespace mozilla
87 #endif