widget/windows/winrt/UIAAccessibilityBridge.cpp

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.

     1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* This Source Code Form is subject to the terms of the Mozilla Public
     3  * License, v. 2.0. If a copy of the MPL was not distributed with this
     4  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     6 #if defined(ACCESSIBILITY)
     8 #include "UIAAccessibilityBridge.h"
     9 #include "MetroUtils.h"
    11 #include <OAIdl.h>
    13 #include "nsIAccessibleEvent.h"
    14 #include "nsIAccessibleEditableText.h"
    15 #include "nsIPersistentProperties2.h"
    17 // generated
    18 #include "UIABridge.h"
    20 #include <wrl/implements.h>
    22 using namespace mozilla::a11y;
    24 namespace mozilla {
    25 namespace widget {
    26 namespace winrt {
    28 using namespace Microsoft::WRL;
    30 NS_IMPL_ISUPPORTS(AccessibilityBridge, nsIObserver)
    32 nsresult
    33 AccessibilityBridge::Observe(nsISupports *aSubject, const char *aTopic, const char16_t *aData)
    34 {
    35   nsCOMPtr<nsIAccessibleEvent> ev = do_QueryInterface(aSubject);
    36   if (!ev) {
    37     return NS_OK;
    38   }
    40   uint32_t eventType = 0;
    41   ev->GetEventType(&eventType);
    42   if (eventType == nsIAccessibleEvent::EVENT_FOCUS) {
    43     Microsoft::WRL::ComPtr<IUIABridge> bridgePtr;
    44     mBridge.As(&bridgePtr);
    45     if (bridgePtr) {
    46       bridgePtr->FocusChangeEvent();
    47     }
    48   }
    50   return NS_OK;
    51 }
    53 } } }
    55 #endif // ACCESSIBILITY

mercurial