2009-08-18 12:05:15 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
|
|
/* vim: set sw=4 ts=8 et tw=80 : */
|
2009-09-09 15:00:14 -07: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-06-30 13:39:22 -07:00
|
|
|
|
|
|
|
#ifndef mozilla_tabs_TabParent_h
|
|
|
|
#define mozilla_tabs_TabParent_h
|
|
|
|
|
2010-07-19 11:33:33 -07:00
|
|
|
#include "mozilla/dom/PBrowserParent.h"
|
2010-05-17 04:25:22 -07:00
|
|
|
#include "mozilla/dom/PContentDialogParent.h"
|
2009-07-20 11:14:41 -07:00
|
|
|
#include "mozilla/ipc/GeckoChildProcessHost.h"
|
2009-06-30 13:39:22 -07:00
|
|
|
|
2010-03-30 21:41:44 -07:00
|
|
|
#include "jsapi.h"
|
2009-12-31 17:35:55 -08:00
|
|
|
#include "nsCOMPtr.h"
|
2010-06-18 03:49:28 -07:00
|
|
|
#include "nsITabParent.h"
|
2009-12-31 17:35:55 -08:00
|
|
|
#include "nsIBrowserDOMWindow.h"
|
2010-03-26 11:39:39 -07:00
|
|
|
#include "nsIWebProgress.h"
|
|
|
|
#include "nsIWebProgressListener.h"
|
|
|
|
#include "nsWeakReference.h"
|
2010-05-17 04:25:22 -07:00
|
|
|
#include "nsIDialogParamBlock.h"
|
2010-06-24 15:20:42 -07:00
|
|
|
#include "nsIAuthPromptProvider.h"
|
2010-08-13 01:06:40 -07:00
|
|
|
#include "nsISSLStatusProvider.h"
|
|
|
|
#include "nsISecureBrowserUI.h"
|
2009-12-31 17:35:55 -08:00
|
|
|
|
2010-08-05 15:11:23 -07:00
|
|
|
class nsFrameLoader;
|
2009-06-30 13:39:22 -07:00
|
|
|
class nsIURI;
|
2009-11-05 10:14:22 -08:00
|
|
|
class nsIDOMElement;
|
2010-07-16 23:59:36 -07:00
|
|
|
struct gfxMatrix;
|
2009-06-30 13:39:22 -07:00
|
|
|
|
2009-11-06 12:43:39 -08:00
|
|
|
struct JSContext;
|
|
|
|
struct JSObject;
|
|
|
|
|
2009-06-30 13:39:22 -07:00
|
|
|
namespace mozilla {
|
2009-08-12 09:18:08 -07:00
|
|
|
namespace dom {
|
2010-03-26 11:39:39 -07:00
|
|
|
struct TabParentListenerInfo
|
|
|
|
{
|
|
|
|
TabParentListenerInfo(nsIWeakReference *aListener, unsigned long aNotifyMask)
|
|
|
|
: mWeakListener(aListener), mNotifyMask(aNotifyMask)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
TabParentListenerInfo(const TabParentListenerInfo& obj)
|
|
|
|
: mWeakListener(obj.mWeakListener), mNotifyMask(obj.mNotifyMask)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
nsWeakPtr mWeakListener;
|
|
|
|
|
|
|
|
PRUint32 mNotifyMask;
|
|
|
|
};
|
|
|
|
|
|
|
|
inline
|
|
|
|
bool operator==(const TabParentListenerInfo& lhs, const TabParentListenerInfo& rhs)
|
|
|
|
{
|
|
|
|
return &lhs == &rhs;
|
|
|
|
}
|
2009-06-30 13:39:22 -07:00
|
|
|
|
2010-05-17 04:25:22 -07:00
|
|
|
class ContentDialogParent : public PContentDialogParent {};
|
|
|
|
|
2010-07-19 11:33:33 -07:00
|
|
|
class TabParent : public PBrowserParent
|
2010-06-24 15:20:42 -07:00
|
|
|
, public nsITabParent
|
|
|
|
, public nsIWebProgress
|
|
|
|
, public nsIAuthPromptProvider
|
2010-08-13 01:06:40 -07:00
|
|
|
, public nsISecureBrowserUI
|
|
|
|
, public nsISSLStatusProvider
|
2009-06-30 13:39:22 -07:00
|
|
|
{
|
|
|
|
public:
|
2009-08-12 09:18:08 -07:00
|
|
|
TabParent();
|
2009-06-30 13:39:22 -07:00
|
|
|
virtual ~TabParent();
|
2009-11-05 10:14:22 -08:00
|
|
|
void SetOwnerElement(nsIDOMElement* aElement) { mFrameElement = aElement; }
|
2009-12-31 17:35:55 -08:00
|
|
|
void SetBrowserDOMWindow(nsIBrowserDOMWindow* aBrowserDOMWindow) {
|
|
|
|
mBrowserDOMWindow = aBrowserDOMWindow;
|
|
|
|
}
|
2009-11-05 10:14:22 -08:00
|
|
|
|
2010-07-19 11:33:33 -07:00
|
|
|
virtual bool RecvMoveFocus(const bool& aForward);
|
|
|
|
virtual bool RecvEvent(const RemoteDOMEvent& aEvent);
|
|
|
|
virtual bool RecvNotifyProgressChange(const PRInt64& aProgress,
|
2010-03-26 11:39:39 -07:00
|
|
|
const PRInt64& aProgressMax,
|
|
|
|
const PRInt64& aTotalProgress,
|
|
|
|
const PRInt64& aMaxTotalProgress);
|
2010-07-19 11:33:33 -07:00
|
|
|
virtual bool RecvNotifyStateChange(const PRUint32& aStateFlags,
|
2010-03-26 11:39:39 -07:00
|
|
|
const nsresult& aStatus);
|
2010-07-19 11:33:33 -07:00
|
|
|
virtual bool RecvNotifyLocationChange(const nsCString& aUri);
|
|
|
|
virtual bool RecvNotifyStatusChange(const nsresult& status,
|
2010-03-26 11:39:39 -07:00
|
|
|
const nsString& message);
|
2010-08-13 01:06:40 -07:00
|
|
|
virtual bool RecvNotifySecurityChange(const PRUint32& aState,
|
|
|
|
const PRBool& aUseSSLStatusObject,
|
|
|
|
const nsString& aTooltip,
|
|
|
|
const nsCString& aSecInfoAsString);
|
|
|
|
|
2010-07-19 11:33:33 -07:00
|
|
|
virtual bool RecvRefreshAttempted(const nsCString& aURI,
|
2010-03-26 11:39:39 -07:00
|
|
|
const PRInt32& aMillis,
|
|
|
|
const bool& aSameURI,
|
|
|
|
bool* aAllowRefresh);
|
|
|
|
|
2010-07-19 11:33:33 -07:00
|
|
|
virtual bool AnswerCreateWindow(PBrowserParent** retval);
|
|
|
|
virtual bool RecvSyncMessage(const nsString& aMessage,
|
|
|
|
const nsString& aJSON,
|
|
|
|
nsTArray<nsString>* aJSONRetVal);
|
|
|
|
virtual bool RecvAsyncMessage(const nsString& aMessage,
|
|
|
|
const nsString& aJSON);
|
2010-05-17 04:25:22 -07:00
|
|
|
virtual PContentDialogParent* AllocPContentDialog(const PRUint32& aType,
|
|
|
|
const nsCString& aName,
|
|
|
|
const nsCString& aFeatures,
|
|
|
|
const nsTArray<int>& aIntParams,
|
|
|
|
const nsTArray<nsString>& aStringParams);
|
|
|
|
virtual bool DeallocPContentDialog(PContentDialogParent* aDialog)
|
|
|
|
{
|
|
|
|
delete aDialog;
|
|
|
|
return true;
|
|
|
|
}
|
2009-06-30 13:39:22 -07:00
|
|
|
|
|
|
|
void LoadURL(nsIURI* aURI);
|
|
|
|
void Move(PRUint32 x, PRUint32 y, PRUint32 width, PRUint32 height);
|
2009-11-05 10:14:22 -08:00
|
|
|
void Activate();
|
2009-11-05 10:21:09 -08:00
|
|
|
void SendMouseEvent(const nsAString& aType, float aX, float aY,
|
|
|
|
PRInt32 aButton, PRInt32 aClickCount,
|
|
|
|
PRInt32 aModifiers, PRBool aIgnoreRootScrollFrame);
|
2010-03-18 23:52:18 -07:00
|
|
|
void SendKeyEvent(const nsAString& aType, PRInt32 aKeyCode,
|
|
|
|
PRInt32 aCharCode, PRInt32 aModifiers,
|
|
|
|
PRBool aPreventDefault);
|
2009-10-29 10:58:31 -07:00
|
|
|
|
|
|
|
virtual mozilla::ipc::PDocumentRendererParent* 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 00:16:14 -08:00
|
|
|
virtual bool DeallocPDocumentRenderer(PDocumentRendererParent* actor);
|
2010-03-24 03:47:18 -07:00
|
|
|
|
|
|
|
virtual mozilla::ipc::PDocumentRendererShmemParent* 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,
|
|
|
|
Shmem& buf);
|
|
|
|
virtual bool DeallocPDocumentRendererShmem(PDocumentRendererShmemParent* actor);
|
|
|
|
|
2010-06-04 06:58:22 -07:00
|
|
|
virtual mozilla::ipc::PDocumentRendererNativeIDParent* AllocPDocumentRendererNativeID(
|
|
|
|
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 PRUint32& nativeID);
|
|
|
|
virtual bool DeallocPDocumentRendererNativeID(PDocumentRendererNativeIDParent* actor);
|
|
|
|
|
|
|
|
|
2010-05-13 10:44:51 -07:00
|
|
|
virtual PGeolocationRequestParent* AllocPGeolocationRequest(const IPC::URI& uri);
|
|
|
|
virtual bool DeallocPGeolocationRequest(PGeolocationRequestParent* actor);
|
|
|
|
|
2010-03-30 21:41:44 -07:00
|
|
|
JSBool GetGlobalJSObject(JSContext* cx, JSObject** globalp);
|
2009-11-06 12:43:39 -08:00
|
|
|
|
2010-03-26 11:39:39 -07:00
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIWEBPROGRESS
|
2010-06-24 15:20:42 -07:00
|
|
|
NS_DECL_NSIAUTHPROMPTPROVIDER
|
2010-08-13 01:06:40 -07:00
|
|
|
NS_DECL_NSISECUREBROWSERUI
|
|
|
|
NS_DECL_NSISSLSTATUSPROVIDER
|
2010-03-26 11:39:39 -07:00
|
|
|
|
2010-05-17 04:25:22 -07:00
|
|
|
void HandleDelayedDialogs();
|
2009-11-05 10:14:22 -08:00
|
|
|
protected:
|
2010-03-29 13:29:45 -07:00
|
|
|
bool ReceiveMessage(const nsString& aMessage,
|
|
|
|
PRBool aSync,
|
|
|
|
const nsString& aJSON,
|
|
|
|
nsTArray<nsString>* aJSONRetVal = nsnull);
|
|
|
|
|
2010-03-26 11:39:39 -07:00
|
|
|
TabParentListenerInfo* GetListenerInfo(nsIWebProgressListener *aListener);
|
|
|
|
|
2010-04-11 17:34:02 -07:00
|
|
|
void ActorDestroy(ActorDestroyReason why);
|
|
|
|
|
2009-11-05 10:14:22 -08:00
|
|
|
nsIDOMElement* mFrameElement;
|
2009-12-31 17:35:55 -08:00
|
|
|
nsCOMPtr<nsIBrowserDOMWindow> mBrowserDOMWindow;
|
2010-03-26 11:39:39 -07:00
|
|
|
|
|
|
|
nsTArray<TabParentListenerInfo> mListenerInfoList;
|
2010-05-17 04:25:22 -07:00
|
|
|
|
|
|
|
struct DelayedDialogData
|
|
|
|
{
|
|
|
|
DelayedDialogData(PContentDialogParent* aDialog, PRUint32 aType,
|
|
|
|
const nsCString& aName,
|
|
|
|
const nsCString& aFeatures,
|
|
|
|
nsIDialogParamBlock* aParams)
|
|
|
|
: mDialog(aDialog), mType(aType), mName(aName), mFeatures(aFeatures),
|
|
|
|
mParams(aParams) {}
|
|
|
|
|
|
|
|
PContentDialogParent* mDialog;
|
|
|
|
PRUint32 mType;
|
|
|
|
nsCString mName;
|
|
|
|
nsCString mFeatures;
|
|
|
|
nsCOMPtr<nsIDialogParamBlock> mParams;
|
|
|
|
};
|
|
|
|
nsTArray<DelayedDialogData*> mDelayedDialogs;
|
|
|
|
|
|
|
|
PRBool ShouldDelayDialogs();
|
2010-08-05 15:11:23 -07:00
|
|
|
|
2010-08-13 01:06:40 -07:00
|
|
|
PRUint32 mSecurityState;
|
|
|
|
nsString mSecurityTooltipText;
|
|
|
|
nsCOMPtr<nsISupports> mSecurityStatusObject;
|
|
|
|
|
2010-08-05 15:11:23 -07:00
|
|
|
private:
|
|
|
|
already_AddRefed<nsFrameLoader> GetFrameLoader() const;
|
2009-06-30 13:39:22 -07:00
|
|
|
};
|
|
|
|
|
2009-08-12 09:18:08 -07:00
|
|
|
} // namespace dom
|
2009-06-30 13:39:22 -07:00
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif
|