LCOV - code coverage report
Current view: top level - dom/ipc - TabParent.h (source / functions) Hit Total Coverage
Test: output.info Lines: 9 25 36.0 %
Date: 2017-07-14 16:53:18 Functions: 6 11 54.5 %
Legend: Lines: hit not hit

          Line data    Source code
       1             : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
       2             : /* vim: set ts=8 sts=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/. */
       6             : 
       7             : #ifndef mozilla_tabs_TabParent_h
       8             : #define mozilla_tabs_TabParent_h
       9             : 
      10             : #include "js/TypeDecls.h"
      11             : #include "LiveResizeListener.h"
      12             : #include "mozilla/ContentCache.h"
      13             : #include "mozilla/dom/AudioChannelBinding.h"
      14             : #include "mozilla/dom/ipc/IdType.h"
      15             : #include "mozilla/dom/PBrowserParent.h"
      16             : #include "mozilla/dom/PContent.h"
      17             : #include "mozilla/dom/PFilePickerParent.h"
      18             : #include "mozilla/dom/TabContext.h"
      19             : #include "mozilla/EventForwards.h"
      20             : #include "mozilla/dom/File.h"
      21             : #include "mozilla/layers/CompositorBridgeParent.h"
      22             : #include "mozilla/RefPtr.h"
      23             : #include "mozilla/Move.h"
      24             : #include "nsCOMPtr.h"
      25             : #include "nsIAuthPromptProvider.h"
      26             : #include "nsIBrowserDOMWindow.h"
      27             : #include "nsIDOMEventListener.h"
      28             : #include "nsIKeyEventInPluginCallback.h"
      29             : #include "nsISecureBrowserUI.h"
      30             : #include "nsITabParent.h"
      31             : #include "nsIWebBrowserPersistable.h"
      32             : #include "nsIXULBrowserWindow.h"
      33             : #include "nsRefreshDriver.h"
      34             : #include "nsWeakReference.h"
      35             : #include "Units.h"
      36             : #include "nsIWidget.h"
      37             : #include "nsIPartialSHistory.h"
      38             : 
      39             : class nsFrameLoader;
      40             : class nsIFrameLoader;
      41             : class nsIContent;
      42             : class nsIPrincipal;
      43             : class nsIURI;
      44             : class nsILoadContext;
      45             : class nsIDocShell;
      46             : 
      47             : namespace mozilla {
      48             : 
      49             : namespace a11y {
      50             : class DocAccessibleParent;
      51             : }
      52             : 
      53             : namespace jsipc {
      54             : class CpowHolder;
      55             : } // namespace jsipc
      56             : 
      57             : namespace layers {
      58             : struct TextureFactoryIdentifier;
      59             : } // namespace layers
      60             : 
      61             : namespace layout {
      62             : class RenderFrameParent;
      63             : } // namespace layout
      64             : 
      65             : namespace widget {
      66             : struct IMENotification;
      67             : } // namespace widget
      68             : 
      69             : namespace gfx {
      70             : class SourceSurface;
      71             : class DataSourceSurface;
      72             : } // namespace gfx
      73             : 
      74             : namespace dom {
      75             : 
      76             : class ClonedMessageData;
      77             : class nsIContentParent;
      78             : class Element;
      79             : class DataTransfer;
      80             : 
      81             : namespace ipc {
      82             : class StructuredCloneData;
      83             : } // ipc namespace
      84             : 
      85             : class TabParent final : public PBrowserParent
      86             :                       , public nsIDOMEventListener
      87             :                       , public nsITabParent
      88             :                       , public nsIAuthPromptProvider
      89             :                       , public nsISecureBrowserUI
      90             :                       , public nsIKeyEventInPluginCallback
      91             :                       , public nsSupportsWeakReference
      92             :                       , public TabContext
      93             :                       , public nsIWebBrowserPersistable
      94             :                       , public LiveResizeListener
      95             : {
      96             :   typedef mozilla::dom::ClonedMessageData ClonedMessageData;
      97             : 
      98             :   virtual ~TabParent();
      99             : 
     100             : public:
     101             :   // Helper class for ContentParent::RecvCreateWindow.
     102             :   struct AutoUseNewTab;
     103             : 
     104             :   // nsITabParent
     105             :   NS_DECL_NSITABPARENT
     106             :   // nsIDOMEventListener interfaces
     107             :   NS_DECL_NSIDOMEVENTLISTENER
     108             : 
     109             :   TabParent(nsIContentParent* aManager,
     110             :             const TabId& aTabId,
     111             :             const TabContext& aContext,
     112             :             uint32_t aChromeFlags);
     113             : 
     114           4 :   Element* GetOwnerElement() const { return mFrameElement; }
     115             :   already_AddRefed<nsPIDOMWindowOuter> GetParentWindowOuter();
     116             : 
     117             :   void SetOwnerElement(Element* aElement);
     118             : 
     119             :   void CacheFrameLoader(nsFrameLoader* aFrameLoader);
     120             : 
     121           0 :   nsIBrowserDOMWindow *GetBrowserDOMWindow() const { return mBrowserDOMWindow; }
     122             : 
     123           1 :   void SetBrowserDOMWindow(nsIBrowserDOMWindow* aBrowserDOMWindow)
     124             :   {
     125           1 :     mBrowserDOMWindow = aBrowserDOMWindow;
     126           1 :   }
     127             : 
     128             :   void SetHasContentOpener(bool aHasContentOpener);
     129             : 
     130           0 :   void SwapFrameScriptsFrom(nsTArray<FrameScriptInfo>& aFrameScripts)
     131             :   {
     132           0 :     aFrameScripts.SwapElements(mDelayedFrameScripts);
     133           0 :   }
     134             : 
     135             :   already_AddRefed<nsILoadContext> GetLoadContext();
     136             : 
     137             :   already_AddRefed<nsIWidget> GetTopLevelWidget();
     138             : 
     139             :   nsIXULBrowserWindow* GetXULBrowserWindow();
     140             : 
     141             :   void Destroy();
     142             : 
     143             :   void RemoveWindowListeners();
     144             : 
     145             :   void AddWindowListeners();
     146             : 
     147             :   virtual mozilla::ipc::IPCResult RecvMoveFocus(const bool& aForward,
     148             :                                                 const bool& aForDocumentNavigation) override;
     149             : 
     150             :   virtual mozilla::ipc::IPCResult RecvSizeShellTo(const uint32_t& aFlags,
     151             :                                                   const int32_t& aWidth,
     152             :                                                   const int32_t& aHeight,
     153             :                                                   const int32_t& aShellItemWidth,
     154             :                                                   const int32_t& aShellItemHeight) override;
     155             : 
     156             :   virtual mozilla::ipc::IPCResult RecvDropLinks(nsTArray<nsString>&& aLinks) override;
     157             : 
     158             :   virtual mozilla::ipc::IPCResult RecvEvent(const RemoteDOMEvent& aEvent) override;
     159             : 
     160             :   virtual mozilla::ipc::IPCResult RecvReplyKeyEvent(const WidgetKeyboardEvent& aEvent) override;
     161             : 
     162             :   virtual mozilla::ipc::IPCResult
     163             :   RecvAccessKeyNotHandled(const WidgetKeyboardEvent& aEvent) override;
     164             : 
     165             :   virtual mozilla::ipc::IPCResult
     166             :   RecvSetHasBeforeUnload(const bool& aHasBeforeUnload) override;
     167             : 
     168             :   virtual mozilla::ipc::IPCResult
     169             :   RecvBrowserFrameOpenWindow(PBrowserParent* aOpener,
     170             :                              PRenderFrameParent* aRenderFrame,
     171             :                              const nsString& aURL,
     172             :                              const nsString& aName,
     173             :                              const nsString& aFeatures,
     174             :                              BrowserFrameOpenWindowResolver&& aResolve) override;
     175             : 
     176             :   virtual mozilla::ipc::IPCResult
     177             :   RecvSyncMessage(const nsString& aMessage,
     178             :                   const ClonedMessageData& aData,
     179             :                   InfallibleTArray<CpowEntry>&& aCpows,
     180             :                   const IPC::Principal& aPrincipal,
     181             :                   nsTArray<ipc::StructuredCloneData>* aRetVal) override;
     182             : 
     183             :   virtual mozilla::ipc::IPCResult
     184             :   RecvRpcMessage(const nsString& aMessage,
     185             :                  const ClonedMessageData& aData,
     186             :                  InfallibleTArray<CpowEntry>&& aCpows,
     187             :                  const IPC::Principal& aPrincipal,
     188             :                  nsTArray<ipc::StructuredCloneData>* aRetVal) override;
     189             : 
     190             :   virtual mozilla::ipc::IPCResult RecvAsyncMessage(const nsString& aMessage,
     191             :                                                    InfallibleTArray<CpowEntry>&& aCpows,
     192             :                                                    const IPC::Principal& aPrincipal,
     193             :                                                    const ClonedMessageData& aData) override;
     194             : 
     195             :   virtual mozilla::ipc::IPCResult
     196             :   RecvNotifyIMEFocus(const ContentCache& aContentCache,
     197             :                      const widget::IMENotification& aEventMessage,
     198             :                      widget::IMENotificationRequests* aRequests) override;
     199             : 
     200             :   virtual mozilla::ipc::IPCResult
     201             :   RecvNotifyIMETextChange(const ContentCache& aContentCache,
     202             :                           const widget::IMENotification& aEventMessage) override;
     203             : 
     204             :   virtual mozilla::ipc::IPCResult
     205             :   RecvNotifyIMECompositionUpdate(const ContentCache& aContentCache,
     206             :                                  const widget::IMENotification& aEventMessage) override;
     207             : 
     208             :   virtual mozilla::ipc::IPCResult
     209             :   RecvNotifyIMESelection(const ContentCache& aContentCache,
     210             :                          const widget::IMENotification& aEventMessage) override;
     211             : 
     212             :   virtual mozilla::ipc::IPCResult
     213             :   RecvUpdateContentCache(const ContentCache& aContentCache) override;
     214             : 
     215             :   virtual mozilla::ipc::IPCResult
     216             :   RecvNotifyIMEMouseButtonEvent(const widget::IMENotification& aEventMessage,
     217             :                                 bool* aConsumedByIME) override;
     218             : 
     219             :   virtual mozilla::ipc::IPCResult
     220             :   RecvNotifyIMEPositionChange(const ContentCache& aContentCache,
     221             :                               const widget::IMENotification& aEventMessage) override;
     222             : 
     223             :   virtual mozilla::ipc::IPCResult
     224             :   RecvOnEventNeedingAckHandled(const EventMessage& aMessage) override;
     225             : 
     226             :   virtual mozilla::ipc::IPCResult
     227             :   RecvRequestIMEToCommitComposition(const bool& aCancel,
     228             :                                     bool* aIsCommitted,
     229             :                                     nsString* aCommittedString) override;
     230             : 
     231             :   virtual mozilla::ipc::IPCResult
     232             :   RecvStartPluginIME(const WidgetKeyboardEvent& aKeyboardEvent,
     233             :                      const int32_t& aPanelX,
     234             :                      const int32_t& aPanelY,
     235             :                      nsString* aCommitted) override;
     236             : 
     237             :   virtual mozilla::ipc::IPCResult RecvSetPluginFocused(const bool& aFocused) override;
     238             : 
     239             :   virtual mozilla::ipc::IPCResult RecvSetCandidateWindowForPlugin(
     240             :     const widget::CandidateWindowPosition& aPosition) override;
     241             : 
     242             :   virtual mozilla::ipc::IPCResult
     243             :   RecvDefaultProcOfPluginEvent(const WidgetPluginEvent& aEvent) override;
     244             : 
     245             :   virtual mozilla::ipc::IPCResult RecvGetInputContext(int32_t* aIMEEnabled,
     246             :                                                       int32_t* aIMEOpen) override;
     247             : 
     248             :   virtual mozilla::ipc::IPCResult RecvSetInputContext(const int32_t& aIMEEnabled,
     249             :                                                       const int32_t& aIMEOpen,
     250             :                                                       const nsString& aType,
     251             :                                                       const nsString& aInputmode,
     252             :                                                       const nsString& aActionHint,
     253             :                                                       const int32_t& aCause,
     254             :                                                       const int32_t& aFocusChange) override;
     255             : 
     256             : 
     257             :   // See nsIKeyEventInPluginCallback
     258             :   virtual void HandledWindowedPluginKeyEvent(
     259             :                  const NativeEventData& aKeyEventData,
     260             :                  bool aIsConsumed) override;
     261             : 
     262             :   virtual mozilla::ipc::IPCResult RecvOnWindowedPluginKeyEvent(
     263             :     const NativeEventData& aKeyEventData) override;
     264             : 
     265             :   virtual mozilla::ipc::IPCResult RecvRequestFocus(const bool& aCanRaise) override;
     266             : 
     267             :   virtual mozilla::ipc::IPCResult RecvLookUpDictionary(
     268             :     const nsString& aText,
     269             :     nsTArray<mozilla::FontRange>&& aFontRangeArray,
     270             :     const bool& aIsVertical,
     271             :     const LayoutDeviceIntPoint& aPoint) override;
     272             : 
     273             :   virtual mozilla::ipc::IPCResult
     274             :   RecvEnableDisableCommands(const nsString& aAction,
     275             :                             nsTArray<nsCString>&& aEnabledCommands,
     276             :                             nsTArray<nsCString>&& aDisabledCommands) override;
     277             : 
     278             :   virtual mozilla::ipc::IPCResult
     279             :   RecvSetCursor(const uint32_t& aValue, const bool& aForce) override;
     280             : 
     281             :   virtual mozilla::ipc::IPCResult RecvSetCustomCursor(const nsCString& aUri,
     282             :                                                       const uint32_t& aWidth,
     283             :                                                       const uint32_t& aHeight,
     284             :                                                       const uint32_t& aStride,
     285             :                                                       const uint8_t& aFormat,
     286             :                                                       const uint32_t& aHotspotX,
     287             :                                                       const uint32_t& aHotspotY,
     288             :                                                       const bool& aForce) override;
     289             : 
     290             :   virtual mozilla::ipc::IPCResult RecvSetStatus(const uint32_t& aType,
     291             :                                                 const nsString& aStatus) override;
     292             : 
     293             :   virtual mozilla::ipc::IPCResult RecvIsParentWindowMainWidgetVisible(bool* aIsVisible) override;
     294             : 
     295             :   virtual mozilla::ipc::IPCResult RecvShowTooltip(const uint32_t& aX,
     296             :                                                   const uint32_t& aY,
     297             :                                                   const nsString& aTooltip,
     298             :                                                   const nsString& aDirection) override;
     299             : 
     300             :   virtual mozilla::ipc::IPCResult RecvHideTooltip() override;
     301             : 
     302             :   virtual mozilla::ipc::IPCResult RecvGetDPI(float* aValue) override;
     303             : 
     304             :   virtual mozilla::ipc::IPCResult RecvGetDefaultScale(double* aValue) override;
     305             : 
     306             :   virtual mozilla::ipc::IPCResult RecvGetWidgetRounding(int32_t* aValue) override;
     307             : 
     308             :   virtual mozilla::ipc::IPCResult RecvSetNativeChildOfShareableWindow(const uintptr_t& childWindow) override;
     309             : 
     310             :   virtual mozilla::ipc::IPCResult RecvDispatchFocusToTopLevelWindow() override;
     311             : 
     312             :   virtual mozilla::ipc::IPCResult RecvRespondStartSwipeEvent(const uint64_t& aInputBlockId,
     313             :                                                              const bool& aStartSwipe) override;
     314             : 
     315             :   virtual mozilla::ipc::IPCResult
     316             :   RecvDispatchWheelEvent(const mozilla::WidgetWheelEvent& aEvent) override;
     317             : 
     318             :   virtual mozilla::ipc::IPCResult
     319             :   RecvDispatchMouseEvent(const mozilla::WidgetMouseEvent& aEvent) override;
     320             : 
     321             :   virtual mozilla::ipc::IPCResult
     322             :   RecvDispatchKeyboardEvent(const mozilla::WidgetKeyboardEvent& aEvent) override;
     323             : 
     324             :   virtual PColorPickerParent*
     325             :   AllocPColorPickerParent(const nsString& aTitle,
     326             :                           const nsString& aInitialColor) override;
     327             : 
     328             :   virtual bool
     329             :   DeallocPColorPickerParent(PColorPickerParent* aColorPicker) override;
     330             : 
     331             :   virtual PDocAccessibleParent*
     332             :   AllocPDocAccessibleParent(PDocAccessibleParent*, const uint64_t&,
     333             :                             const uint32_t&, const IAccessibleHolder&) override;
     334             : 
     335             :   virtual bool DeallocPDocAccessibleParent(PDocAccessibleParent*) override;
     336             : 
     337             :   virtual mozilla::ipc::IPCResult
     338             :   RecvPDocAccessibleConstructor(PDocAccessibleParent* aDoc,
     339             :                                 PDocAccessibleParent* aParentDoc,
     340             :                                 const uint64_t& aParentID,
     341             :                                 const uint32_t& aMsaaID,
     342             :                                 const IAccessibleHolder& aDocCOMProxy) override;
     343             : 
     344             :   /**
     345             :    * Return the top level doc accessible parent for this tab.
     346             :    */
     347             :   a11y::DocAccessibleParent* GetTopLevelDocAccessible() const;
     348             : 
     349             :   void LoadURL(nsIURI* aURI);
     350             : 
     351             :   void InitRenderFrame();
     352             : 
     353             :   // XXX/cjones: it's not clear what we gain by hiding these
     354             :   // message-sending functions under a layer of indirection and
     355             :   // eating the return values
     356             :   void Show(const ScreenIntSize& aSize, bool aParentIsActive);
     357             : 
     358             :   void UpdateDimensions(const nsIntRect& aRect, const ScreenIntSize& aSize);
     359             : 
     360             :   DimensionInfo GetDimensionInfo();
     361             : 
     362             :   void SizeModeChanged(const nsSizeMode& aSizeMode);
     363             : 
     364             :   void UIResolutionChanged();
     365             : 
     366             :   void ThemeChanged();
     367             : 
     368             :   void HandleAccessKey(const WidgetKeyboardEvent& aEvent,
     369             :                        nsTArray<uint32_t>& aCharCodes,
     370             :                        const int32_t& aModifierMask);
     371             : 
     372             :   void Activate();
     373             : 
     374             :   void Deactivate();
     375             : 
     376             :   bool MapEventCoordinatesForChildProcess(mozilla::WidgetEvent* aEvent);
     377             : 
     378             :   void MapEventCoordinatesForChildProcess(const LayoutDeviceIntPoint& aOffset,
     379             :                                           mozilla::WidgetEvent* aEvent);
     380             : 
     381             :   LayoutDeviceToCSSScale GetLayoutDeviceToCSSScale();
     382             : 
     383             :   virtual mozilla::ipc::IPCResult
     384             :   RecvRequestNativeKeyBindings(
     385             :     const uint32_t& aType,
     386             :     const mozilla::WidgetKeyboardEvent& aEvent,
     387             :     nsTArray<mozilla::CommandInt>* aCommands) override;
     388             : 
     389             :   virtual mozilla::ipc::IPCResult
     390             :   RecvSynthesizeNativeKeyEvent(const int32_t& aNativeKeyboardLayout,
     391             :                                const int32_t& aNativeKeyCode,
     392             :                                const uint32_t& aModifierFlags,
     393             :                                const nsString& aCharacters,
     394             :                                const nsString& aUnmodifiedCharacters,
     395             :                                const uint64_t& aObserverId) override;
     396             : 
     397             :   virtual mozilla::ipc::IPCResult
     398             :   RecvSynthesizeNativeMouseEvent(const LayoutDeviceIntPoint& aPoint,
     399             :                                  const uint32_t& aNativeMessage,
     400             :                                  const uint32_t& aModifierFlags,
     401             :                                  const uint64_t& aObserverId) override;
     402             : 
     403             :   virtual mozilla::ipc::IPCResult
     404             :   RecvSynthesizeNativeMouseMove(const LayoutDeviceIntPoint& aPoint,
     405             :                                 const uint64_t& aObserverId) override;
     406             : 
     407             :   virtual mozilla::ipc::IPCResult
     408             :   RecvSynthesizeNativeMouseScrollEvent(const LayoutDeviceIntPoint& aPoint,
     409             :                                        const uint32_t& aNativeMessage,
     410             :                                        const double& aDeltaX,
     411             :                                        const double& aDeltaY,
     412             :                                        const double& aDeltaZ,
     413             :                                        const uint32_t& aModifierFlags,
     414             :                                        const uint32_t& aAdditionalFlags,
     415             :                                        const uint64_t& aObserverId) override;
     416             : 
     417             :   virtual mozilla::ipc::IPCResult
     418             :   RecvSynthesizeNativeTouchPoint(const uint32_t& aPointerId,
     419             :                                  const TouchPointerState& aPointerState,
     420             :                                  const LayoutDeviceIntPoint& aPoint,
     421             :                                  const double& aPointerPressure,
     422             :                                  const uint32_t& aPointerOrientation,
     423             :                                  const uint64_t& aObserverId) override;
     424             : 
     425             :   virtual mozilla::ipc::IPCResult
     426             :   RecvSynthesizeNativeTouchTap(const LayoutDeviceIntPoint& aPoint,
     427             :                                const bool& aLongTap,
     428             :                                const uint64_t& aObserverId) override;
     429             : 
     430             :   virtual mozilla::ipc::IPCResult
     431             :   RecvClearNativeTouchSequence(const uint64_t& aObserverId) override;
     432             : 
     433             :   void SendMouseEvent(const nsAString& aType, float aX, float aY,
     434             :                       int32_t aButton, int32_t aClickCount,
     435             :                       int32_t aModifiers, bool aIgnoreRootScrollFrame);
     436             : 
     437             :   void SendKeyEvent(const nsAString& aType, int32_t aKeyCode,
     438             :                     int32_t aCharCode, int32_t aModifiers,
     439             :                     bool aPreventDefault);
     440             : 
     441             :   /**
     442             :    * The following Send*Event() marks aEvent as posted to remote process if
     443             :    * it succeeded.  So, you can check the result with
     444             :    * aEvent.HasBeenPostedToRemoteProcess().
     445             :    */
     446             :   void SendRealMouseEvent(WidgetMouseEvent& aEvent);
     447             : 
     448             :   void SendRealDragEvent(WidgetDragEvent& aEvent,
     449             :                          uint32_t aDragAction,
     450             :                          uint32_t aDropEffect);
     451             : 
     452             :   void SendMouseWheelEvent(WidgetWheelEvent& aEvent);
     453             : 
     454             :   void SendRealKeyEvent(WidgetKeyboardEvent& aEvent);
     455             : 
     456             :   void SendRealTouchEvent(WidgetTouchEvent& aEvent);
     457             : 
     458             :   void SendPluginEvent(WidgetPluginEvent& aEvent);
     459             : 
     460             :   /**
     461             :    * Different from above Send*Event(), these methods return true if the
     462             :    * event has been posted to the remote process or failed to do that but
     463             :    * shouldn't be handled by following event listeners.
     464             :    * If you need to check if it's actually posted to the remote process,
     465             :    * you can refer aEvent.HasBeenPostedToRemoteProcess().
     466             :    */
     467             :   bool SendCompositionEvent(mozilla::WidgetCompositionEvent& aEvent);
     468             : 
     469             :   bool SendSelectionEvent(mozilla::WidgetSelectionEvent& aEvent);
     470             : 
     471             :   bool SendHandleTap(TapType aType,
     472             :                      const LayoutDevicePoint& aPoint,
     473             :                      Modifiers aModifiers,
     474             :                      const ScrollableLayerGuid& aGuid,
     475             :                      uint64_t aInputBlockId);
     476             : 
     477             :   virtual PDocumentRendererParent*
     478             :   AllocPDocumentRendererParent(const nsRect& documentRect,
     479             :                                const gfx::Matrix& transform,
     480             :                                const nsString& bgcolor,
     481             :                                const uint32_t& renderFlags,
     482             :                                const bool& flushLayout,
     483             :                                const nsIntSize& renderSize) override;
     484             : 
     485             :   virtual bool
     486             :   DeallocPDocumentRendererParent(PDocumentRendererParent* actor) override;
     487             : 
     488             :   virtual PFilePickerParent*
     489             :   AllocPFilePickerParent(const nsString& aTitle,
     490             :                          const int16_t& aMode) override;
     491             : 
     492             :   virtual bool DeallocPFilePickerParent(PFilePickerParent* actor) override;
     493             : 
     494             :   virtual PIndexedDBPermissionRequestParent*
     495             :   AllocPIndexedDBPermissionRequestParent(const Principal& aPrincipal) override;
     496             : 
     497             :   virtual mozilla::ipc::IPCResult
     498             :   RecvPIndexedDBPermissionRequestConstructor(
     499             :     PIndexedDBPermissionRequestParent* aActor,
     500             :     const Principal& aPrincipal)
     501             :                                     override;
     502             : 
     503             :   virtual bool
     504             :   DeallocPIndexedDBPermissionRequestParent(
     505             :                                     PIndexedDBPermissionRequestParent* aActor)
     506             :                                     override;
     507             : 
     508             :   bool GetGlobalJSObject(JSContext* cx, JSObject** globalp);
     509             : 
     510             :   NS_DECL_ISUPPORTS
     511             :   NS_DECL_NSIAUTHPROMPTPROVIDER
     512             :   NS_DECL_NSISECUREBROWSERUI
     513             :   NS_DECL_NSIWEBBROWSERPERSISTABLE
     514             : 
     515             :   bool HandleQueryContentEvent(mozilla::WidgetQueryContentEvent& aEvent);
     516             : 
     517             :   bool SendPasteTransferable(const IPCDataTransfer& aDataTransfer,
     518             :                              const bool& aIsPrivateData,
     519             :                              const IPC::Principal& aRequestingPrincipal);
     520             : 
     521             :   static TabParent* GetFrom(nsFrameLoader* aFrameLoader);
     522             : 
     523             :   static TabParent* GetFrom(nsIFrameLoader* aFrameLoader);
     524             : 
     525             :   static TabParent* GetFrom(nsITabParent* aTabParent);
     526             : 
     527             :   static TabParent* GetFrom(PBrowserParent* aTabParent);
     528             : 
     529             :   static TabParent* GetFrom(nsIContent* aContent);
     530             : 
     531             :   static TabId GetTabIdFrom(nsIDocShell* docshell);
     532             : 
     533          43 :   nsIContentParent* Manager() const { return mManager; }
     534             : 
     535             :   /**
     536             :    * Let managees query if Destroy() is already called so they don't send out
     537             :    * messages when the PBrowser actor is being destroyed.
     538             :    */
     539           0 :   bool IsDestroyed() const { return mIsDestroyed; }
     540             : 
     541             :   already_AddRefed<nsIWidget> GetWidget() const;
     542             : 
     543           2 :   const TabId GetTabId() const
     544             :   {
     545           2 :     return mTabId;
     546             :   }
     547             : 
     548             :   LayoutDeviceIntPoint GetChildProcessOffset();
     549             :   LayoutDevicePoint AdjustTapToChildWidget(const LayoutDevicePoint& aPoint);
     550             : 
     551             :   /**
     552             :    * Native widget remoting protocol for use with windowed plugins with e10s.
     553             :    */
     554             :   virtual PPluginWidgetParent* AllocPPluginWidgetParent() override;
     555             : 
     556             :   virtual bool
     557             :   DeallocPPluginWidgetParent(PPluginWidgetParent* aActor) override;
     558             : 
     559             :   virtual PPaymentRequestParent*
     560             :   AllocPPaymentRequestParent() override;
     561             : 
     562             :   virtual bool
     563             :   DeallocPPaymentRequestParent(PPaymentRequestParent* aActor) override;
     564             : 
     565           1 :   void SetInitedByParent() { mInitedByParent = true; }
     566             : 
     567           1 :   bool IsInitedByParent() const { return mInitedByParent; }
     568             : 
     569             :   bool SendLoadRemoteScript(const nsString& aURL,
     570             :                             const bool& aRunInGlobalScope);
     571             : 
     572             :   void LayerTreeUpdate(uint64_t aEpoch, bool aActive);
     573             : 
     574             :   virtual mozilla::ipc::IPCResult
     575             :   RecvInvokeDragSession(nsTArray<IPCDataTransfer>&& aTransfers,
     576             :                         const uint32_t& aAction,
     577             :                         const OptionalShmem& aVisualDnDData,
     578             :                         const uint32_t& aStride, const uint8_t& aFormat,
     579             :                         const LayoutDeviceIntRect& aDragRect) override;
     580             : 
     581             :   void AddInitialDnDDataTo(DataTransfer* aDataTransfer);
     582             : 
     583             :   bool TakeDragVisualization(RefPtr<mozilla::gfx::SourceSurface>& aSurface,
     584             :                              LayoutDeviceIntRect* aDragRect);
     585             : 
     586             :   layout::RenderFrameParent* GetRenderFrame();
     587             : 
     588             :   bool SetRenderFrame(PRenderFrameParent* aRFParent);
     589             :   bool GetRenderFrameInfo(TextureFactoryIdentifier* aTextureFactoryIdentifier,
     590             :                           uint64_t* aLayersId);
     591             : 
     592             :   mozilla::ipc::IPCResult RecvEnsureLayersConnected(CompositorOptions* aCompositorOptions) override;
     593             : 
     594             :   // LiveResizeListener implementation
     595             :   void LiveResizeStarted() override;
     596             :   void LiveResizeStopped() override;
     597             : 
     598             : protected:
     599             :   bool ReceiveMessage(const nsString& aMessage,
     600             :                       bool aSync,
     601             :                       ipc::StructuredCloneData* aData,
     602             :                       mozilla::jsipc::CpowHolder* aCpows,
     603             :                       nsIPrincipal* aPrincipal,
     604             :                       nsTArray<ipc::StructuredCloneData>* aJSONRetVal = nullptr);
     605             : 
     606             :   virtual mozilla::ipc::IPCResult RecvAsyncAuthPrompt(const nsCString& aUri,
     607             :                                                       const nsString& aRealm,
     608             :                                                       const uint64_t& aCallbackId) override;
     609             : 
     610             :   virtual mozilla::ipc::IPCResult Recv__delete__() override;
     611             : 
     612             :   virtual void ActorDestroy(ActorDestroyReason why) override;
     613             : 
     614             :   Element* mFrameElement;
     615             :   nsCOMPtr<nsIBrowserDOMWindow> mBrowserDOMWindow;
     616             : 
     617             :   virtual PRenderFrameParent* AllocPRenderFrameParent() override;
     618             : 
     619             :   virtual bool DeallocPRenderFrameParent(PRenderFrameParent* aFrame) override;
     620             : 
     621             :   virtual mozilla::ipc::IPCResult RecvRemotePaintIsReady() override;
     622             : 
     623             :   virtual mozilla::ipc::IPCResult RecvForcePaintNoOp(const uint64_t& aLayerObserverEpoch) override;
     624             : 
     625             :   virtual mozilla::ipc::IPCResult RecvSetDimensions(const uint32_t& aFlags,
     626             :                                                     const int32_t& aX, const int32_t& aY,
     627             :                                                     const int32_t& aCx, const int32_t& aCy) override;
     628             : 
     629             :   virtual mozilla::ipc::IPCResult RecvGetTabCount(uint32_t* aValue) override;
     630             : 
     631             :   virtual mozilla::ipc::IPCResult RecvSHistoryUpdate(const uint32_t& aCount,
     632             :                                                      const uint32_t& aLocalIndex,
     633             :                                                      const bool& aTruncate) override;
     634             : 
     635             :   virtual mozilla::ipc::IPCResult RecvRequestCrossBrowserNavigation(const uint32_t& aGlobalIndex) override;
     636             : 
     637             :   ContentCacheInParent mContentCache;
     638             : 
     639             :   nsIntRect mRect;
     640             :   ScreenIntSize mDimensions;
     641             :   ScreenOrientationInternal mOrientation;
     642             :   float mDPI;
     643             :   int32_t mRounding;
     644             :   CSSToLayoutDeviceScale mDefaultScale;
     645             :   bool mUpdatedDimensions;
     646             :   nsSizeMode mSizeMode;
     647             :   LayoutDeviceIntPoint mClientOffset;
     648             :   LayoutDeviceIntPoint mChromeOffset;
     649             : 
     650             : private:
     651             :   void DestroyInternal();
     652             : 
     653             :   already_AddRefed<nsFrameLoader>
     654             :   GetFrameLoader(bool aUseCachedFrameLoaderAfterDestroy = false) const;
     655             : 
     656             :   RefPtr<nsIContentParent> mManager;
     657             :   void TryCacheDPIAndScale();
     658             : 
     659             :   nsresult UpdatePosition();
     660             : 
     661             :   bool AsyncPanZoomEnabled() const;
     662             : 
     663             :   // Cached value indicating the docshell active state of the remote browser.
     664             :   bool mDocShellIsActive;
     665             : 
     666             :   // Update state prior to routing an APZ-aware event to the child process.
     667             :   // |aOutTargetGuid| will contain the identifier
     668             :   // of the APZC instance that handled the event. aOutTargetGuid may be null.
     669             :   // |aOutInputBlockId| will contain the identifier of the input block
     670             :   // that this event was added to, if there was one. aOutInputBlockId may be null.
     671             :   // |aOutApzResponse| will contain the response that the APZ gave when processing
     672             :   // the input block; this is used for generating appropriate pointercancel events.
     673             :   void ApzAwareEventRoutingToChild(ScrollableLayerGuid* aOutTargetGuid,
     674             :                                    uint64_t* aOutInputBlockId,
     675             :                                    nsEventStatus* aOutApzResponse);
     676             : 
     677             :   // When true, we've initiated normal shutdown and notified our managing PContent.
     678             :   bool mMarkedDestroying;
     679             :   // When true, the TabParent is invalid and we should not send IPC messages anymore.
     680             :   bool mIsDestroyed;
     681             : 
     682             :   uint32_t mChromeFlags;
     683             : 
     684             :   nsTArray<nsTArray<IPCDataTransferItem>> mInitialDataTransferItems;
     685             : 
     686             :   RefPtr<gfx::DataSourceSurface> mDnDVisualization;
     687             :   bool mDragValid;
     688             :   LayoutDeviceIntRect mDragRect;
     689             : 
     690             :   // When true, the TabParent is initialized without child side's request.
     691             :   // When false, the TabParent is initialized by window.open() from child side.
     692             :   bool mInitedByParent;
     693             : 
     694             :   nsCOMPtr<nsILoadContext> mLoadContext;
     695             : 
     696             :   // We keep a strong reference to the frameloader after we've sent the
     697             :   // Destroy message and before we've received __delete__. This allows us to
     698             :   // dispatch message manager messages during this time.
     699             :   RefPtr<nsFrameLoader> mFrameLoader;
     700             : 
     701             :   TabId mTabId;
     702             : 
     703             :   // When loading a new tab or window via window.open, the child is
     704             :   // responsible for loading the URL it wants into the new TabChild. When the
     705             :   // parent receives the CreateWindow message, though, it sends a LoadURL
     706             :   // message, usually for about:blank. It's important for the about:blank load
     707             :   // to get processed because the Firefox frontend expects every new window to
     708             :   // immediately start loading something (see bug 1123090). However, we want
     709             :   // the child to process the LoadURL message before it returns from
     710             :   // ProvideWindow so that the URL sent from the parent doesn't override the
     711             :   // child's URL. This is not possible using our IPC mechanisms. To solve the
     712             :   // problem, we skip sending the LoadURL message in the parent and instead
     713             :   // return the URL as a result from CreateWindow. The child simulates
     714             :   // receiving a LoadURL message before returning from ProvideWindow.
     715             :   //
     716             :   // The mCreatingWindow flag is set while dispatching CreateWindow. During
     717             :   // that time, any LoadURL calls are skipped and the URL is stored in
     718             :   // mSkippedURL.
     719             :   bool mCreatingWindow;
     720             :   nsCString mDelayedURL;
     721             : 
     722             :   // When loading a new tab or window via window.open, we want to ensure that
     723             :   // frame scripts for that tab are loaded before any scripts start to run in
     724             :   // the window. We can't load the frame scripts the normal way, using
     725             :   // separate IPC messages, since they won't be processed by the child until
     726             :   // returning to the event loop, which is too late. Instead, we queue up
     727             :   // frame scripts that we intend to load and send them as part of the
     728             :   // CreateWindow response. Then TabChild loads them immediately.
     729             :   nsTArray<FrameScriptInfo> mDelayedFrameScripts;
     730             : 
     731             :   // Cached cursor setting from TabChild.  When the cursor is over the tab,
     732             :   // it should take this appearance.
     733             :   nsCursor mCursor;
     734             :   nsCOMPtr<imgIContainer> mCustomCursor;
     735             :   uint32_t mCustomCursorHotspotX, mCustomCursorHotspotY;
     736             : 
     737             :   // True if the cursor changes from the TabChild should change the widget
     738             :   // cursor.  This happens whenever the cursor is in the tab's region.
     739             :   bool mTabSetsCursor;
     740             : 
     741             :   bool mHasContentOpener;
     742             : 
     743             : #ifdef DEBUG
     744             :   int32_t mActiveSupressDisplayportCount;
     745             : #endif
     746             : 
     747             :   ShowInfo GetShowInfo();
     748             : 
     749             : private:
     750             :   // This is used when APZ needs to find the TabParent associated with a layer
     751             :   // to dispatch events.
     752             :   typedef nsDataHashtable<nsUint64HashKey, TabParent*> LayerToTabParentTable;
     753             :   static LayerToTabParentTable* sLayerToTabParentTable;
     754             : 
     755             :   static void AddTabParentToTable(uint64_t aLayersId, TabParent* aTabParent);
     756             : 
     757             :   static void RemoveTabParentFromTable(uint64_t aLayersId);
     758             : 
     759             :   uint64_t mLayerTreeEpoch;
     760             : 
     761             :   // If this flag is set, then the tab's layers will be preserved even when
     762             :   // the tab's docshell is inactive.
     763             :   bool mPreserveLayers;
     764             : 
     765             :   // True if this TabParent has had its layer tree sent to the compositor
     766             :   // at least once.
     767             :   bool mHasPresented;
     768             : 
     769             :   // True if at least one window hosted in the TabChild has added a
     770             :   // beforeunload event listener.
     771             :   bool mHasBeforeUnload;
     772             : 
     773             : public:
     774             :   static TabParent* GetTabParentFromLayersId(uint64_t aLayersId);
     775             : };
     776             : 
     777             : struct MOZ_STACK_CLASS TabParent::AutoUseNewTab final
     778             : {
     779             : public:
     780           0 :   AutoUseNewTab(TabParent* aNewTab, nsCString* aURLToLoad)
     781           0 :    : mNewTab(aNewTab), mURLToLoad(aURLToLoad)
     782             :   {
     783           0 :     MOZ_ASSERT(!aNewTab->mCreatingWindow);
     784             : 
     785           0 :     aNewTab->mCreatingWindow = true;
     786           0 :     aNewTab->mDelayedURL.Truncate();
     787           0 :   }
     788             : 
     789           0 :   ~AutoUseNewTab()
     790           0 :   {
     791           0 :     mNewTab->mCreatingWindow = false;
     792           0 :     *mURLToLoad = mNewTab->mDelayedURL;
     793           0 :   }
     794             : 
     795             : private:
     796             :   TabParent* mNewTab;
     797             :   nsCString* mURLToLoad;
     798             : };
     799             : 
     800             : } // namespace dom
     801             : } // namespace mozilla
     802             : 
     803             : #endif // mozilla_tabs_TabParent_h

Generated by: LCOV version 1.13