|
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/. */ |
|
5 |
|
6 #pragma once |
|
7 |
|
8 #include "mozwrlbase.h" |
|
9 |
|
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> |
|
15 |
|
16 class MetroWidget; |
|
17 |
|
18 namespace mozilla { |
|
19 namespace widget { |
|
20 namespace winrt { |
|
21 |
|
22 class MetroApp : public Microsoft::WRL::RuntimeClass<ABI::Windows::ApplicationModel::Core::IFrameworkViewSource> |
|
23 { |
|
24 InspectableClass(L"MetroApp", TrustLevel::BaseTrust) |
|
25 |
|
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; |
|
31 |
|
32 public: |
|
33 // IFrameworkViewSource |
|
34 STDMETHODIMP CreateView(IFrameworkView **viewProvider); |
|
35 |
|
36 // ICoreApplication event |
|
37 HRESULT OnSuspending(IInspectable* aSender, ISuspendingEventArgs* aArgs); |
|
38 HRESULT OnResuming(IInspectable* aSender, IInspectable* aArgs); |
|
39 |
|
40 // nsIWinMetroUtils tile related async callbacks |
|
41 HRESULT OnAsyncTileCreated(ABI::Windows::Foundation::IAsyncOperation<bool>* aOperation, AsyncStatus aStatus); |
|
42 |
|
43 void Run(); |
|
44 void CoreExit(); |
|
45 void Shutdown(); |
|
46 void ActivateBaseView(); |
|
47 |
|
48 // Set when gecko enters xpcom shutdown. |
|
49 static bool sGeckoShuttingDown; |
|
50 |
|
51 // Shared pointers between framework and widget |
|
52 void SetWidget(MetroWidget* aPtr); |
|
53 |
|
54 static void PostSuspendResumeProcessNotification(bool aIsSuspend); |
|
55 static void PostSleepWakeNotification(bool aIsSuspend); |
|
56 |
|
57 private: |
|
58 EventRegistrationToken mSuspendEvent; |
|
59 EventRegistrationToken mResumeEvent; |
|
60 }; |
|
61 |
|
62 } } } |