widget/windows/winrt/UIABridgePrivate.h

Thu, 15 Jan 2015 15:59:08 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 15:59:08 +0100
branch
TOR_BUG_9701
changeset 10
ac0c01689b40
permissions
-rw-r--r--

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: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
michael@0 2 /* This Source Code Form is subject to the terms of the Mozilla Public
michael@0 3 * License, v. 2.0. If a copy of the MPL was not distributed with this
michael@0 4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
michael@0 5
michael@0 6 #pragma once
michael@0 7
michael@0 8 #include <windows.system.h>
michael@0 9 #include <windows.ui.core.h>
michael@0 10 #include <UIAutomation.h>
michael@0 11 #include <UIAutomationCore.h>
michael@0 12 #include <UIAutomationCoreApi.h>
michael@0 13
michael@0 14 #include "mozwrlbase.h"
michael@0 15
michael@0 16 #include "nsCOMPtr.h"
michael@0 17 #include "mozilla/a11y/Accessible.h"
michael@0 18 #include "UIAAccessibilityBridge.h"
michael@0 19
michael@0 20 // generated
michael@0 21 #include "UIABridge.h"
michael@0 22
michael@0 23 namespace mozilla {
michael@0 24 namespace widget {
michael@0 25 namespace winrt {
michael@0 26
michael@0 27 // represents the root window to UIA
michael@0 28 [uuid("D3EDD951-0715-4501-A8E5-25D97EF35D5A")]
michael@0 29 class UIABridge : public Microsoft::WRL::RuntimeClass<Microsoft::WRL::RuntimeClassFlags
michael@0 30 <Microsoft::WRL::RuntimeClassType::WinRtClassicComMix>,
michael@0 31 IUIABridge,
michael@0 32 IUIAElement,
michael@0 33 IRawElementProviderSimple,
michael@0 34 IRawElementProviderFragment,
michael@0 35 IRawElementProviderFragmentRoot>
michael@0 36 {
michael@0 37 typedef ABI::Windows::UI::Core::ICoreWindow ICoreWindow;
michael@0 38
michael@0 39 InspectableClass(L"IUIABridge", BaseTrust);
michael@0 40
michael@0 41 public:
michael@0 42 UIABridge() {}
michael@0 43
michael@0 44 // IUIABridge
michael@0 45 IFACEMETHODIMP Init(IInspectable* view, IInspectable* window, LONG_PTR inner);
michael@0 46 IFACEMETHODIMP Disconnect();
michael@0 47 IFACEMETHODIMP FocusChangeEvent();
michael@0 48
michael@0 49 // IUIAElement
michael@0 50 IFACEMETHODIMP SetFocusInternal(LONG_PTR aAccessible);
michael@0 51 IFACEMETHODIMP ClearFocus();
michael@0 52
michael@0 53 // IRawElementProviderFragmentRoot
michael@0 54 IFACEMETHODIMP ElementProviderFromPoint(double x, double y, IRawElementProviderFragment ** retVal);
michael@0 55 IFACEMETHODIMP GetFocus(IRawElementProviderFragment ** retVal);
michael@0 56
michael@0 57 // IRawElementProviderFragment
michael@0 58 IFACEMETHODIMP Navigate(NavigateDirection direction, IRawElementProviderFragment ** retVal);
michael@0 59 IFACEMETHODIMP GetRuntimeId(SAFEARRAY ** retVal);
michael@0 60 IFACEMETHODIMP get_BoundingRectangle(UiaRect * retVal);
michael@0 61 IFACEMETHODIMP GetEmbeddedFragmentRoots(SAFEARRAY ** retVal);
michael@0 62 IFACEMETHODIMP SetFocus();
michael@0 63 IFACEMETHODIMP get_FragmentRoot(IRawElementProviderFragmentRoot * * retVal);
michael@0 64
michael@0 65 // IRawElementProviderSimple
michael@0 66 IFACEMETHODIMP get_ProviderOptions(ProviderOptions * retVal);
michael@0 67 IFACEMETHODIMP GetPatternProvider(PATTERNID iid, IUnknown * * retVal);
michael@0 68 IFACEMETHODIMP GetPropertyValue(PROPERTYID idProp, VARIANT * retVal );
michael@0 69 IFACEMETHODIMP get_HostRawElementProvider(IRawElementProviderSimple ** retVal);
michael@0 70
michael@0 71 protected:
michael@0 72 bool Connected();
michael@0 73
michael@0 74 private:
michael@0 75 Microsoft::WRL::ComPtr<ICoreWindow> mWindow;
michael@0 76 #if defined(ACCESSIBILITY)
michael@0 77 nsRefPtr<AccessibilityBridge> mAccBridge;
michael@0 78 nsRefPtr<mozilla::a11y::Accessible> mAccessible;
michael@0 79 #endif
michael@0 80 };
michael@0 81
michael@0 82 [uuid("4438135F-F624-43DE-A417-275CE7A1A0CD")]
michael@0 83 class UIATextElement : public Microsoft::WRL::RuntimeClass<Microsoft::WRL::RuntimeClassFlags
michael@0 84 <Microsoft::WRL::RuntimeClassType::WinRtClassicComMix>,
michael@0 85 IUIAElement,
michael@0 86 IRawElementProviderSimple,
michael@0 87 IRawElementProviderFragment,
michael@0 88 ITextProvider,
michael@0 89 IValueProvider >
michael@0 90 {
michael@0 91 typedef ABI::Windows::Foundation::Rect Rect;
michael@0 92
michael@0 93 InspectableClass(L"UIATextElement", BaseTrust);
michael@0 94
michael@0 95 public:
michael@0 96 UIATextElement() {}
michael@0 97
michael@0 98 // IUIAElement
michael@0 99 IFACEMETHODIMP SetFocusInternal(LONG_PTR aAccessible);
michael@0 100 IFACEMETHODIMP ClearFocus();
michael@0 101 IFACEMETHODIMP FocusChangeEvent();
michael@0 102
michael@0 103 // IRawElementProviderFragment
michael@0 104 IFACEMETHODIMP Navigate(NavigateDirection direction, IRawElementProviderFragment ** retVal);
michael@0 105 IFACEMETHODIMP GetRuntimeId(SAFEARRAY ** retVal);
michael@0 106 IFACEMETHODIMP get_BoundingRectangle(UiaRect * retVal);
michael@0 107 IFACEMETHODIMP GetEmbeddedFragmentRoots(SAFEARRAY ** retVal);
michael@0 108 IFACEMETHODIMP SetFocus();
michael@0 109 IFACEMETHODIMP get_FragmentRoot(IRawElementProviderFragmentRoot * * retVal);
michael@0 110
michael@0 111 // IRawElementProviderSimple
michael@0 112 IFACEMETHODIMP get_ProviderOptions(ProviderOptions * retVal);
michael@0 113 IFACEMETHODIMP GetPatternProvider(PATTERNID iid, IUnknown * * retVal);
michael@0 114 IFACEMETHODIMP GetPropertyValue(PROPERTYID idProp, VARIANT * retVal );
michael@0 115 IFACEMETHODIMP get_HostRawElementProvider(IRawElementProviderSimple ** retVal);
michael@0 116
michael@0 117 // ITextProvider
michael@0 118 IFACEMETHODIMP GetSelection(SAFEARRAY * *pRetVal);
michael@0 119 IFACEMETHODIMP GetVisibleRanges(SAFEARRAY * *pRetVal);
michael@0 120 IFACEMETHODIMP RangeFromChild(IRawElementProviderSimple *childElement, ITextRangeProvider **pRetVal);
michael@0 121 IFACEMETHODIMP RangeFromPoint(UiaPoint point, ITextRangeProvider **pRetVal);
michael@0 122 IFACEMETHODIMP get_DocumentRange(ITextRangeProvider **pRetVal);
michael@0 123 IFACEMETHODIMP get_SupportedTextSelection(SupportedTextSelection *pRetVal);
michael@0 124
michael@0 125 // IValueProvider
michael@0 126 IFACEMETHODIMP SetValue(LPCWSTR val);
michael@0 127 IFACEMETHODIMP get_Value(BSTR *pRetVal);
michael@0 128 IFACEMETHODIMP get_IsReadOnly(BOOL *pRetVal);
michael@0 129
michael@0 130 void SetIndexID(int id) {
michael@0 131 mIndexID = id;
michael@0 132 }
michael@0 133
michael@0 134 private:
michael@0 135 int mIndexID;
michael@0 136 nsCOMPtr<nsIAccessible> mAccessItem;
michael@0 137 };
michael@0 138
michael@0 139 } } }

mercurial