Thu, 15 Jan 2015 15:59:08 +0100
Implement a real Private Browsing Mode condition by changing the API/ABI;
This solves Tor bug #9701, complying with disk avoidance documented in
https://www.torproject.org/projects/torbrowser/design/#disk-avoidance.
michael@0 | 1 | /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- |
michael@0 | 2 | * |
michael@0 | 3 | * This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | #ifndef nsNativeThemeWin_h |
michael@0 | 8 | #define nsNativeThemeWin_h |
michael@0 | 9 | |
michael@0 | 10 | #include "nsITheme.h" |
michael@0 | 11 | #include "nsCOMPtr.h" |
michael@0 | 12 | #include "nsIAtom.h" |
michael@0 | 13 | #include "nsNativeTheme.h" |
michael@0 | 14 | #include "gfxTypes.h" |
michael@0 | 15 | #include <windows.h> |
michael@0 | 16 | #include "mozilla/TimeStamp.h" |
michael@0 | 17 | |
michael@0 | 18 | struct nsIntRect; |
michael@0 | 19 | struct nsIntSize; |
michael@0 | 20 | |
michael@0 | 21 | class nsNativeThemeWin : private nsNativeTheme, |
michael@0 | 22 | public nsITheme { |
michael@0 | 23 | public: |
michael@0 | 24 | typedef mozilla::TimeStamp TimeStamp; |
michael@0 | 25 | typedef mozilla::TimeDuration TimeDuration; |
michael@0 | 26 | |
michael@0 | 27 | NS_DECL_ISUPPORTS_INHERITED |
michael@0 | 28 | |
michael@0 | 29 | // The nsITheme interface. |
michael@0 | 30 | NS_IMETHOD DrawWidgetBackground(nsRenderingContext* aContext, |
michael@0 | 31 | nsIFrame* aFrame, |
michael@0 | 32 | uint8_t aWidgetType, |
michael@0 | 33 | const nsRect& aRect, |
michael@0 | 34 | const nsRect& aDirtyRect); |
michael@0 | 35 | |
michael@0 | 36 | NS_IMETHOD GetWidgetBorder(nsDeviceContext* aContext, |
michael@0 | 37 | nsIFrame* aFrame, |
michael@0 | 38 | uint8_t aWidgetType, |
michael@0 | 39 | nsIntMargin* aResult); |
michael@0 | 40 | |
michael@0 | 41 | virtual bool GetWidgetPadding(nsDeviceContext* aContext, |
michael@0 | 42 | nsIFrame* aFrame, |
michael@0 | 43 | uint8_t aWidgetType, |
michael@0 | 44 | nsIntMargin* aResult); |
michael@0 | 45 | |
michael@0 | 46 | virtual bool GetWidgetOverflow(nsDeviceContext* aContext, |
michael@0 | 47 | nsIFrame* aFrame, |
michael@0 | 48 | uint8_t aWidgetType, |
michael@0 | 49 | nsRect* aOverflowRect); |
michael@0 | 50 | |
michael@0 | 51 | NS_IMETHOD GetMinimumWidgetSize(nsRenderingContext* aContext, nsIFrame* aFrame, |
michael@0 | 52 | uint8_t aWidgetType, |
michael@0 | 53 | nsIntSize* aResult, |
michael@0 | 54 | bool* aIsOverridable); |
michael@0 | 55 | |
michael@0 | 56 | virtual Transparency GetWidgetTransparency(nsIFrame* aFrame, uint8_t aWidgetType); |
michael@0 | 57 | |
michael@0 | 58 | NS_IMETHOD WidgetStateChanged(nsIFrame* aFrame, uint8_t aWidgetType, |
michael@0 | 59 | nsIAtom* aAttribute, bool* aShouldRepaint); |
michael@0 | 60 | |
michael@0 | 61 | NS_IMETHOD ThemeChanged(); |
michael@0 | 62 | |
michael@0 | 63 | bool ThemeSupportsWidget(nsPresContext* aPresContext, |
michael@0 | 64 | nsIFrame* aFrame, |
michael@0 | 65 | uint8_t aWidgetType); |
michael@0 | 66 | |
michael@0 | 67 | bool WidgetIsContainer(uint8_t aWidgetType); |
michael@0 | 68 | |
michael@0 | 69 | bool ThemeDrawsFocusForWidget(uint8_t aWidgetType) MOZ_OVERRIDE; |
michael@0 | 70 | |
michael@0 | 71 | bool ThemeNeedsComboboxDropmarker(); |
michael@0 | 72 | |
michael@0 | 73 | virtual bool WidgetAppearanceDependsOnWindowFocus(uint8_t aWidgetType) MOZ_OVERRIDE; |
michael@0 | 74 | |
michael@0 | 75 | virtual bool ShouldHideScrollbars() MOZ_OVERRIDE; |
michael@0 | 76 | |
michael@0 | 77 | nsNativeThemeWin(); |
michael@0 | 78 | virtual ~nsNativeThemeWin(); |
michael@0 | 79 | |
michael@0 | 80 | protected: |
michael@0 | 81 | HANDLE GetTheme(uint8_t aWidgetType); |
michael@0 | 82 | nsresult GetThemePartAndState(nsIFrame* aFrame, uint8_t aWidgetType, |
michael@0 | 83 | int32_t& aPart, int32_t& aState); |
michael@0 | 84 | nsresult ClassicGetThemePartAndState(nsIFrame* aFrame, uint8_t aWidgetType, |
michael@0 | 85 | int32_t& aPart, int32_t& aState, bool& aFocused); |
michael@0 | 86 | nsresult ClassicDrawWidgetBackground(nsRenderingContext* aContext, |
michael@0 | 87 | nsIFrame* aFrame, |
michael@0 | 88 | uint8_t aWidgetType, |
michael@0 | 89 | const nsRect& aRect, |
michael@0 | 90 | const nsRect& aClipRect); |
michael@0 | 91 | nsresult ClassicGetWidgetBorder(nsDeviceContext* aContext, |
michael@0 | 92 | nsIFrame* aFrame, |
michael@0 | 93 | uint8_t aWidgetType, |
michael@0 | 94 | nsIntMargin* aResult); |
michael@0 | 95 | bool ClassicGetWidgetPadding(nsDeviceContext* aContext, |
michael@0 | 96 | nsIFrame* aFrame, |
michael@0 | 97 | uint8_t aWidgetType, |
michael@0 | 98 | nsIntMargin* aResult); |
michael@0 | 99 | nsresult ClassicGetMinimumWidgetSize(nsRenderingContext* aContext, nsIFrame* aFrame, |
michael@0 | 100 | uint8_t aWidgetType, |
michael@0 | 101 | nsIntSize* aResult, |
michael@0 | 102 | bool* aIsOverridable); |
michael@0 | 103 | bool ClassicThemeSupportsWidget(nsPresContext* aPresContext, |
michael@0 | 104 | nsIFrame* aFrame, |
michael@0 | 105 | uint8_t aWidgetType); |
michael@0 | 106 | void DrawCheckedRect(HDC hdc, const RECT& rc, int32_t fore, int32_t back, |
michael@0 | 107 | HBRUSH defaultBack); |
michael@0 | 108 | uint32_t GetWidgetNativeDrawingFlags(uint8_t aWidgetType); |
michael@0 | 109 | int32_t StandardGetState(nsIFrame* aFrame, uint8_t aWidgetType, bool wantFocused); |
michael@0 | 110 | bool IsMenuActive(nsIFrame* aFrame, uint8_t aWidgetType); |
michael@0 | 111 | RECT CalculateProgressOverlayRect(nsIFrame* aFrame, RECT* aWidgetRect, |
michael@0 | 112 | bool aIsVertical, bool aIsIndeterminate, |
michael@0 | 113 | bool aIsClassic); |
michael@0 | 114 | void DrawThemedProgressMeter(nsIFrame* aFrame, int aWidgetType, |
michael@0 | 115 | HANDLE aTheme, HDC aHdc, |
michael@0 | 116 | int aPart, int aState, |
michael@0 | 117 | RECT* aWidgetRect, RECT* aClipRect, |
michael@0 | 118 | gfxFloat aAppUnits); |
michael@0 | 119 | |
michael@0 | 120 | private: |
michael@0 | 121 | TimeStamp mProgressDeterminateTimeStamp; |
michael@0 | 122 | TimeStamp mProgressIndeterminateTimeStamp; |
michael@0 | 123 | }; |
michael@0 | 124 | |
michael@0 | 125 | #endif |