2009-07-01 00:39:22 +04:00
|
|
|
/* -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 8; -*- */
|
2009-08-18 23:05:15 +04:00
|
|
|
/* vim: set sw=4 ts=8 et tw=80 : */
|
2009-09-10 02:00:14 +04:00
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Original Code is Mozilla Content App.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* The Mozilla Foundation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 2009
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
|
|
|
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
2009-07-01 00:39:22 +04:00
|
|
|
|
|
|
|
#ifndef mozilla_tabs_TabChild_h
|
|
|
|
#define mozilla_tabs_TabChild_h
|
|
|
|
|
2010-02-20 20:05:20 +03:00
|
|
|
#ifndef _IMPL_NS_LAYOUT
|
2009-09-10 02:59:06 +04:00
|
|
|
#include "mozilla/dom/PIFrameEmbeddingChild.h"
|
2010-02-20 20:05:20 +03:00
|
|
|
#endif
|
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"
|
|
|
|
#include "nsIEmbeddingSiteWindow2.h"
|
|
|
|
#include "nsIWebBrowserChromeFocus.h"
|
2010-03-26 21:39:39 +03:00
|
|
|
#include "nsIWebProgressListener.h"
|
|
|
|
#include "nsIWebProgressListener2.h"
|
2009-11-17 17:22:23 +03:00
|
|
|
#include "nsIDOMEventListener.h"
|
|
|
|
#include "nsIDOMEventTarget.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-02-20 20:05:20 +03:00
|
|
|
#include "nsNetUtil.h"
|
|
|
|
#include "nsFrameMessageManager.h"
|
|
|
|
#include "nsIScriptContext.h"
|
|
|
|
#include "nsDOMEventTargetHelper.h"
|
2010-05-17 15:25:22 +04:00
|
|
|
#include "nsIDialogCreator.h"
|
|
|
|
#include "nsIDialogParamBlock.h"
|
2010-02-20 20:05:20 +03:00
|
|
|
#include "nsIPrincipal.h"
|
|
|
|
#include "nsIScriptObjectPrincipal.h"
|
|
|
|
#include "nsIScriptContext.h"
|
2010-03-26 21:39:39 +03:00
|
|
|
#include "nsWeakReference.h"
|
2010-05-13 21:44:51 +04:00
|
|
|
#include "nsITabChild.h"
|
2009-07-01 00:39:22 +04:00
|
|
|
|
2010-03-24 13:47:18 +03:00
|
|
|
class gfxMatrix;
|
|
|
|
|
2009-07-01 00:39:22 +04:00
|
|
|
namespace mozilla {
|
2009-11-06 23:43:39 +03:00
|
|
|
|
|
|
|
namespace jsipc {
|
|
|
|
class PContextWrapperChild;
|
2010-03-30 00:29:45 +04:00
|
|
|
class ContextWrapperChild;
|
2009-11-06 23:43:39 +03:00
|
|
|
}
|
|
|
|
|
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;
|
2009-11-17 17:22:23 +03:00
|
|
|
|
2010-02-20 20:05:20 +03:00
|
|
|
class TabChildGlobal : public nsDOMEventTargetHelper,
|
|
|
|
public nsIContentFrameMessageManager,
|
|
|
|
public nsIScriptObjectPrincipal,
|
|
|
|
public nsIScriptContextPrincipal
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
TabChildGlobal(TabChild* aTabChild);
|
|
|
|
NS_DECL_ISUPPORTS_INHERITED
|
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TabChildGlobal, nsDOMEventTargetHelper)
|
|
|
|
NS_FORWARD_SAFE_NSIFRAMEMESSAGEMANAGER(mMessageManager)
|
|
|
|
NS_IMETHOD SendSyncMessage()
|
|
|
|
{
|
|
|
|
return mMessageManager ? mMessageManager->SendSyncMessage()
|
|
|
|
: NS_ERROR_NULL_POINTER;
|
|
|
|
}
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
|
|
|
|
NS_IMETHOD AddEventListener(const nsAString& aType,
|
|
|
|
nsIDOMEventListener* aListener,
|
|
|
|
PRBool aUseCapture)
|
|
|
|
{
|
|
|
|
// By default add listeners only for trusted events!
|
|
|
|
return nsDOMEventTargetHelper::AddEventListener(aType, aListener,
|
|
|
|
aUseCapture, PR_FALSE, 1);
|
|
|
|
}
|
|
|
|
NS_IMETHOD AddEventListener(const nsAString& aType,
|
|
|
|
nsIDOMEventListener* aListener,
|
|
|
|
PRBool aUseCapture, PRBool aWantsUntrusted,
|
|
|
|
PRUint8 optional_argc)
|
|
|
|
{
|
|
|
|
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;
|
|
|
|
};
|
|
|
|
|
2009-11-17 17:22:23 +03:00
|
|
|
class ContentListener : public nsIDOMEventListener
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ContentListener(TabChild* aTabChild) : mTabChild(aTabChild) {}
|
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIDOMEVENTLISTENER
|
|
|
|
protected:
|
|
|
|
TabChild* mTabChild;
|
|
|
|
};
|
|
|
|
|
2009-11-05 21:14:22 +03:00
|
|
|
class TabChild : public PIFrameEmbeddingChild,
|
2010-03-26 21:39:39 +03:00
|
|
|
public nsIWebProgressListener2,
|
2009-11-05 21:14:22 +03:00
|
|
|
public nsIWebBrowserChrome2,
|
|
|
|
public nsIEmbeddingSiteWindow2,
|
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,
|
2010-05-13 21:44:51 +04:00
|
|
|
public nsSupportsWeakReference,
|
2010-05-17 15:25:22 +04:00
|
|
|
public nsIDialogCreator,
|
2010-05-13 21:44:51 +04:00
|
|
|
public nsITabChild
|
2009-07-01 00:39:22 +04:00
|
|
|
{
|
|
|
|
public:
|
2009-10-28 23:41:46 +03:00
|
|
|
TabChild();
|
2009-07-01 00:39:22 +04:00
|
|
|
virtual ~TabChild();
|
2009-11-13 15:43:43 +03:00
|
|
|
bool destroyWidget();
|
2009-11-05 21:14:22 +03:00
|
|
|
nsresult Init();
|
|
|
|
|
|
|
|
NS_DECL_ISUPPORTS
|
2010-03-26 21:39:39 +03:00
|
|
|
NS_DECL_NSIWEBPROGRESSLISTENER
|
|
|
|
NS_DECL_NSIWEBPROGRESSLISTENER2
|
2009-11-05 21:14:22 +03:00
|
|
|
NS_DECL_NSIWEBBROWSERCHROME
|
|
|
|
NS_DECL_NSIWEBBROWSERCHROME2
|
|
|
|
NS_DECL_NSIEMBEDDINGSITEWINDOW
|
|
|
|
NS_DECL_NSIEMBEDDINGSITEWINDOW2
|
|
|
|
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
|
2010-05-17 15:25:22 +04:00
|
|
|
NS_DECL_NSIDIALOGCREATOR
|
2009-07-01 00:39:22 +04:00
|
|
|
|
2009-10-28 23:41:46 +03:00
|
|
|
virtual bool RecvcreateWidget(const MagicWindowHandle& parentWidget);
|
2009-09-18 03:09:20 +04:00
|
|
|
virtual bool RecvloadURL(const nsCString& uri);
|
|
|
|
virtual bool Recvmove(const PRUint32& x,
|
|
|
|
const PRUint32& y,
|
|
|
|
const PRUint32& width,
|
|
|
|
const PRUint32& height);
|
2009-11-05 21:14:22 +03:00
|
|
|
virtual bool Recvactivate();
|
2009-11-05 21:21:09 +03:00
|
|
|
virtual bool RecvsendMouseEvent(const nsString& aType,
|
|
|
|
const PRInt32& aX,
|
|
|
|
const PRInt32& aY,
|
|
|
|
const PRInt32& aButton,
|
|
|
|
const PRInt32& aClickCount,
|
|
|
|
const PRInt32& aModifiers,
|
|
|
|
const bool& aIgnoreRootScrollFrame);
|
2010-03-19 09:52:18 +03:00
|
|
|
virtual bool RecvsendKeyEvent(const nsString& aType,
|
|
|
|
const PRInt32& aKeyCode,
|
|
|
|
const PRInt32& aCharCode,
|
|
|
|
const PRInt32& aModifiers,
|
|
|
|
const bool& aPreventDefault);
|
2009-11-17 17:22:23 +03:00
|
|
|
virtual bool RecvactivateFrameEvent(const nsString& aType, const bool& capture);
|
2010-02-20 20:05:20 +03:00
|
|
|
virtual bool RecvloadRemoteScript(const nsString& aURL);
|
|
|
|
virtual bool RecvsendAsyncMessageToChild(const nsString& aMessage,
|
|
|
|
const nsString& aJSON);
|
2009-10-29 20:58:31 +03:00
|
|
|
virtual mozilla::ipc::PDocumentRendererChild* AllocPDocumentRenderer(
|
|
|
|
const PRInt32& x,
|
|
|
|
const PRInt32& y,
|
|
|
|
const PRInt32& w,
|
|
|
|
const PRInt32& h,
|
|
|
|
const nsString& bgcolor,
|
|
|
|
const PRUint32& flags,
|
|
|
|
const bool& flush);
|
2009-12-03 11:16:14 +03:00
|
|
|
virtual bool DeallocPDocumentRenderer(PDocumentRendererChild* actor);
|
2009-10-29 20:58:31 +03:00
|
|
|
virtual bool RecvPDocumentRendererConstructor(
|
|
|
|
mozilla::ipc::PDocumentRendererChild *__a,
|
|
|
|
const PRInt32& x,
|
|
|
|
const PRInt32& y,
|
|
|
|
const PRInt32& w,
|
|
|
|
const PRInt32& h,
|
|
|
|
const nsString& bgcolor,
|
|
|
|
const PRUint32& flags,
|
|
|
|
const bool& flush);
|
2010-05-17 15:25:22 +04:00
|
|
|
virtual PContentDialogChild* AllocPContentDialog(const PRUint32&,
|
|
|
|
const nsCString&,
|
|
|
|
const nsCString&,
|
|
|
|
const nsTArray<int>&,
|
|
|
|
const nsTArray<nsString>&);
|
|
|
|
virtual bool DeallocPContentDialog(PContentDialogChild* aDialog);
|
|
|
|
static void ParamsToArrays(nsIDialogParamBlock* aParams,
|
|
|
|
nsTArray<int>& aIntParams,
|
|
|
|
nsTArray<nsString>& aStringParams);
|
|
|
|
static void ArraysToParams(const nsTArray<int>& aIntParams,
|
|
|
|
const nsTArray<nsString>& aStringParams,
|
|
|
|
nsIDialogParamBlock* aParams);
|
2009-07-01 00:39:22 +04:00
|
|
|
|
2010-03-24 13:47:18 +03:00
|
|
|
virtual PDocumentRendererShmemChild* AllocPDocumentRendererShmem(
|
|
|
|
const PRInt32& x,
|
|
|
|
const PRInt32& y,
|
|
|
|
const PRInt32& w,
|
|
|
|
const PRInt32& h,
|
|
|
|
const nsString& bgcolor,
|
|
|
|
const PRUint32& flags,
|
|
|
|
const bool& flush,
|
|
|
|
const gfxMatrix& aMatrix,
|
|
|
|
const PRInt32& bufw,
|
|
|
|
const PRInt32& bufh,
|
|
|
|
Shmem& buf);
|
|
|
|
virtual bool DeallocPDocumentRendererShmem(PDocumentRendererShmemChild* actor);
|
|
|
|
virtual bool RecvPDocumentRendererShmemConstructor(
|
|
|
|
PDocumentRendererShmemChild *__a,
|
|
|
|
const PRInt32& aX,
|
|
|
|
const PRInt32& aY,
|
|
|
|
const PRInt32& aW,
|
|
|
|
const PRInt32& aH,
|
|
|
|
const nsString& bgcolor,
|
|
|
|
const PRUint32& flags,
|
|
|
|
const bool& flush,
|
|
|
|
const gfxMatrix& aMatrix,
|
|
|
|
const PRInt32& aBufW,
|
|
|
|
const PRInt32& aBufH,
|
|
|
|
Shmem& aBuf);
|
|
|
|
|
2010-05-13 21:44:51 +04:00
|
|
|
virtual PGeolocationRequestChild* AllocPGeolocationRequest(const IPC::URI& uri);
|
|
|
|
virtual bool DeallocPGeolocationRequest(PGeolocationRequestChild* actor);
|
|
|
|
|
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
|
|
|
|
|
|
|
virtual PContextWrapperChild* AllocPContextWrapper();
|
|
|
|
virtual bool DeallocPContextWrapper(PContextWrapperChild* actor);
|
|
|
|
|
2010-03-30 00:29:45 +04:00
|
|
|
nsresult GetObjectsForMessage(nsTArray<PObjectWrapperChild*>& aObjects);
|
2009-07-01 00:39:22 +04:00
|
|
|
private:
|
2010-02-20 20:05:20 +03:00
|
|
|
bool InitTabChildGlobal();
|
|
|
|
|
2009-07-01 00:39:22 +04:00
|
|
|
nsCOMPtr<nsIWebNavigation> mWebNav;
|
|
|
|
|
2010-02-20 20:05:20 +03:00
|
|
|
nsCOMPtr<nsIXPConnectJSObjectHolder> mRootGlobal;
|
|
|
|
|
|
|
|
JSContext* mCx;
|
|
|
|
|
2010-03-30 00:29:45 +04:00
|
|
|
mozilla::jsipc::ContextWrapperChild* mContextWrapper;
|
|
|
|
|
2010-02-20 20:05:20 +03:00
|
|
|
nsCOMPtr<nsIChannel> mChannel;
|
|
|
|
|
|
|
|
TabChildGlobal* mTabChildGlobal;
|
|
|
|
|
|
|
|
nsCOMPtr<nsIPrincipal> mPrincipal;
|
|
|
|
|
2009-07-01 00:39:22 +04:00
|
|
|
DISALLOW_EVIL_CONSTRUCTORS(TabChild);
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif // mozilla_tabs_TabChild_h
|