1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/plugins/ipc/hangui/PluginHangUIChild.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,113 @@ 1.4 +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 1.5 +/* vim: set ts=2 et sw=2 tw=80: */ 1.6 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.7 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.8 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.9 + 1.10 +#ifndef mozilla_plugins_PluginHangUIChild_h 1.11 +#define mozilla_plugins_PluginHangUIChild_h 1.12 + 1.13 +#include "MiniShmChild.h" 1.14 + 1.15 +#include <string> 1.16 + 1.17 +#include <windows.h> 1.18 + 1.19 +namespace mozilla { 1.20 +namespace plugins { 1.21 + 1.22 +/** 1.23 + * This class implements the plugin-hang-ui. 1.24 + * 1.25 + * NOTE: PluginHangUIChild is *not* an IPDL actor! In this case, "Child" 1.26 + * is describing the fact that plugin-hang-ui is a child process to the 1.27 + * firefox process, which is the PluginHangUIParent. 1.28 + * PluginHangUIParent and PluginHangUIChild are a matched pair. 1.29 + * @see PluginHangUIParent 1.30 + */ 1.31 +class PluginHangUIChild : public MiniShmObserver 1.32 +{ 1.33 +public: 1.34 + PluginHangUIChild(); 1.35 + virtual ~PluginHangUIChild(); 1.36 + 1.37 + bool 1.38 + Init(int aArgc, wchar_t* aArgv[]); 1.39 + 1.40 + /** 1.41 + * Displays the Plugin Hang UI and does not return until the UI has 1.42 + * been dismissed. 1.43 + * 1.44 + * @return true if the UI was displayed and the user response was 1.45 + * successfully sent back to the parent. Otherwise false. 1.46 + */ 1.47 + bool 1.48 + Show(); 1.49 + 1.50 + /** 1.51 + * Causes the calling thread to wait either for the Hang UI to be 1.52 + * dismissed or for the parent process to terminate. This should 1.53 + * be called by the main thread. 1.54 + * 1.55 + * @return true unless there was an error initiating the wait 1.56 + */ 1.57 + bool 1.58 + WaitForDismissal(); 1.59 + 1.60 + virtual void 1.61 + OnMiniShmEvent(MiniShmBase* aMiniShmObj) MOZ_OVERRIDE; 1.62 + 1.63 +private: 1.64 + bool 1.65 + RecvShow(); 1.66 + 1.67 + bool 1.68 + RecvCancel(); 1.69 + 1.70 + bool 1.71 + SetMainThread(); 1.72 + 1.73 + void 1.74 + ResizeButtons(); 1.75 + 1.76 + INT_PTR 1.77 + HangUIDlgProc(HWND aDlgHandle, UINT aMsgCode, WPARAM aWParam, LPARAM aLParam); 1.78 + 1.79 + static VOID CALLBACK 1.80 + ShowAPC(ULONG_PTR aContext); 1.81 + 1.82 + static INT_PTR CALLBACK 1.83 + SHangUIDlgProc(HWND aDlgHandle, UINT aMsgCode, WPARAM aWParam, 1.84 + LPARAM aLParam); 1.85 + 1.86 + static VOID CALLBACK 1.87 + SOnParentProcessExit(PVOID aObject, BOOLEAN aIsTimer); 1.88 + 1.89 + static PluginHangUIChild *sSelf; 1.90 + 1.91 + const wchar_t* mMessageText; 1.92 + const wchar_t* mWindowTitle; 1.93 + const wchar_t* mWaitBtnText; 1.94 + const wchar_t* mKillBtnText; 1.95 + const wchar_t* mNoFutureText; 1.96 + unsigned int mResponseBits; 1.97 + HWND mParentWindow; 1.98 + HWND mDlgHandle; 1.99 + HANDLE mMainThread; 1.100 + HANDLE mParentProcess; 1.101 + HANDLE mRegWaitProcess; 1.102 + DWORD mIPCTimeoutMs; 1.103 + MiniShmChild mMiniShm; 1.104 + 1.105 + static const int kExpectedMinimumArgc; 1.106 + 1.107 + typedef HRESULT (WINAPI *SETAPPUSERMODELID)(PCWSTR); 1.108 + 1.109 + DISALLOW_COPY_AND_ASSIGN(PluginHangUIChild); 1.110 +}; 1.111 + 1.112 +} // namespace plugins 1.113 +} // namespace mozilla 1.114 + 1.115 +#endif // mozilla_plugins_PluginHangUIChild_h 1.116 +