dom/plugins/ipc/hangui/PluginHangUIChild.h

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
     2 /* vim: set ts=2 et sw=2 tw=80: */
     3 /* This Source Code Form is subject to the terms of the Mozilla Public
     4  * License, v. 2.0. If a copy of the MPL was not distributed with this
     5  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     7 #ifndef mozilla_plugins_PluginHangUIChild_h
     8 #define mozilla_plugins_PluginHangUIChild_h
    10 #include "MiniShmChild.h"
    12 #include <string>
    14 #include <windows.h>
    16 namespace mozilla {
    17 namespace plugins {
    19 /**
    20  * This class implements the plugin-hang-ui.
    21  *
    22  * NOTE: PluginHangUIChild is *not* an IPDL actor! In this case, "Child" 
    23  *       is describing the fact that plugin-hang-ui is a child process to the 
    24  *       firefox process, which is the PluginHangUIParent.
    25  *       PluginHangUIParent and PluginHangUIChild are a matched pair.
    26  * @see PluginHangUIParent
    27  */
    28 class PluginHangUIChild : public MiniShmObserver
    29 {
    30 public:
    31   PluginHangUIChild();
    32   virtual ~PluginHangUIChild();
    34   bool
    35   Init(int aArgc, wchar_t* aArgv[]);
    37   /**
    38    * Displays the Plugin Hang UI and does not return until the UI has 
    39    * been dismissed.
    40    *
    41    * @return true if the UI was displayed and the user response was 
    42    *         successfully sent back to the parent. Otherwise false.
    43    */
    44   bool
    45   Show();
    47   /**
    48    * Causes the calling thread to wait either for the Hang UI to be 
    49    * dismissed or for the parent process to terminate. This should 
    50    * be called by the main thread.
    51    *
    52    * @return true unless there was an error initiating the wait
    53    */
    54   bool
    55   WaitForDismissal();
    57   virtual void
    58   OnMiniShmEvent(MiniShmBase* aMiniShmObj) MOZ_OVERRIDE;
    60 private:
    61   bool
    62   RecvShow();
    64   bool
    65   RecvCancel();
    67   bool
    68   SetMainThread();
    70   void
    71   ResizeButtons();
    73   INT_PTR
    74   HangUIDlgProc(HWND aDlgHandle, UINT aMsgCode, WPARAM aWParam, LPARAM aLParam);
    76   static VOID CALLBACK
    77   ShowAPC(ULONG_PTR aContext);
    79   static INT_PTR CALLBACK
    80   SHangUIDlgProc(HWND aDlgHandle, UINT aMsgCode, WPARAM aWParam,
    81                  LPARAM aLParam);
    83   static VOID CALLBACK
    84   SOnParentProcessExit(PVOID aObject, BOOLEAN aIsTimer);
    86   static PluginHangUIChild *sSelf;
    88   const wchar_t* mMessageText;
    89   const wchar_t* mWindowTitle;
    90   const wchar_t* mWaitBtnText;
    91   const wchar_t* mKillBtnText;
    92   const wchar_t* mNoFutureText;
    93   unsigned int mResponseBits;
    94   HWND mParentWindow;
    95   HWND mDlgHandle;
    96   HANDLE mMainThread;
    97   HANDLE mParentProcess;
    98   HANDLE mRegWaitProcess;
    99   DWORD mIPCTimeoutMs;
   100   MiniShmChild mMiniShm;
   102   static const int kExpectedMinimumArgc;
   104   typedef HRESULT (WINAPI *SETAPPUSERMODELID)(PCWSTR);
   106   DISALLOW_COPY_AND_ASSIGN(PluginHangUIChild);
   107 };
   109 } // namespace plugins
   110 } // namespace mozilla
   112 #endif // mozilla_plugins_PluginHangUIChild_h

mercurial