2011-10-01 20:14:36 +04:00
|
|
|
/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 2; -*- */
|
2009-08-18 23:05:15 +04:00
|
|
|
/* vim: set sw=4 ts=8 et tw=80 : */
|
2012-05-21 15:12:37 +04:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2009-07-01 00:39:22 +04:00
|
|
|
|
2010-08-21 03:24:41 +04:00
|
|
|
#ifndef mozilla_dom_TabChild_h
|
|
|
|
#define mozilla_dom_TabChild_h
|
2009-07-01 00:39:22 +04:00
|
|
|
|
2010-02-20 20:05:20 +03:00
|
|
|
#ifndef _IMPL_NS_LAYOUT
|
2010-07-19 22:33:33 +04:00
|
|
|
#include "mozilla/dom/PBrowserChild.h"
|
2010-02-20 20:05:20 +03:00
|
|
|
#endif
|
2012-07-18 23:09:28 +04:00
|
|
|
#ifdef DEBUG
|
|
|
|
#include "PCOMContentPermissionRequestChild.h"
|
|
|
|
#endif /* DEBUG */
|
2009-07-01 00:39:22 +04:00
|
|
|
#include "nsIWebNavigation.h"
|
|
|
|
#include "nsCOMPtr.h"
|
2009-11-05 21:14:22 +03:00
|
|
|
#include "nsAutoPtr.h"
|
|
|
|
#include "nsIWebBrowserChrome2.h"
|
2012-06-10 02:15:12 +04:00
|
|
|
#include "nsIEmbeddingSiteWindow.h"
|
2009-11-05 21:14:22 +03:00
|
|
|
#include "nsIWebBrowserChromeFocus.h"
|
2010-08-21 03:24:40 +04:00
|
|
|
#include "nsIWidget.h"
|
2009-11-17 17:22:23 +03:00
|
|
|
#include "nsIDOMEventListener.h"
|
2010-01-01 04:34:06 +03:00
|
|
|
#include "nsIInterfaceRequestor.h"
|
2010-01-01 04:35:55 +03:00
|
|
|
#include "nsIWindowProvider.h"
|
2010-02-20 20:05:20 +03:00
|
|
|
#include "nsIXPCScriptable.h"
|
|
|
|
#include "nsIClassInfo.h"
|
|
|
|
#include "jsapi.h"
|
|
|
|
#include "nsIXPConnect.h"
|
|
|
|
#include "nsIDOMWindow.h"
|
2010-03-03 23:30:25 +03:00
|
|
|
#include "nsIDocShell.h"
|
2010-08-06 02:11:23 +04:00
|
|
|
#include "nsIDocShellTreeItem.h"
|
|
|
|
#include "nsIDocShellTreeOwner.h"
|
|
|
|
#include "nsIDocument.h"
|
2010-02-20 20:05:20 +03:00
|
|
|
#include "nsNetUtil.h"
|
|
|
|
#include "nsFrameMessageManager.h"
|
|
|
|
#include "nsIScriptContext.h"
|
2012-09-29 06:18:18 +04:00
|
|
|
#include "nsIWebProgressListener.h"
|
2012-02-08 06:53:33 +04:00
|
|
|
#include "nsDOMEventTargetHelper.h"
|
2010-05-17 15:25:22 +04:00
|
|
|
#include "nsIDialogCreator.h"
|
|
|
|
#include "nsIDialogParamBlock.h"
|
2012-09-29 06:18:18 +04:00
|
|
|
#include "nsIDOMWindowUtils.h"
|
2010-08-06 02:11:23 +04:00
|
|
|
#include "nsIPresShell.h"
|
2010-02-20 20:05:20 +03:00
|
|
|
#include "nsIPrincipal.h"
|
|
|
|
#include "nsIScriptObjectPrincipal.h"
|
|
|
|
#include "nsIScriptContext.h"
|
2012-07-20 10:48:27 +04:00
|
|
|
#include "nsPIDOMWindow.h"
|
2010-03-26 21:39:39 +03:00
|
|
|
#include "nsWeakReference.h"
|
2010-05-13 21:44:51 +04:00
|
|
|
#include "nsITabChild.h"
|
2012-06-15 06:31:55 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2012-08-09 08:39:02 +04:00
|
|
|
#include "FrameMetrics.h"
|
2012-09-11 08:30:33 +04:00
|
|
|
#include "ProcessUtils.h"
|
Bug 802366 - The main event: Let a browser process inherit its app's id. r=bz,cjones
The main bug fixed here is that in half of our interfaces, we use "is browser frame/element" to mean "browser or app", and in the other half, we use it to mean "is browser not app".
There's a related, functional bug also fixed here, which is that a browser process doesn't inherit its parent's app-id. This causes problems e.g. for IndexedDB: If a browser inside an app uses IndexedDB, the DB should have the app's app-id.
I also modified Tab{Parent,Child} and nsFrameLoader to call "app" "ownOrContainingApp", to emphasize that we might have inherited the app from a parent process. I left nsIDocShell::appId alone, because changing that would have necessitated changing nsILoadGroup and therefore a /lot/ of users in Necko; it's also not clear it would have clarified anything in those cases.
2012-11-10 22:32:37 +04:00
|
|
|
#include "mozilla/dom/TabContext.h"
|
2009-07-01 00:39:22 +04:00
|
|
|
|
2010-07-17 10:59:36 +04:00
|
|
|
struct gfxMatrix;
|
2013-02-16 02:27:21 +04:00
|
|
|
class nsICachedFileDescriptorListener;
|
2010-03-24 13:47:18 +03:00
|
|
|
|
2009-07-01 00:39:22 +04:00
|
|
|
namespace mozilla {
|
2010-08-21 03:24:41 +04:00
|
|
|
namespace layout {
|
|
|
|
class RenderFrameChild;
|
|
|
|
}
|
|
|
|
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
namespace layers {
|
|
|
|
struct TextureFactoryIdentifier;
|
|
|
|
}
|
|
|
|
|
2009-08-12 20:18:08 +04:00
|
|
|
namespace dom {
|
2009-07-01 00:39:22 +04:00
|
|
|
|
2009-11-17 17:22:23 +03:00
|
|
|
class TabChild;
|
2010-05-17 15:25:22 +04:00
|
|
|
class PContentDialogChild;
|
2012-08-02 10:02:29 +04:00
|
|
|
class ClonedMessageData;
|
2009-11-17 17:22:23 +03:00
|
|
|
|
2012-02-08 06:53:33 +04:00
|
|
|
class TabChildGlobal : public nsDOMEventTargetHelper,
|
2010-02-20 20:05:20 +03:00
|
|
|
public nsIContentFrameMessageManager,
|
|
|
|
public nsIScriptObjectPrincipal,
|
|
|
|
public nsIScriptContextPrincipal
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
TabChildGlobal(TabChild* aTabChild);
|
2012-04-27 00:56:46 +04:00
|
|
|
void Init();
|
2010-02-20 20:05:20 +03:00
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
2012-02-08 06:53:33 +04:00
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TabChildGlobal, nsDOMEventTargetHelper)
|
2012-08-27 18:13:02 +04:00
|
|
|
NS_FORWARD_SAFE_NSIMESSAGELISTENERMANAGER(mMessageManager)
|
|
|
|
NS_FORWARD_SAFE_NSIMESSAGESENDER(mMessageManager)
|
2011-10-01 20:14:36 +04:00
|
|
|
NS_IMETHOD SendSyncMessage(const nsAString& aMessageName,
|
2013-04-03 03:22:12 +04:00
|
|
|
const JS::Value& aObject,
|
2011-10-01 20:14:36 +04:00
|
|
|
JSContext* aCx,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t aArgc,
|
2013-04-03 03:22:12 +04:00
|
|
|
JS::Value* aRetval)
|
2010-02-20 20:05:20 +03:00
|
|
|
{
|
2011-10-01 20:14:36 +04:00
|
|
|
return mMessageManager
|
|
|
|
? mMessageManager->SendSyncMessage(aMessageName, aObject, aCx, aArgc, aRetval)
|
|
|
|
: NS_ERROR_NULL_POINTER;
|
2010-02-20 20:05:20 +03:00
|
|
|
}
|
|
|
|
NS_IMETHOD GetContent(nsIDOMWindow** aContent);
|
2010-03-03 23:30:25 +03:00
|
|
|
NS_IMETHOD GetDocShell(nsIDocShell** aDocShell);
|
2010-02-20 20:05:20 +03:00
|
|
|
NS_IMETHOD Dump(const nsAString& aStr)
|
|
|
|
{
|
|
|
|
return mMessageManager ? mMessageManager->Dump(aStr) : NS_OK;
|
|
|
|
}
|
2010-11-24 16:58:21 +03:00
|
|
|
NS_IMETHOD PrivateNoteIntentionalCrash();
|
2011-06-25 13:52:00 +04:00
|
|
|
NS_IMETHOD Btoa(const nsAString& aBinaryData,
|
|
|
|
nsAString& aAsciiBase64String);
|
|
|
|
NS_IMETHOD Atob(const nsAString& aAsciiString,
|
|
|
|
nsAString& aBinaryData);
|
2010-02-20 20:05:20 +03:00
|
|
|
|
|
|
|
NS_IMETHOD AddEventListener(const nsAString& aType,
|
|
|
|
nsIDOMEventListener* aListener,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aUseCapture)
|
2010-02-20 20:05:20 +03:00
|
|
|
{
|
|
|
|
// By default add listeners only for trusted events!
|
|
|
|
return nsDOMEventTargetHelper::AddEventListener(aType, aListener,
|
2011-10-17 18:59:28 +04:00
|
|
|
aUseCapture, false, 2);
|
2010-02-20 20:05:20 +03:00
|
|
|
}
|
2013-04-17 01:16:08 +04:00
|
|
|
using nsDOMEventTargetHelper::AddEventListener;
|
2010-02-20 20:05:20 +03:00
|
|
|
NS_IMETHOD AddEventListener(const nsAString& aType,
|
|
|
|
nsIDOMEventListener* aListener,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aUseCapture, bool aWantsUntrusted,
|
2012-08-22 19:56:38 +04:00
|
|
|
uint8_t optional_argc)
|
2010-02-20 20:05:20 +03:00
|
|
|
{
|
|
|
|
return nsDOMEventTargetHelper::AddEventListener(aType, aListener,
|
|
|
|
aUseCapture,
|
|
|
|
aWantsUntrusted,
|
|
|
|
optional_argc);
|
|
|
|
}
|
|
|
|
|
|
|
|
virtual nsIScriptObjectPrincipal* GetObjectPrincipal() { return this; }
|
|
|
|
virtual JSContext* GetJSContextForEventHandlers();
|
|
|
|
virtual nsIPrincipal* GetPrincipal();
|
|
|
|
|
|
|
|
nsCOMPtr<nsIContentFrameMessageManager> mMessageManager;
|
|
|
|
TabChild* mTabChild;
|
|
|
|
};
|
|
|
|
|
2012-06-15 06:31:55 +04:00
|
|
|
class ContentListener MOZ_FINAL : public nsIDOMEventListener
|
2009-11-17 17:22:23 +03:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
ContentListener(TabChild* aTabChild) : mTabChild(aTabChild) {}
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIDOMEVENTLISTENER
|
|
|
|
protected:
|
|
|
|
TabChild* mTabChild;
|
|
|
|
};
|
|
|
|
|
2010-07-19 22:33:33 +04:00
|
|
|
class TabChild : public PBrowserChild,
|
2010-08-18 14:02:49 +04:00
|
|
|
public nsFrameScriptExecutor,
|
2009-11-05 21:14:22 +03:00
|
|
|
public nsIWebBrowserChrome2,
|
2012-06-10 02:15:12 +04:00
|
|
|
public nsIEmbeddingSiteWindow,
|
2010-01-01 04:34:06 +03:00
|
|
|
public nsIWebBrowserChromeFocus,
|
2010-01-01 04:35:55 +03:00
|
|
|
public nsIInterfaceRequestor,
|
2010-03-26 21:39:39 +03:00
|
|
|
public nsIWindowProvider,
|
2012-09-29 06:18:18 +04:00
|
|
|
public nsIDOMEventListener,
|
|
|
|
public nsIWebProgressListener,
|
2010-05-13 21:44:51 +04:00
|
|
|
public nsSupportsWeakReference,
|
2010-05-17 15:25:22 +04:00
|
|
|
public nsIDialogCreator,
|
2012-08-09 00:37:57 +04:00
|
|
|
public nsITabChild,
|
2012-09-28 09:43:12 +04:00
|
|
|
public nsIObserver,
|
Bug 802366 - The main event: Let a browser process inherit its app's id. r=bz,cjones
The main bug fixed here is that in half of our interfaces, we use "is browser frame/element" to mean "browser or app", and in the other half, we use it to mean "is browser not app".
There's a related, functional bug also fixed here, which is that a browser process doesn't inherit its parent's app-id. This causes problems e.g. for IndexedDB: If a browser inside an app uses IndexedDB, the DB should have the app's app-id.
I also modified Tab{Parent,Child} and nsFrameLoader to call "app" "ownOrContainingApp", to emphasize that we might have inherited the app from a parent process. I left nsIDocShell::appId alone, because changing that would have necessitated changing nsILoadGroup and therefore a /lot/ of users in Necko; it's also not clear it would have clarified anything in those cases.
2012-11-10 22:32:37 +04:00
|
|
|
public ipc::MessageManagerCallback,
|
|
|
|
public TabContext
|
2009-07-01 00:39:22 +04:00
|
|
|
{
|
2012-08-02 10:02:29 +04:00
|
|
|
typedef mozilla::dom::ClonedMessageData ClonedMessageData;
|
2012-11-28 00:43:52 +04:00
|
|
|
typedef mozilla::layout::RenderFrameChild RenderFrameChild;
|
|
|
|
typedef mozilla::layout::ScrollingBehavior ScrollingBehavior;
|
2010-08-21 03:24:41 +04:00
|
|
|
|
2009-07-01 00:39:22 +04:00
|
|
|
public:
|
2012-08-29 19:26:18 +04:00
|
|
|
/**
|
|
|
|
* This is expected to be called off the critical path to content
|
|
|
|
* startup. This is an opportunity to load things that are slow
|
|
|
|
* on the critical path.
|
2012-06-22 05:17:52 +04:00
|
|
|
*/
|
2012-08-29 19:26:18 +04:00
|
|
|
static void PreloadSlowThings();
|
|
|
|
|
|
|
|
/** Return a TabChild with the given attributes. */
|
|
|
|
static already_AddRefed<TabChild>
|
Bug 802366 - The main event: Let a browser process inherit its app's id. r=bz,cjones
The main bug fixed here is that in half of our interfaces, we use "is browser frame/element" to mean "browser or app", and in the other half, we use it to mean "is browser not app".
There's a related, functional bug also fixed here, which is that a browser process doesn't inherit its parent's app-id. This causes problems e.g. for IndexedDB: If a browser inside an app uses IndexedDB, the DB should have the app's app-id.
I also modified Tab{Parent,Child} and nsFrameLoader to call "app" "ownOrContainingApp", to emphasize that we might have inherited the app from a parent process. I left nsIDocShell::appId alone, because changing that would have necessitated changing nsILoadGroup and therefore a /lot/ of users in Necko; it's also not clear it would have clarified anything in those cases.
2012-11-10 22:32:37 +04:00
|
|
|
Create(const TabContext& aContext, uint32_t aChromeFlags);
|
2012-08-29 19:26:18 +04:00
|
|
|
|
2009-07-01 00:39:22 +04:00
|
|
|
virtual ~TabChild();
|
2009-11-05 21:14:22 +03:00
|
|
|
|
2012-09-05 20:23:45 +04:00
|
|
|
bool IsRootContentDocument();
|
|
|
|
|
2009-11-05 21:14:22 +03:00
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIWEBBROWSERCHROME
|
|
|
|
NS_DECL_NSIWEBBROWSERCHROME2
|
|
|
|
NS_DECL_NSIEMBEDDINGSITEWINDOW
|
|
|
|
NS_DECL_NSIWEBBROWSERCHROMEFOCUS
|
2010-01-01 04:34:06 +03:00
|
|
|
NS_DECL_NSIINTERFACEREQUESTOR
|
2010-01-01 04:35:55 +03:00
|
|
|
NS_DECL_NSIWINDOWPROVIDER
|
2012-09-29 06:18:18 +04:00
|
|
|
NS_DECL_NSIDOMEVENTLISTENER
|
|
|
|
NS_DECL_NSIWEBPROGRESSLISTENER
|
2010-05-17 15:25:22 +04:00
|
|
|
NS_DECL_NSIDIALOGCREATOR
|
2012-05-28 13:27:25 +04:00
|
|
|
NS_DECL_NSITABCHILD
|
2012-08-09 00:37:57 +04:00
|
|
|
NS_DECL_NSIOBSERVER
|
2009-07-01 00:39:22 +04:00
|
|
|
|
2012-09-28 09:43:12 +04:00
|
|
|
/**
|
|
|
|
* MessageManagerCallback methods that we override.
|
|
|
|
*/
|
|
|
|
virtual bool DoSendSyncMessage(const nsAString& aMessage,
|
|
|
|
const mozilla::dom::StructuredCloneData& aData,
|
|
|
|
InfallibleTArray<nsString>* aJSONRetVal);
|
|
|
|
virtual bool DoSendAsyncMessage(const nsAString& aMessage,
|
|
|
|
const mozilla::dom::StructuredCloneData& aData);
|
|
|
|
|
2010-07-19 22:33:33 +04:00
|
|
|
virtual bool RecvLoadURL(const nsCString& uri);
|
2013-02-16 02:27:21 +04:00
|
|
|
virtual bool RecvCacheFileDescriptor(const nsString& aPath,
|
|
|
|
const FileDescriptor& aFileDescriptor)
|
|
|
|
MOZ_OVERRIDE;
|
2010-08-21 03:24:40 +04:00
|
|
|
virtual bool RecvShow(const nsIntSize& size);
|
2013-03-04 18:37:43 +04:00
|
|
|
virtual bool RecvUpdateDimensions(const nsRect& rect, const nsIntSize& size, const ScreenOrientation& orientation);
|
2012-08-09 08:39:02 +04:00
|
|
|
virtual bool RecvUpdateFrame(const mozilla::layers::FrameMetrics& aFrameMetrics);
|
|
|
|
virtual bool RecvHandleDoubleTap(const nsIntPoint& aPoint);
|
2012-09-15 05:16:32 +04:00
|
|
|
virtual bool RecvHandleSingleTap(const nsIntPoint& aPoint);
|
2012-11-08 23:35:02 +04:00
|
|
|
virtual bool RecvHandleLongTap(const nsIntPoint& aPoint);
|
2010-07-19 22:33:33 +04:00
|
|
|
virtual bool RecvActivate();
|
2011-06-18 04:08:32 +04:00
|
|
|
virtual bool RecvDeactivate();
|
2010-07-19 22:33:33 +04:00
|
|
|
virtual bool RecvMouseEvent(const nsString& aType,
|
|
|
|
const float& aX,
|
|
|
|
const float& aY,
|
2012-08-22 19:56:38 +04:00
|
|
|
const int32_t& aButton,
|
|
|
|
const int32_t& aClickCount,
|
|
|
|
const int32_t& aModifiers,
|
2010-07-19 22:33:33 +04:00
|
|
|
const bool& aIgnoreRootScrollFrame);
|
2011-06-22 04:32:43 +04:00
|
|
|
virtual bool RecvRealMouseEvent(const nsMouseEvent& event);
|
|
|
|
virtual bool RecvRealKeyEvent(const nsKeyEvent& event);
|
2012-08-12 05:42:34 +04:00
|
|
|
virtual bool RecvMouseWheelEvent(const mozilla::widget::WheelEvent& event);
|
2012-07-16 06:58:43 +04:00
|
|
|
virtual bool RecvRealTouchEvent(const nsTouchEvent& event);
|
2012-08-22 14:54:20 +04:00
|
|
|
virtual bool RecvRealTouchMoveEvent(const nsTouchEvent& event);
|
2010-07-19 22:33:33 +04:00
|
|
|
virtual bool RecvKeyEvent(const nsString& aType,
|
2012-08-22 19:56:38 +04:00
|
|
|
const int32_t& aKeyCode,
|
|
|
|
const int32_t& aCharCode,
|
|
|
|
const int32_t& aModifiers,
|
2010-07-19 22:33:33 +04:00
|
|
|
const bool& aPreventDefault);
|
2010-08-17 12:07:42 +04:00
|
|
|
virtual bool RecvCompositionEvent(const nsCompositionEvent& event);
|
|
|
|
virtual bool RecvTextEvent(const nsTextEvent& event);
|
|
|
|
virtual bool RecvSelectionEvent(const nsSelectionEvent& event);
|
2010-07-19 22:33:33 +04:00
|
|
|
virtual bool RecvActivateFrameEvent(const nsString& aType, const bool& capture);
|
|
|
|
virtual bool RecvLoadRemoteScript(const nsString& aURL);
|
|
|
|
virtual bool RecvAsyncMessage(const nsString& aMessage,
|
2012-08-02 10:02:29 +04:00
|
|
|
const ClonedMessageData& aData);
|
2010-10-27 02:20:53 +04:00
|
|
|
|
|
|
|
virtual PDocumentRendererChild*
|
2010-10-27 02:20:53 +04:00
|
|
|
AllocPDocumentRenderer(const nsRect& documentRect, const gfxMatrix& transform,
|
|
|
|
const nsString& bgcolor,
|
2012-08-22 19:56:38 +04:00
|
|
|
const uint32_t& renderFlags, const bool& flushLayout,
|
2010-10-27 02:20:53 +04:00
|
|
|
const nsIntSize& renderSize);
|
2009-12-03 11:16:14 +03:00
|
|
|
virtual bool DeallocPDocumentRenderer(PDocumentRendererChild* actor);
|
2010-10-27 02:20:53 +04:00
|
|
|
virtual bool RecvPDocumentRendererConstructor(PDocumentRendererChild* actor,
|
|
|
|
const nsRect& documentRect,
|
2010-10-27 02:20:53 +04:00
|
|
|
const gfxMatrix& transform,
|
2010-10-27 02:20:53 +04:00
|
|
|
const nsString& bgcolor,
|
2012-08-22 19:56:38 +04:00
|
|
|
const uint32_t& renderFlags,
|
2010-10-27 02:20:53 +04:00
|
|
|
const bool& flushLayout,
|
|
|
|
const nsIntSize& renderSize);
|
2010-10-27 02:20:53 +04:00
|
|
|
|
2012-08-22 19:56:38 +04:00
|
|
|
virtual PContentDialogChild* AllocPContentDialog(const uint32_t&,
|
2010-05-17 15:25:22 +04:00
|
|
|
const nsCString&,
|
|
|
|
const nsCString&,
|
2010-11-09 05:49:00 +03:00
|
|
|
const InfallibleTArray<int>&,
|
|
|
|
const InfallibleTArray<nsString>&);
|
2010-05-17 15:25:22 +04:00
|
|
|
virtual bool DeallocPContentDialog(PContentDialogChild* aDialog);
|
|
|
|
static void ParamsToArrays(nsIDialogParamBlock* aParams,
|
2010-11-09 05:49:00 +03:00
|
|
|
InfallibleTArray<int>& aIntParams,
|
|
|
|
InfallibleTArray<nsString>& aStringParams);
|
|
|
|
static void ArraysToParams(const InfallibleTArray<int>& aIntParams,
|
|
|
|
const InfallibleTArray<nsString>& aStringParams,
|
2010-05-17 15:25:22 +04:00
|
|
|
nsIDialogParamBlock* aParams);
|
2009-07-01 00:39:22 +04:00
|
|
|
|
2012-07-18 23:09:28 +04:00
|
|
|
#ifdef DEBUG
|
|
|
|
virtual PContentPermissionRequestChild* SendPContentPermissionRequestConstructor(PContentPermissionRequestChild* aActor,
|
|
|
|
const nsCString& aType,
|
2012-11-14 04:06:42 +04:00
|
|
|
const nsCString& aAccess,
|
2012-07-30 18:58:26 +04:00
|
|
|
const IPC::Principal& aPrincipal)
|
2012-07-18 23:09:28 +04:00
|
|
|
{
|
|
|
|
PCOMContentPermissionRequestChild* child = static_cast<PCOMContentPermissionRequestChild*>(aActor);
|
2012-11-14 04:06:42 +04:00
|
|
|
PContentPermissionRequestChild* request = PBrowserChild::SendPContentPermissionRequestConstructor(aActor, aType, aAccess, aPrincipal);
|
2012-07-18 23:09:28 +04:00
|
|
|
child->mIPCOpen = true;
|
|
|
|
return request;
|
|
|
|
}
|
|
|
|
#endif /* DEBUG */
|
|
|
|
|
2012-11-14 04:06:42 +04:00
|
|
|
virtual PContentPermissionRequestChild* AllocPContentPermissionRequest(const nsCString& aType,
|
|
|
|
const nsCString& aAccess,
|
|
|
|
const IPC::Principal& aPrincipal);
|
2010-09-10 09:00:08 +04:00
|
|
|
virtual bool DeallocPContentPermissionRequest(PContentPermissionRequestChild* actor);
|
2010-05-13 21:44:51 +04:00
|
|
|
|
2012-07-31 10:36:00 +04:00
|
|
|
virtual POfflineCacheUpdateChild* AllocPOfflineCacheUpdate(
|
|
|
|
const URIParams& manifestURI,
|
2012-08-23 23:33:46 +04:00
|
|
|
const URIParams& documentURI,
|
2010-10-20 21:12:32 +04:00
|
|
|
const bool& stickDocument);
|
|
|
|
virtual bool DeallocPOfflineCacheUpdate(POfflineCacheUpdateChild* offlineCacheUpdate);
|
|
|
|
|
2010-02-20 20:05:20 +03:00
|
|
|
nsIWebNavigation* WebNavigation() { return mWebNav; }
|
|
|
|
|
|
|
|
JSContext* GetJSContext() { return mCx; }
|
|
|
|
|
|
|
|
nsIPrincipal* GetPrincipal() { return mPrincipal; }
|
2009-11-06 23:43:39 +03:00
|
|
|
|
2012-08-29 19:26:18 +04:00
|
|
|
/** Return the DPI of the widget this TabChild draws to. */
|
|
|
|
void GetDPI(float* aDPI);
|
2013-05-02 03:06:19 +04:00
|
|
|
void GetDefaultScale(double *aScale);
|
2012-08-29 19:26:18 +04:00
|
|
|
|
2013-03-04 18:37:43 +04:00
|
|
|
gfxSize GetZoom() { return mLastMetrics.mZoom; }
|
2012-12-12 02:49:57 +04:00
|
|
|
|
2012-11-22 06:40:57 +04:00
|
|
|
ScreenOrientation GetOrientation() { return mOrientation; }
|
|
|
|
|
2011-10-21 02:17:09 +04:00
|
|
|
void SetBackgroundColor(const nscolor& aColor);
|
2012-07-18 03:59:45 +04:00
|
|
|
|
|
|
|
void NotifyPainted();
|
2012-07-20 10:48:27 +04:00
|
|
|
|
|
|
|
bool IsAsyncPanZoomEnabled();
|
|
|
|
|
2012-11-08 07:51:55 +04:00
|
|
|
/**
|
|
|
|
* Signal to this TabChild that it should be made visible:
|
|
|
|
* activated widget, retained layer tree, etc. (Respectively,
|
|
|
|
* made not visible.)
|
|
|
|
*/
|
|
|
|
void MakeVisible();
|
|
|
|
void MakeHidden();
|
|
|
|
|
2013-02-16 02:27:21 +04:00
|
|
|
// Returns true if the file descriptor was found in the cache, false
|
|
|
|
// otherwise.
|
|
|
|
bool GetCachedFileDescriptor(const nsAString& aPath,
|
|
|
|
nsICachedFileDescriptorListener* aCallback);
|
|
|
|
|
|
|
|
void CancelCachedFileDescriptorCallback(
|
|
|
|
const nsAString& aPath,
|
|
|
|
nsICachedFileDescriptorListener* aCallback);
|
|
|
|
|
2010-08-06 02:11:23 +04:00
|
|
|
protected:
|
2012-07-20 10:48:27 +04:00
|
|
|
virtual PRenderFrameChild* AllocPRenderFrame(ScrollingBehavior* aScrolling,
|
Bug 825928: Land layers refactoring. r=jrmuizel,bas,nical,mattwoodrow,roc,nrc,benwa,bjacob,jgilbert,kchen CLOSED TREE
Please contact Bas Schouten <bschouten@mozilla.com>, Nicolas Silva <nsilva@mozilla.com> or Nicholas Cameron <ncameron@mozilla.com> with general questions. Below is a rough list of authors to contact with specific questions.
Authors:
gfx/layers/Compositor.* gfx/layers/Effects.h - Compositor Interface - bas,nrc,nical
gfx/layers/d3d* - D3D9/D3D10 - bas
gfx/layers/ThebesLayer* - ThebesLayers - nrc,bas
gfx/layers/composite/* - CompositeLayers - nrc,nical
gfx/layers/client/* - Client - nrc,nical,bas
gfx/layers/*Image* - nical
gfx/layers/ipc ipc - IPC - nical
gfx/layers/opengl - CompositorOGL - nrc,nical
gfx/2d - bas,nrc
gfx/gl - GLContext - bjacob
dom/* layout/* - DOM - mattwoodrow
2013-04-10 13:20:52 +04:00
|
|
|
TextureFactoryIdentifier* aTextureFactoryIdentifier,
|
2012-07-06 22:15:45 +04:00
|
|
|
uint64_t* aLayersId) MOZ_OVERRIDE;
|
|
|
|
virtual bool DeallocPRenderFrame(PRenderFrameChild* aFrame) MOZ_OVERRIDE;
|
|
|
|
virtual bool RecvDestroy() MOZ_OVERRIDE;
|
2010-08-06 02:11:23 +04:00
|
|
|
|
2012-07-16 06:58:43 +04:00
|
|
|
nsEventStatus DispatchWidgetEvent(nsGUIEvent& event);
|
2010-08-17 12:07:42 +04:00
|
|
|
|
2012-06-01 21:21:12 +04:00
|
|
|
virtual PIndexedDBChild* AllocPIndexedDB(const nsCString& aASCIIOrigin,
|
|
|
|
bool* /* aAllowed */);
|
|
|
|
|
2012-07-14 15:24:20 +04:00
|
|
|
virtual bool DeallocPIndexedDB(PIndexedDBChild* aActor);
|
2012-06-01 21:21:12 +04:00
|
|
|
|
2009-07-01 00:39:22 +04:00
|
|
|
private:
|
2012-08-29 19:26:18 +04:00
|
|
|
/**
|
|
|
|
* Create a new TabChild object.
|
|
|
|
*
|
Bug 802366 - The main event: Let a browser process inherit its app's id. r=bz,cjones
The main bug fixed here is that in half of our interfaces, we use "is browser frame/element" to mean "browser or app", and in the other half, we use it to mean "is browser not app".
There's a related, functional bug also fixed here, which is that a browser process doesn't inherit its parent's app-id. This causes problems e.g. for IndexedDB: If a browser inside an app uses IndexedDB, the DB should have the app's app-id.
I also modified Tab{Parent,Child} and nsFrameLoader to call "app" "ownOrContainingApp", to emphasize that we might have inherited the app from a parent process. I left nsIDocShell::appId alone, because changing that would have necessitated changing nsILoadGroup and therefore a /lot/ of users in Necko; it's also not clear it would have clarified anything in those cases.
2012-11-10 22:32:37 +04:00
|
|
|
* |aOwnOrContainingAppId| is the app-id of our frame or of the closest app
|
|
|
|
* frame in the hierarchy which contains us.
|
|
|
|
*
|
|
|
|
* |aIsBrowserElement| indicates whether we're a browser (but not an app).
|
2012-08-29 19:26:18 +04:00
|
|
|
*/
|
Bug 802366 - The main event: Let a browser process inherit its app's id. r=bz,cjones
The main bug fixed here is that in half of our interfaces, we use "is browser frame/element" to mean "browser or app", and in the other half, we use it to mean "is browser not app".
There's a related, functional bug also fixed here, which is that a browser process doesn't inherit its parent's app-id. This causes problems e.g. for IndexedDB: If a browser inside an app uses IndexedDB, the DB should have the app's app-id.
I also modified Tab{Parent,Child} and nsFrameLoader to call "app" "ownOrContainingApp", to emphasize that we might have inherited the app from a parent process. I left nsIDocShell::appId alone, because changing that would have necessitated changing nsILoadGroup and therefore a /lot/ of users in Necko; it's also not clear it would have clarified anything in those cases.
2012-11-10 22:32:37 +04:00
|
|
|
TabChild(const TabContext& aContext, uint32_t aChromeFlags);
|
2012-08-29 19:26:18 +04:00
|
|
|
|
|
|
|
nsresult Init();
|
|
|
|
|
Bug 802366 - The main event: Let a browser process inherit its app's id. r=bz,cjones
The main bug fixed here is that in half of our interfaces, we use "is browser frame/element" to mean "browser or app", and in the other half, we use it to mean "is browser not app".
There's a related, functional bug also fixed here, which is that a browser process doesn't inherit its parent's app-id. This causes problems e.g. for IndexedDB: If a browser inside an app uses IndexedDB, the DB should have the app's app-id.
I also modified Tab{Parent,Child} and nsFrameLoader to call "app" "ownOrContainingApp", to emphasize that we might have inherited the app from a parent process. I left nsIDocShell::appId alone, because changing that would have necessitated changing nsILoadGroup and therefore a /lot/ of users in Necko; it's also not clear it would have clarified anything in those cases.
2012-11-10 22:32:37 +04:00
|
|
|
// Notify others that our TabContext has been updated. (At the moment, this
|
|
|
|
// sets the appropriate app-id and is-browser flags on our docshell.)
|
|
|
|
//
|
|
|
|
// You should call this after calling TabContext::SetTabContext(). We also
|
|
|
|
// call this during Init().
|
|
|
|
void NotifyTabContextUpdated();
|
2012-08-29 19:26:18 +04:00
|
|
|
|
2012-07-18 03:59:45 +04:00
|
|
|
bool UseDirectCompositor();
|
|
|
|
|
2010-07-22 03:23:03 +04:00
|
|
|
void ActorDestroy(ActorDestroyReason why);
|
|
|
|
|
2012-08-29 19:26:18 +04:00
|
|
|
enum FrameScriptLoading { DONT_LOAD_SCRIPTS, DEFAULT_LOAD_SCRIPTS };
|
|
|
|
bool InitTabChildGlobal(FrameScriptLoading aScriptLoading = DEFAULT_LOAD_SCRIPTS);
|
|
|
|
bool InitRenderingState();
|
2010-08-21 03:24:40 +04:00
|
|
|
void DestroyWindow();
|
2012-09-11 08:30:33 +04:00
|
|
|
void SetProcessNameToAppName();
|
2010-02-20 20:05:20 +03:00
|
|
|
|
2012-06-13 02:01:25 +04:00
|
|
|
// Call RecvShow(nsIntSize(0, 0)) and block future calls to RecvShow().
|
|
|
|
void DoFakeShow();
|
|
|
|
|
2012-09-29 06:18:18 +04:00
|
|
|
// Wrapper for nsIDOMWindowUtils.setCSSViewport(). This updates some state
|
|
|
|
// variables local to this class before setting it.
|
|
|
|
void SetCSSViewport(float aX, float aY);
|
|
|
|
|
2012-10-12 09:46:24 +04:00
|
|
|
// Recalculates the display state, including the CSS
|
|
|
|
// viewport. This should be called whenever we believe the
|
|
|
|
// viewport data on a document may have changed. If it didn't
|
|
|
|
// change, this function doesn't do anything. However, it should
|
|
|
|
// not be called all the time as it is fairly expensive.
|
|
|
|
void HandlePossibleViewportChange();
|
2012-09-29 06:18:18 +04:00
|
|
|
|
2012-08-09 08:39:02 +04:00
|
|
|
// Wraps up a JSON object as a structured clone and sends it to the browser
|
|
|
|
// chrome script.
|
|
|
|
//
|
|
|
|
// XXX/bug 780335: Do the work the browser chrome script does in C++ instead
|
|
|
|
// so we don't need things like this.
|
|
|
|
void DispatchMessageManagerMessage(const nsAString& aMessageName,
|
|
|
|
const nsACString& aJSONData);
|
|
|
|
|
2013-01-05 18:53:16 +04:00
|
|
|
void DispatchSynthesizedMouseEvent(uint32_t aMsg, uint64_t aTime,
|
|
|
|
const nsIntPoint& aRefPoint);
|
|
|
|
|
|
|
|
// These methods are used for tracking synthetic mouse events
|
|
|
|
// dispatched for compatibility. On each touch event, we
|
|
|
|
// UpdateTapState(). If we've detected that the current gesture
|
|
|
|
// isn't a tap, then we CancelTapTracking(). In the meantime, we
|
|
|
|
// may detect a context-menu event, and if so we
|
|
|
|
// FireContextMenuEvent().
|
|
|
|
void FireContextMenuEvent();
|
|
|
|
void CancelTapTracking();
|
|
|
|
void UpdateTapState(const nsTouchEvent& aEvent, nsEventStatus aStatus);
|
2012-09-15 05:16:32 +04:00
|
|
|
|
2012-06-13 02:01:25 +04:00
|
|
|
nsresult
|
|
|
|
BrowserFrameProvideWindow(nsIDOMWindow* aOpener,
|
|
|
|
nsIURI* aURI,
|
|
|
|
const nsAString& aName,
|
|
|
|
const nsACString& aFeatures,
|
|
|
|
bool* aWindowIsNew,
|
|
|
|
nsIDOMWindow** aReturn);
|
|
|
|
|
2012-09-29 06:18:18 +04:00
|
|
|
nsIDOMWindowUtils* GetDOMWindowUtils()
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsPIDOMWindow> window = do_GetInterface(mWebNav);
|
|
|
|
nsCOMPtr<nsIDOMWindowUtils> utils = do_GetInterface(window);
|
|
|
|
return utils;
|
|
|
|
}
|
|
|
|
|
2013-02-16 02:27:21 +04:00
|
|
|
class CachedFileDescriptorInfo;
|
|
|
|
class CachedFileDescriptorCallbackRunnable;
|
|
|
|
|
2013-05-01 04:42:05 +04:00
|
|
|
TextureFactoryIdentifier mTextureFactoryIdentifier;
|
2009-07-01 00:39:22 +04:00
|
|
|
nsCOMPtr<nsIWebNavigation> mWebNav;
|
2010-08-21 03:24:40 +04:00
|
|
|
nsCOMPtr<nsIWidget> mWidget;
|
2012-09-29 06:18:18 +04:00
|
|
|
nsCOMPtr<nsIURI> mLastURI;
|
|
|
|
FrameMetrics mLastMetrics;
|
2010-08-21 03:24:41 +04:00
|
|
|
RenderFrameChild* mRemoteFrame;
|
2010-08-23 12:44:43 +04:00
|
|
|
nsRefPtr<TabChildGlobal> mTabChildGlobal;
|
2012-08-22 19:56:38 +04:00
|
|
|
uint32_t mChromeFlags;
|
2013-03-04 18:37:43 +04:00
|
|
|
nsIntRect mOuterRect;
|
|
|
|
nsIntSize mInnerSize;
|
2013-01-05 18:53:16 +04:00
|
|
|
// When we're tracking a possible tap gesture, this is the "down"
|
|
|
|
// point of the touchstart.
|
|
|
|
nsIntPoint mGestureDownPoint;
|
|
|
|
// The touch identifier of the active gesture.
|
|
|
|
int32_t mActivePointerId;
|
|
|
|
// A timer task that fires if the tap-hold timeout is exceeded by
|
|
|
|
// the touch we're tracking. That is, if touchend or a touchmove
|
|
|
|
// that exceeds the gesture threshold doesn't happen.
|
|
|
|
CancelableTask* mTapHoldTimer;
|
2013-02-16 02:27:21 +04:00
|
|
|
// At present only 1 of these is really expected.
|
|
|
|
nsAutoTArray<nsAutoPtr<CachedFileDescriptorInfo>, 1>
|
|
|
|
mCachedFileDescriptorInfos;
|
2012-09-29 06:18:18 +04:00
|
|
|
float mOldViewportWidth;
|
2011-10-21 02:17:09 +04:00
|
|
|
nscolor mLastBackgroundColor;
|
2012-07-20 10:48:27 +04:00
|
|
|
ScrollingBehavior mScrolling;
|
Bug 802366 - The main event: Let a browser process inherit its app's id. r=bz,cjones DONTBUILD
The main bug fixed here is that in half of our interfaces, we use "is browser frame/element" to mean "browser or app", and in the other half, we use it to mean "is browser not app".
There's a related, functional bug also fixed here, which is that a browser process doesn't inherit its parent's app-id. This causes problems e.g. for IndexedDB: If a browser inside an app uses IndexedDB, the DB should have the app's app-id.
I also modified Tab{Parent,Child} and nsFrameLoader to call "app" "ownOrContainingApp", to emphasize that we might have inherited the app from a parent process. I left nsIDocShell::appId alone, because changing that would have necessitated changing nsILoadGroup and therefore a /lot/ of users in Necko; it's also not clear it would have clarified anything in those cases.
(Re-landing changeset a6a847452dbf, backed out in 5091aa6083c4, because it was originally landed with the incorrect bug number.)
2012-10-31 00:13:21 +04:00
|
|
|
bool mDidFakeShow;
|
2012-08-07 07:00:41 +04:00
|
|
|
bool mNotified;
|
2012-09-29 06:18:18 +04:00
|
|
|
bool mContentDocumentIsDisplayed;
|
2012-08-29 19:26:18 +04:00
|
|
|
bool mTriedBrowserInit;
|
2012-11-22 06:40:57 +04:00
|
|
|
ScreenOrientation mOrientation;
|
2010-02-20 20:05:20 +03:00
|
|
|
|
2009-07-01 00:39:22 +04:00
|
|
|
DISALLOW_EVIL_CONSTRUCTORS(TabChild);
|
|
|
|
};
|
|
|
|
|
2010-08-06 02:11:23 +04:00
|
|
|
inline TabChild*
|
|
|
|
GetTabChildFrom(nsIDocShell* aDocShell)
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsITabChild> tc = do_GetInterface(aDocShell);
|
|
|
|
return static_cast<TabChild*>(tc.get());
|
|
|
|
}
|
|
|
|
|
|
|
|
inline TabChild*
|
|
|
|
GetTabChildFrom(nsIPresShell* aPresShell)
|
|
|
|
{
|
|
|
|
nsIDocument* doc = aPresShell->GetDocument();
|
|
|
|
if (!doc) {
|
2012-07-30 18:20:58 +04:00
|
|
|
return nullptr;
|
2010-08-06 02:11:23 +04:00
|
|
|
}
|
|
|
|
nsCOMPtr<nsISupports> container = doc->GetContainer();
|
|
|
|
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(container));
|
|
|
|
return GetTabChildFrom(docShell);
|
|
|
|
}
|
|
|
|
|
2011-09-30 11:00:48 +04:00
|
|
|
inline TabChild*
|
|
|
|
GetTabChildFrom(nsIDOMWindow* aWindow)
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsIWebNavigation> webNav = do_GetInterface(aWindow);
|
|
|
|
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(webNav);
|
|
|
|
return GetTabChildFrom(docShell);
|
|
|
|
}
|
|
|
|
|
2009-07-01 00:39:22 +04:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-08-21 03:24:41 +04:00
|
|
|
#endif // mozilla_dom_TabChild_h
|