1 /* This Source Code Form is subject to the terms of the Mozilla Public 2 * License, v. 2.0. If a copy of the MPL was not distributed with this 3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 4 5 #ifndef mozilla_plugins_PluginWidgetParent_h 6 #define mozilla_plugins_PluginWidgetParent_h 7 8 #include "mozilla/plugins/PPluginWidgetParent.h" 9 #include "nsAutoPtr.h" 10 #include "nsIWidget.h" 11 #include "nsCOMPtr.h" 12 13 #if defined(MOZ_WIDGET_GTK) 14 class nsPluginNativeWindowGtk; 15 #endif 16 17 namespace mozilla { 18 19 namespace dom { 20 class TabParent; 21 } // namespace dom 22 23 namespace plugins { 24 25 class PluginWidgetParent : public PPluginWidgetParent 26 { 27 public: 28 PluginWidgetParent(); 29 virtual ~PluginWidgetParent(); 30 31 virtual void ActorDestroy(ActorDestroyReason aWhy) override; 32 virtual bool RecvCreate(nsresult* aResult, uint64_t* aScrollCaptureId, 33 uintptr_t* aPluginInstanceId) override; 34 virtual bool RecvSetFocus(const bool& aRaise) override; 35 virtual bool RecvGetNativePluginPort(uintptr_t* value) override; 36 bool RecvSetNativeChildWindow(const uintptr_t& aChildWindow) override; 37 38 // Helper for compositor checks on the channel ActorDestroyed()39 bool ActorDestroyed() { return !mWidget; } 40 41 // Called by PBrowser when it receives a Destroy() call from the child. 42 void ParentDestroy(); 43 44 // Sets mWidget's parent 45 void SetParent(nsIWidget* aParent); 46 47 private: 48 // The tab our connection is associated with. 49 mozilla::dom::TabParent* GetTabParent(); 50 51 private: 52 void KillWidget(); 53 54 // The chrome side native widget. 55 nsCOMPtr<nsIWidget> mWidget; 56 #if defined(MOZ_WIDGET_GTK) 57 nsAutoPtr<nsPluginNativeWindowGtk> mWrapper; 58 #endif 59 }; 60 61 } // namespace plugins 62 } // namespace mozilla 63 64 #endif // mozilla_plugins_PluginWidgetParent_h 65 66