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 "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 {
|
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 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();
|
2010-08-17 20:19:24 -07:00
|
|
|
nsIDOMElement* GetOwnerElement() { return mFrameElement; }
|
2009-11-05 10:14:22 -08:00
|
|
|
void SetOwnerElement(nsIDOMElement* aElement) { mFrameElement = aElement; }
|
2010-08-17 20:19:24 -07:00
|
|
|
nsIBrowserDOMWindow *GetBrowserDOMWindow() { return mBrowserDOMWindow; }
|
2009-12-31 17:35:55 -08:00
|
|
|
void SetBrowserDOMWindow(nsIBrowserDOMWindow* aBrowserDOMWindow) {
|
|
|
|
mBrowserDOMWindow = aBrowserDOMWindow;
|
|
|
|
}
|
2010-08-17 20:19:24 -07:00
|
|
|
|
2010-07-19 11:33:33 -07:00
|
|
|
virtual bool RecvMoveFocus(const bool& aForward);
|
|
|
|
virtual bool RecvEvent(const RemoteDOMEvent& aEvent);
|
2010-03-26 11:39:39 -07:00
|
|
|
|
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-09-23 20:28:15 -07:00
|
|
|
virtual bool RecvNotifyIMEFocus(const PRBool& aFocus,
|
2010-10-01 07:17:37 -07:00
|
|
|
nsIMEUpdatePreference* aPreference,
|
|
|
|
PRUint32* aSeqno);
|
2010-09-23 20:28:15 -07:00
|
|
|
virtual bool RecvNotifyIMETextChange(const PRUint32& aStart,
|
|
|
|
const PRUint32& aEnd,
|
|
|
|
const PRUint32& aNewEnd);
|
2010-10-01 07:17:37 -07:00
|
|
|
virtual bool RecvNotifyIMESelection(const PRUint32& aSeqno,
|
|
|
|
const PRUint32& aAnchor,
|
2010-09-23 20:28:15 -07:00
|
|
|
const PRUint32& aFocus);
|
|
|
|
virtual bool RecvNotifyIMETextHint(const nsString& aText);
|
|
|
|
virtual bool RecvEndIMEComposition(const PRBool& aCancel,
|
|
|
|
nsString* aComposition);
|
|
|
|
virtual bool RecvGetIMEEnabled(PRUint32* aValue);
|
|
|
|
virtual bool RecvSetIMEEnabled(const PRUint32& aValue);
|
|
|
|
virtual bool RecvGetIMEOpenState(PRBool* aValue);
|
|
|
|
virtual bool RecvSetIMEOpenState(const PRBool& aValue);
|
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);
|
2010-08-20 16:24:40 -07:00
|
|
|
// XXX/cjones: it's not clear what we gain by hiding these
|
|
|
|
// message-sending functions under a layer of indirection and
|
|
|
|
// eating the return values
|
|
|
|
void Show(const nsIntSize& size);
|
|
|
|
void Move(const nsIntSize& size);
|
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
|
|
|
|
2010-10-26 15:20:53 -07:00
|
|
|
virtual PDocumentRendererParent*
|
2010-10-26 15:20:53 -07:00
|
|
|
AllocPDocumentRenderer(const nsRect& documentRect, const gfxMatrix& transform,
|
|
|
|
const nsString& bgcolor,
|
2010-10-26 15:20:53 -07:00
|
|
|
const PRUint32& renderFlags, const bool& flushLayout,
|
|
|
|
const nsIntSize& renderSize);
|
2009-12-03 00:16:14 -08:00
|
|
|
virtual bool DeallocPDocumentRenderer(PDocumentRendererParent* actor);
|
2010-03-24 03:47:18 -07:00
|
|
|
|
2010-09-09 22:00:08 -07:00
|
|
|
virtual PContentPermissionRequestParent* AllocPContentPermissionRequest(const nsCString& aType, const IPC::URI& uri);
|
|
|
|
virtual bool DeallocPContentPermissionRequest(PContentPermissionRequestParent* actor);
|
2010-05-13 10:44:51 -07:00
|
|
|
|
2010-10-20 10:12:32 -07:00
|
|
|
virtual POfflineCacheUpdateParent* AllocPOfflineCacheUpdate(
|
|
|
|
const URI& aManifestURI,
|
|
|
|
const URI& aDocumentURI,
|
|
|
|
const nsCString& aClientID,
|
|
|
|
const bool& stickDocument);
|
|
|
|
virtual bool DeallocPOfflineCacheUpdate(POfflineCacheUpdateParent* 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
|
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();
|
2010-09-23 20:28:15 -07:00
|
|
|
|
|
|
|
static TabParent *GetIMETabParent() { return mIMETabParent; }
|
|
|
|
bool HandleQueryContentEvent(nsQueryContentEvent& aEvent);
|
2010-10-01 07:17:37 -07:00
|
|
|
bool SendCompositionEvent(nsCompositionEvent& event);
|
|
|
|
bool SendTextEvent(nsTextEvent& event);
|
|
|
|
bool SendSelectionEvent(nsSelectionEvent& event);
|
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-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
|
|
|
|
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-10-19 01:21:31 -07:00
|
|
|
PRBool AllowContentIME();
|
2010-08-05 15:11:23 -07:00
|
|
|
|
2010-08-20 16:24:41 -07:00
|
|
|
NS_OVERRIDE
|
|
|
|
virtual PRenderFrameParent* AllocPRenderFrame();
|
|
|
|
NS_OVERRIDE
|
|
|
|
virtual bool DeallocPRenderFrame(PRenderFrameParent* aFrame);
|
|
|
|
|
2010-08-13 01:06:40 -07:00
|
|
|
PRUint32 mSecurityState;
|
|
|
|
nsString mSecurityTooltipText;
|
|
|
|
nsCOMPtr<nsISupports> mSecurityStatusObject;
|
|
|
|
|
2010-09-23 20:28:15 -07:00
|
|
|
// IME
|
2010-09-23 20:28:15 -07:00
|
|
|
static TabParent *mIMETabParent;
|
2010-09-23 20:28:15 -07:00
|
|
|
nsString mIMECacheText;
|
2010-09-23 20:28:15 -07:00
|
|
|
PRUint32 mIMESelectionAnchor;
|
|
|
|
PRUint32 mIMESelectionFocus;
|
2010-09-23 20:34:26 -07:00
|
|
|
PRPackedBool mIMEComposing;
|
2010-09-23 20:28:15 -07:00
|
|
|
PRPackedBool mIMECompositionEnding;
|
|
|
|
// Buffer to store composition text during ResetInputState
|
|
|
|
// Compositions in almost all cases are small enough for nsAutoString
|
|
|
|
nsAutoString mIMECompositionText;
|
2010-09-23 20:34:26 -07:00
|
|
|
PRUint32 mIMECompositionStart;
|
2010-10-01 07:17:37 -07:00
|
|
|
PRUint32 mIMESeqno;
|
2010-09-23 20:28:15 -07:00
|
|
|
|
2010-08-05 15:11:23 -07:00
|
|
|
private:
|
|
|
|
already_AddRefed<nsFrameLoader> GetFrameLoader() const;
|
2010-09-23 20:28:15 -07:00
|
|
|
already_AddRefed<nsIWidget> GetWidget() 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
|