michael@0: /* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 2; -*- */ michael@0: /* vim: set sw=4 ts=8 et tw=80 : */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef mozilla_dom_TabChild_h michael@0: #define mozilla_dom_TabChild_h michael@0: michael@0: #include "mozilla/dom/PBrowserChild.h" michael@0: #include "nsIWebNavigation.h" michael@0: #include "nsCOMPtr.h" michael@0: #include "nsAutoPtr.h" michael@0: #include "nsIWebBrowserChrome2.h" michael@0: #include "nsIEmbeddingSiteWindow.h" michael@0: #include "nsIWebBrowserChromeFocus.h" michael@0: #include "nsIDOMEventListener.h" michael@0: #include "nsIInterfaceRequestor.h" michael@0: #include "nsIWindowProvider.h" michael@0: #include "nsIDOMWindow.h" michael@0: #include "nsIDocShell.h" michael@0: #include "nsIInterfaceRequestorUtils.h" michael@0: #include "nsFrameMessageManager.h" michael@0: #include "nsIWebProgressListener.h" michael@0: #include "nsIPresShell.h" michael@0: #include "nsIScriptObjectPrincipal.h" michael@0: #include "nsWeakReference.h" michael@0: #include "nsITabChild.h" michael@0: #include "nsITooltipListener.h" michael@0: #include "mozilla/Attributes.h" michael@0: #include "mozilla/dom/TabContext.h" michael@0: #include "mozilla/DOMEventTargetHelper.h" michael@0: #include "mozilla/EventDispatcher.h" michael@0: #include "mozilla/EventForwards.h" michael@0: #include "mozilla/layers/CompositorTypes.h" michael@0: michael@0: class nsICachedFileDescriptorListener; michael@0: class nsIDOMWindowUtils; michael@0: michael@0: namespace mozilla { michael@0: namespace layout { michael@0: class RenderFrameChild; michael@0: } michael@0: michael@0: namespace layers { michael@0: class ActiveElementManager; michael@0: } michael@0: michael@0: namespace widget { michael@0: struct AutoCacheNativeKeyCommands; michael@0: } michael@0: michael@0: namespace dom { michael@0: michael@0: class TabChild; michael@0: class ClonedMessageData; michael@0: class TabChildBase; michael@0: michael@0: class TabChildGlobal : public DOMEventTargetHelper, michael@0: public nsIContentFrameMessageManager, michael@0: public nsIScriptObjectPrincipal, michael@0: public nsIGlobalObject michael@0: { michael@0: public: michael@0: TabChildGlobal(TabChildBase* aTabChild); michael@0: void Init(); michael@0: NS_DECL_ISUPPORTS_INHERITED michael@0: NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TabChildGlobal, DOMEventTargetHelper) michael@0: NS_FORWARD_SAFE_NSIMESSAGELISTENERMANAGER(mMessageManager) michael@0: NS_FORWARD_SAFE_NSIMESSAGESENDER(mMessageManager) michael@0: NS_IMETHOD SendSyncMessage(const nsAString& aMessageName, michael@0: JS::Handle aObject, michael@0: JS::Handle aRemote, michael@0: nsIPrincipal* aPrincipal, michael@0: JSContext* aCx, michael@0: uint8_t aArgc, michael@0: JS::MutableHandle aRetval) michael@0: { michael@0: return mMessageManager michael@0: ? mMessageManager->SendSyncMessage(aMessageName, aObject, aRemote, michael@0: aPrincipal, aCx, aArgc, aRetval) michael@0: : NS_ERROR_NULL_POINTER; michael@0: } michael@0: NS_IMETHOD SendRpcMessage(const nsAString& aMessageName, michael@0: JS::Handle aObject, michael@0: JS::Handle aRemote, michael@0: nsIPrincipal* aPrincipal, michael@0: JSContext* aCx, michael@0: uint8_t aArgc, michael@0: JS::MutableHandle aRetval) michael@0: { michael@0: return mMessageManager michael@0: ? mMessageManager->SendRpcMessage(aMessageName, aObject, aRemote, michael@0: aPrincipal, aCx, aArgc, aRetval) michael@0: : NS_ERROR_NULL_POINTER; michael@0: } michael@0: NS_IMETHOD GetContent(nsIDOMWindow** aContent) MOZ_OVERRIDE; michael@0: NS_IMETHOD GetDocShell(nsIDocShell** aDocShell) MOZ_OVERRIDE; michael@0: NS_IMETHOD Dump(const nsAString& aStr) MOZ_OVERRIDE michael@0: { michael@0: return mMessageManager ? mMessageManager->Dump(aStr) : NS_OK; michael@0: } michael@0: NS_IMETHOD PrivateNoteIntentionalCrash() MOZ_OVERRIDE; michael@0: NS_IMETHOD Btoa(const nsAString& aBinaryData, michael@0: nsAString& aAsciiBase64String) MOZ_OVERRIDE; michael@0: NS_IMETHOD Atob(const nsAString& aAsciiString, michael@0: nsAString& aBinaryData) MOZ_OVERRIDE; michael@0: michael@0: NS_IMETHOD AddEventListener(const nsAString& aType, michael@0: nsIDOMEventListener* aListener, michael@0: bool aUseCapture) michael@0: { michael@0: // By default add listeners only for trusted events! michael@0: return DOMEventTargetHelper::AddEventListener(aType, aListener, michael@0: aUseCapture, false, 2); michael@0: } michael@0: using DOMEventTargetHelper::AddEventListener; michael@0: NS_IMETHOD AddEventListener(const nsAString& aType, michael@0: nsIDOMEventListener* aListener, michael@0: bool aUseCapture, bool aWantsUntrusted, michael@0: uint8_t optional_argc) MOZ_OVERRIDE michael@0: { michael@0: return DOMEventTargetHelper::AddEventListener(aType, aListener, michael@0: aUseCapture, michael@0: aWantsUntrusted, michael@0: optional_argc); michael@0: } michael@0: michael@0: nsresult michael@0: PreHandleEvent(EventChainPreVisitor& aVisitor) michael@0: { michael@0: aVisitor.mForceContentDispatch = true; michael@0: return NS_OK; michael@0: } michael@0: michael@0: virtual JSContext* GetJSContextForEventHandlers() MOZ_OVERRIDE; michael@0: virtual nsIPrincipal* GetPrincipal() MOZ_OVERRIDE; michael@0: virtual JSObject* GetGlobalJSObject() MOZ_OVERRIDE; michael@0: michael@0: nsCOMPtr mMessageManager; michael@0: nsRefPtr mTabChild; michael@0: }; michael@0: michael@0: class ContentListener MOZ_FINAL : public nsIDOMEventListener michael@0: { michael@0: public: michael@0: ContentListener(TabChild* aTabChild) : mTabChild(aTabChild) {} michael@0: NS_DECL_ISUPPORTS michael@0: NS_DECL_NSIDOMEVENTLISTENER michael@0: protected: michael@0: TabChild* mTabChild; michael@0: }; michael@0: michael@0: // This is base clase which helps to share Viewport and touch related functionality michael@0: // between b2g/android FF/embedlite clients implementation. michael@0: // It make sense to place in this class all helper functions, and functionality which could be shared between michael@0: // Cross-process/Cross-thread implmentations. michael@0: class TabChildBase : public nsISupports, michael@0: public nsFrameScriptExecutor, michael@0: public ipc::MessageManagerCallback michael@0: { michael@0: public: michael@0: TabChildBase(); michael@0: NS_DECL_CYCLE_COLLECTING_ISUPPORTS michael@0: NS_DECL_CYCLE_COLLECTION_CLASS(TabChildBase) michael@0: michael@0: virtual nsIWebNavigation* WebNavigation() = 0; michael@0: virtual nsIWidget* WebWidget() = 0; michael@0: nsIPrincipal* GetPrincipal() { return mPrincipal; } michael@0: bool IsAsyncPanZoomEnabled(); michael@0: // Recalculates the display state, including the CSS michael@0: // viewport. This should be called whenever we believe the michael@0: // viewport data on a document may have changed. If it didn't michael@0: // change, this function doesn't do anything. However, it should michael@0: // not be called all the time as it is fairly expensive. michael@0: bool HandlePossibleViewportChange(); michael@0: virtual bool DoUpdateZoomConstraints(const uint32_t& aPresShellId, michael@0: const mozilla::layers::FrameMetrics::ViewID& aViewId, michael@0: const bool& aIsRoot, michael@0: const mozilla::layers::ZoomConstraints& aConstraints) = 0; michael@0: michael@0: nsEventStatus DispatchSynthesizedMouseEvent(uint32_t aMsg, uint64_t aTime, michael@0: const LayoutDevicePoint& aRefPoint, michael@0: nsIWidget* aWidget); michael@0: michael@0: protected: michael@0: CSSSize GetPageSize(nsCOMPtr aDocument, const CSSSize& aViewport); michael@0: michael@0: // Get the DOMWindowUtils for the top-level window in this tab. michael@0: already_AddRefed GetDOMWindowUtils(); michael@0: // Get the Document for the top-level window in this tab. michael@0: already_AddRefed GetDocument(); michael@0: michael@0: // Wrapper for nsIDOMWindowUtils.setCSSViewport(). This updates some state michael@0: // variables local to this class before setting it. michael@0: void SetCSSViewport(const CSSSize& aSize); michael@0: michael@0: // Wraps up a JSON object as a structured clone and sends it to the browser michael@0: // chrome script. michael@0: // michael@0: // XXX/bug 780335: Do the work the browser chrome script does in C++ instead michael@0: // so we don't need things like this. michael@0: void DispatchMessageManagerMessage(const nsAString& aMessageName, michael@0: const nsAString& aJSONData); michael@0: michael@0: nsEventStatus DispatchWidgetEvent(WidgetGUIEvent& event); michael@0: michael@0: bool HasValidInnerSize(); michael@0: void InitializeRootMetrics(); michael@0: michael@0: mozilla::layers::FrameMetrics ProcessUpdateFrame(const mozilla::layers::FrameMetrics& aFrameMetrics); michael@0: michael@0: bool UpdateFrameHandler(const mozilla::layers::FrameMetrics& aFrameMetrics); michael@0: michael@0: protected: michael@0: float mOldViewportWidth; michael@0: bool mContentDocumentIsDisplayed; michael@0: nsRefPtr mTabChildGlobal; michael@0: ScreenIntSize mInnerSize; michael@0: mozilla::layers::FrameMetrics mLastRootMetrics; michael@0: mozilla::layout::ScrollingBehavior mScrolling; michael@0: }; michael@0: michael@0: class TabChild : public TabChildBase, michael@0: public PBrowserChild, michael@0: public nsIWebBrowserChrome2, michael@0: public nsIEmbeddingSiteWindow, michael@0: public nsIWebBrowserChromeFocus, michael@0: public nsIInterfaceRequestor, michael@0: public nsIWindowProvider, michael@0: public nsIDOMEventListener, michael@0: public nsIWebProgressListener, michael@0: public nsSupportsWeakReference, michael@0: public nsITabChild, michael@0: public nsIObserver, michael@0: public TabContext, michael@0: public nsITooltipListener michael@0: { michael@0: typedef mozilla::dom::ClonedMessageData ClonedMessageData; michael@0: typedef mozilla::layout::RenderFrameChild RenderFrameChild; michael@0: typedef mozilla::layout::ScrollingBehavior ScrollingBehavior; michael@0: typedef mozilla::layers::ActiveElementManager ActiveElementManager; michael@0: michael@0: public: michael@0: /** michael@0: * This is expected to be called off the critical path to content michael@0: * startup. This is an opportunity to load things that are slow michael@0: * on the critical path. michael@0: */ michael@0: static void PreloadSlowThings(); michael@0: michael@0: /** Return a TabChild with the given attributes. */ michael@0: static already_AddRefed michael@0: Create(ContentChild* aManager, const TabContext& aContext, uint32_t aChromeFlags); michael@0: michael@0: virtual ~TabChild(); michael@0: michael@0: bool IsRootContentDocument(); michael@0: michael@0: NS_DECL_ISUPPORTS_INHERITED michael@0: NS_DECL_NSIWEBBROWSERCHROME michael@0: NS_DECL_NSIWEBBROWSERCHROME2 michael@0: NS_DECL_NSIEMBEDDINGSITEWINDOW michael@0: NS_DECL_NSIWEBBROWSERCHROMEFOCUS michael@0: NS_DECL_NSIINTERFACEREQUESTOR michael@0: NS_DECL_NSIWINDOWPROVIDER michael@0: NS_DECL_NSIDOMEVENTLISTENER michael@0: NS_DECL_NSIWEBPROGRESSLISTENER michael@0: NS_DECL_NSITABCHILD michael@0: NS_DECL_NSIOBSERVER michael@0: NS_DECL_NSITOOLTIPLISTENER michael@0: michael@0: /** michael@0: * MessageManagerCallback methods that we override. michael@0: */ michael@0: virtual bool DoSendBlockingMessage(JSContext* aCx, michael@0: const nsAString& aMessage, michael@0: const mozilla::dom::StructuredCloneData& aData, michael@0: JS::Handle aCpows, michael@0: nsIPrincipal* aPrincipal, michael@0: InfallibleTArray* aJSONRetVal, michael@0: bool aIsSync) MOZ_OVERRIDE; michael@0: virtual bool DoSendAsyncMessage(JSContext* aCx, michael@0: const nsAString& aMessage, michael@0: const mozilla::dom::StructuredCloneData& aData, michael@0: JS::Handle aCpows, michael@0: nsIPrincipal* aPrincipal) MOZ_OVERRIDE; michael@0: virtual bool DoUpdateZoomConstraints(const uint32_t& aPresShellId, michael@0: const ViewID& aViewId, michael@0: const bool& aIsRoot, michael@0: const ZoomConstraints& aConstraints) MOZ_OVERRIDE; michael@0: virtual bool RecvLoadURL(const nsCString& uri) MOZ_OVERRIDE; michael@0: virtual bool RecvCacheFileDescriptor(const nsString& aPath, michael@0: const FileDescriptor& aFileDescriptor) michael@0: MOZ_OVERRIDE; michael@0: virtual bool RecvShow(const nsIntSize& size) MOZ_OVERRIDE; michael@0: virtual bool RecvUpdateDimensions(const nsRect& rect, michael@0: const nsIntSize& size, michael@0: const ScreenOrientation& orientation) MOZ_OVERRIDE; michael@0: virtual bool RecvUpdateFrame(const mozilla::layers::FrameMetrics& aFrameMetrics) MOZ_OVERRIDE; michael@0: virtual bool RecvAcknowledgeScrollUpdate(const ViewID& aScrollId, michael@0: const uint32_t& aScrollGeneration) MOZ_OVERRIDE; michael@0: virtual bool RecvHandleDoubleTap(const CSSPoint& aPoint, michael@0: const mozilla::layers::ScrollableLayerGuid& aGuid) MOZ_OVERRIDE; michael@0: virtual bool RecvHandleSingleTap(const CSSPoint& aPoint, michael@0: const mozilla::layers::ScrollableLayerGuid& aGuid) MOZ_OVERRIDE; michael@0: virtual bool RecvHandleLongTap(const CSSPoint& aPoint, michael@0: const mozilla::layers::ScrollableLayerGuid& aGuid) MOZ_OVERRIDE; michael@0: virtual bool RecvHandleLongTapUp(const CSSPoint& aPoint, michael@0: const mozilla::layers::ScrollableLayerGuid& aGuid) MOZ_OVERRIDE; michael@0: virtual bool RecvNotifyAPZStateChange(const ViewID& aViewId, michael@0: const APZStateChange& aChange, michael@0: const int& aArg) MOZ_OVERRIDE; michael@0: virtual bool RecvActivate() MOZ_OVERRIDE; michael@0: virtual bool RecvDeactivate() MOZ_OVERRIDE; michael@0: virtual bool RecvMouseEvent(const nsString& aType, michael@0: const float& aX, michael@0: const float& aY, michael@0: const int32_t& aButton, michael@0: const int32_t& aClickCount, michael@0: const int32_t& aModifiers, michael@0: const bool& aIgnoreRootScrollFrame) MOZ_OVERRIDE; michael@0: virtual bool RecvRealMouseEvent(const mozilla::WidgetMouseEvent& event) MOZ_OVERRIDE; michael@0: virtual bool RecvRealKeyEvent(const mozilla::WidgetKeyboardEvent& event, michael@0: const MaybeNativeKeyBinding& aBindings) MOZ_OVERRIDE; michael@0: virtual bool RecvMouseWheelEvent(const mozilla::WidgetWheelEvent& event) MOZ_OVERRIDE; michael@0: virtual bool RecvRealTouchEvent(const WidgetTouchEvent& aEvent, michael@0: const ScrollableLayerGuid& aGuid) MOZ_OVERRIDE; michael@0: virtual bool RecvRealTouchMoveEvent(const WidgetTouchEvent& aEvent, michael@0: const ScrollableLayerGuid& aGuid) MOZ_OVERRIDE; michael@0: virtual bool RecvKeyEvent(const nsString& aType, michael@0: const int32_t& aKeyCode, michael@0: const int32_t& aCharCode, michael@0: const int32_t& aModifiers, michael@0: const bool& aPreventDefault) MOZ_OVERRIDE; michael@0: virtual bool RecvCompositionEvent(const mozilla::WidgetCompositionEvent& event) MOZ_OVERRIDE; michael@0: virtual bool RecvTextEvent(const mozilla::WidgetTextEvent& event) MOZ_OVERRIDE; michael@0: virtual bool RecvSelectionEvent(const mozilla::WidgetSelectionEvent& event) MOZ_OVERRIDE; michael@0: virtual bool RecvActivateFrameEvent(const nsString& aType, const bool& capture) MOZ_OVERRIDE; michael@0: virtual bool RecvLoadRemoteScript(const nsString& aURL, michael@0: const bool& aRunInGlobalScope) MOZ_OVERRIDE; michael@0: virtual bool RecvAsyncMessage(const nsString& aMessage, michael@0: const ClonedMessageData& aData, michael@0: const InfallibleTArray& aCpows, michael@0: const IPC::Principal& aPrincipal) MOZ_OVERRIDE; michael@0: michael@0: virtual PDocumentRendererChild* michael@0: AllocPDocumentRendererChild(const nsRect& documentRect, const gfx::Matrix& transform, michael@0: const nsString& bgcolor, michael@0: const uint32_t& renderFlags, const bool& flushLayout, michael@0: const nsIntSize& renderSize) MOZ_OVERRIDE; michael@0: virtual bool DeallocPDocumentRendererChild(PDocumentRendererChild* actor) MOZ_OVERRIDE; michael@0: virtual bool RecvPDocumentRendererConstructor(PDocumentRendererChild* actor, michael@0: const nsRect& documentRect, michael@0: const gfx::Matrix& transform, michael@0: const nsString& bgcolor, michael@0: const uint32_t& renderFlags, michael@0: const bool& flushLayout, michael@0: const nsIntSize& renderSize) MOZ_OVERRIDE; michael@0: michael@0: virtual PColorPickerChild* michael@0: AllocPColorPickerChild(const nsString& title, const nsString& initialColor) MOZ_OVERRIDE; michael@0: virtual bool DeallocPColorPickerChild(PColorPickerChild* actor) MOZ_OVERRIDE; michael@0: michael@0: #ifdef DEBUG michael@0: virtual PContentPermissionRequestChild* michael@0: SendPContentPermissionRequestConstructor(PContentPermissionRequestChild* aActor, michael@0: const InfallibleTArray& aRequests, michael@0: const IPC::Principal& aPrincipal); michael@0: #endif /* DEBUG */ michael@0: michael@0: virtual PContentPermissionRequestChild* michael@0: AllocPContentPermissionRequestChild(const InfallibleTArray& aRequests, michael@0: const IPC::Principal& aPrincipal) MOZ_OVERRIDE; michael@0: virtual bool michael@0: DeallocPContentPermissionRequestChild(PContentPermissionRequestChild* actor) MOZ_OVERRIDE; michael@0: michael@0: virtual PFilePickerChild* michael@0: AllocPFilePickerChild(const nsString& aTitle, const int16_t& aMode) MOZ_OVERRIDE; michael@0: virtual bool michael@0: DeallocPFilePickerChild(PFilePickerChild* actor) MOZ_OVERRIDE; michael@0: michael@0: virtual POfflineCacheUpdateChild* AllocPOfflineCacheUpdateChild( michael@0: const URIParams& manifestURI, michael@0: const URIParams& documentURI, michael@0: const bool& stickDocument) MOZ_OVERRIDE; michael@0: virtual bool michael@0: DeallocPOfflineCacheUpdateChild(POfflineCacheUpdateChild* offlineCacheUpdate) MOZ_OVERRIDE; michael@0: michael@0: virtual nsIWebNavigation* WebNavigation() MOZ_OVERRIDE { return mWebNav; } michael@0: virtual nsIWidget* WebWidget() MOZ_OVERRIDE { return mWidget; } michael@0: michael@0: /** Return the DPI of the widget this TabChild draws to. */ michael@0: void GetDPI(float* aDPI); michael@0: void GetDefaultScale(double *aScale); michael@0: michael@0: ScreenOrientation GetOrientation() { return mOrientation; } michael@0: michael@0: void SetBackgroundColor(const nscolor& aColor); michael@0: michael@0: void NotifyPainted(); michael@0: michael@0: void RequestNativeKeyBindings(mozilla::widget::AutoCacheNativeKeyCommands* aAutoCache, michael@0: WidgetKeyboardEvent* aEvent); michael@0: michael@0: /** Return a boolean indicating if the page has called preventDefault on michael@0: * the event. michael@0: */ michael@0: bool DispatchMouseEvent(const nsString& aType, michael@0: const CSSPoint& aPoint, michael@0: const int32_t& aButton, michael@0: const int32_t& aClickCount, michael@0: const int32_t& aModifiers, michael@0: const bool& aIgnoreRootScrollFrame, michael@0: const unsigned short& aInputSourceArg); michael@0: michael@0: /** michael@0: * Signal to this TabChild that it should be made visible: michael@0: * activated widget, retained layer tree, etc. (Respectively, michael@0: * made not visible.) michael@0: */ michael@0: void MakeVisible(); michael@0: void MakeHidden(); michael@0: michael@0: // Returns true if the file descriptor was found in the cache, false michael@0: // otherwise. michael@0: bool GetCachedFileDescriptor(const nsAString& aPath, michael@0: nsICachedFileDescriptorListener* aCallback); michael@0: michael@0: void CancelCachedFileDescriptorCallback( michael@0: const nsAString& aPath, michael@0: nsICachedFileDescriptorListener* aCallback); michael@0: michael@0: ContentChild* Manager() { return mManager; } michael@0: michael@0: bool GetUpdateHitRegion() { return mUpdateHitRegion; } michael@0: michael@0: void UpdateHitRegion(const nsRegion& aRegion); michael@0: michael@0: static inline TabChild* michael@0: GetFrom(nsIDocShell* aDocShell) michael@0: { michael@0: nsCOMPtr tc = do_GetInterface(aDocShell); michael@0: return static_cast(tc.get()); michael@0: } michael@0: michael@0: static TabChild* GetFrom(nsIPresShell* aPresShell); michael@0: static TabChild* GetFrom(uint64_t aLayersId); michael@0: michael@0: void DidComposite(); michael@0: michael@0: static inline TabChild* michael@0: GetFrom(nsIDOMWindow* aWindow) michael@0: { michael@0: nsCOMPtr webNav = do_GetInterface(aWindow); michael@0: nsCOMPtr docShell = do_QueryInterface(webNav); michael@0: return GetFrom(docShell); michael@0: } michael@0: michael@0: protected: michael@0: virtual PRenderFrameChild* AllocPRenderFrameChild() MOZ_OVERRIDE; michael@0: virtual bool DeallocPRenderFrameChild(PRenderFrameChild* aFrame) MOZ_OVERRIDE; michael@0: virtual bool RecvDestroy() MOZ_OVERRIDE; michael@0: virtual bool RecvSetUpdateHitRegion(const bool& aEnabled) MOZ_OVERRIDE; michael@0: virtual bool RecvSetIsDocShellActive(const bool& aIsActive) MOZ_OVERRIDE; michael@0: michael@0: virtual PIndexedDBChild* AllocPIndexedDBChild(const nsCString& aGroup, michael@0: const nsCString& aASCIIOrigin, michael@0: bool* /* aAllowed */) MOZ_OVERRIDE; michael@0: michael@0: virtual bool DeallocPIndexedDBChild(PIndexedDBChild* aActor) MOZ_OVERRIDE; michael@0: michael@0: private: michael@0: /** michael@0: * Create a new TabChild object. michael@0: * michael@0: * |aOwnOrContainingAppId| is the app-id of our frame or of the closest app michael@0: * frame in the hierarchy which contains us. michael@0: * michael@0: * |aIsBrowserElement| indicates whether we're a browser (but not an app). michael@0: */ michael@0: TabChild(ContentChild* aManager, const TabContext& aContext, uint32_t aChromeFlags); michael@0: michael@0: nsresult Init(); michael@0: michael@0: michael@0: // Notify others that our TabContext has been updated. (At the moment, this michael@0: // sets the appropriate app-id and is-browser flags on our docshell.) michael@0: // michael@0: // You should call this after calling TabContext::SetTabContext(). We also michael@0: // call this during Init(). michael@0: void NotifyTabContextUpdated(); michael@0: michael@0: bool UseDirectCompositor(); michael@0: michael@0: void ActorDestroy(ActorDestroyReason why) MOZ_OVERRIDE; michael@0: michael@0: enum FrameScriptLoading { DONT_LOAD_SCRIPTS, DEFAULT_LOAD_SCRIPTS }; michael@0: bool InitTabChildGlobal(FrameScriptLoading aScriptLoading = DEFAULT_LOAD_SCRIPTS); michael@0: bool InitRenderingState(); michael@0: void DestroyWindow(); michael@0: void SetProcessNameToAppName(); michael@0: michael@0: // Call RecvShow(nsIntSize(0, 0)) and block future calls to RecvShow(). michael@0: void DoFakeShow(); michael@0: michael@0: // These methods are used for tracking synthetic mouse events michael@0: // dispatched for compatibility. On each touch event, we michael@0: // UpdateTapState(). If we've detected that the current gesture michael@0: // isn't a tap, then we CancelTapTracking(). In the meantime, we michael@0: // may detect a context-menu event, and if so we michael@0: // FireContextMenuEvent(). michael@0: void FireContextMenuEvent(); michael@0: void CancelTapTracking(); michael@0: void UpdateTapState(const WidgetTouchEvent& aEvent, nsEventStatus aStatus); michael@0: michael@0: nsresult michael@0: BrowserFrameProvideWindow(nsIDOMWindow* aOpener, michael@0: nsIURI* aURI, michael@0: const nsAString& aName, michael@0: const nsACString& aFeatures, michael@0: bool* aWindowIsNew, michael@0: nsIDOMWindow** aReturn); michael@0: michael@0: class CachedFileDescriptorInfo; michael@0: class CachedFileDescriptorCallbackRunnable; michael@0: michael@0: TextureFactoryIdentifier mTextureFactoryIdentifier; michael@0: nsCOMPtr mWebNav; michael@0: nsCOMPtr mWidget; michael@0: nsCOMPtr mLastURI; michael@0: RenderFrameChild* mRemoteFrame; michael@0: nsRefPtr mManager; michael@0: uint32_t mChromeFlags; michael@0: uint64_t mLayersId; michael@0: nsIntRect mOuterRect; michael@0: // When we're tracking a possible tap gesture, this is the "down" michael@0: // point of the touchstart. michael@0: LayoutDevicePoint mGestureDownPoint; michael@0: // The touch identifier of the active gesture. michael@0: int32_t mActivePointerId; michael@0: // A timer task that fires if the tap-hold timeout is exceeded by michael@0: // the touch we're tracking. That is, if touchend or a touchmove michael@0: // that exceeds the gesture threshold doesn't happen. michael@0: CancelableTask* mTapHoldTimer; michael@0: // Whether we have already received a FileDescriptor for the app package. michael@0: bool mAppPackageFileDescriptorRecved; michael@0: // At present only 1 of these is really expected. michael@0: nsAutoTArray, 1> michael@0: mCachedFileDescriptorInfos; michael@0: nscolor mLastBackgroundColor; michael@0: bool mDidFakeShow; michael@0: bool mNotified; michael@0: bool mTriedBrowserInit; michael@0: ScreenOrientation mOrientation; michael@0: bool mUpdateHitRegion; michael@0: bool mContextMenuHandled; michael@0: bool mWaitingTouchListeners; michael@0: void FireSingleTapEvent(LayoutDevicePoint aPoint); michael@0: michael@0: bool mIgnoreKeyPressEvent; michael@0: nsRefPtr mActiveElementManager; michael@0: michael@0: DISALLOW_EVIL_CONSTRUCTORS(TabChild); michael@0: }; michael@0: michael@0: } michael@0: } michael@0: michael@0: #endif // mozilla_dom_TabChild_h