widget/windows/winrt/MetroApp.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.

     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 #pragma once
     8 #include "mozwrlbase.h"
    10 #include <windows.system.h>
    11 #include <windows.ui.core.h>
    12 #include <Windows.ApplicationModel.core.h>
    13 #include <Windows.ApplicationModel.h>
    14 #include <Windows.Applicationmodel.Activation.h>
    16 class MetroWidget;
    18 namespace mozilla {
    19 namespace widget {
    20 namespace winrt {
    22 class MetroApp : public Microsoft::WRL::RuntimeClass<ABI::Windows::ApplicationModel::Core::IFrameworkViewSource>
    23 {
    24   InspectableClass(L"MetroApp", TrustLevel::BaseTrust)
    26   typedef ABI::Windows::UI::Core::CoreDispatcherPriority CoreDispatcherPriority;
    27   typedef ABI::Windows::ApplicationModel::Activation::LaunchActivatedEventArgs LaunchActivatedEventArgs;
    28   typedef ABI::Windows::ApplicationModel::ISuspendingEventArgs ISuspendingEventArgs;
    29   typedef ABI::Windows::ApplicationModel::Core::IFrameworkView IFrameworkView;
    30   typedef ABI::Windows::ApplicationModel::Core::ICoreApplication ICoreApplication;
    32 public:
    33   // IFrameworkViewSource
    34   STDMETHODIMP CreateView(IFrameworkView **viewProvider);
    36   // ICoreApplication event
    37   HRESULT OnSuspending(IInspectable* aSender, ISuspendingEventArgs* aArgs);
    38   HRESULT OnResuming(IInspectable* aSender, IInspectable* aArgs);
    40   // nsIWinMetroUtils tile related async callbacks
    41   HRESULT OnAsyncTileCreated(ABI::Windows::Foundation::IAsyncOperation<bool>* aOperation, AsyncStatus aStatus);
    43   void Run();
    44   void CoreExit();
    45   void Shutdown();
    46   void ActivateBaseView();
    48   // Set when gecko enters xpcom shutdown.
    49   static bool sGeckoShuttingDown;
    51   // Shared pointers between framework and widget
    52   void SetWidget(MetroWidget* aPtr);
    54   static void PostSuspendResumeProcessNotification(bool aIsSuspend);
    55   static void PostSleepWakeNotification(bool aIsSuspend);
    57 private:
    58   EventRegistrationToken mSuspendEvent;
    59   EventRegistrationToken mResumeEvent;
    60 };
    62 } } }

mercurial