2009-08-18 23:05:15 +04: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-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_TabParent_h
|
|
|
|
#define mozilla_tabs_TabParent_h
|
|
|
|
|
2010-07-19 22:33:33 +04:00
|
|
|
#include "mozilla/dom/PBrowserParent.h"
|
2010-05-17 15:25:22 +04:00
|
|
|
#include "mozilla/dom/PContentDialogParent.h"
|
2009-07-20 22:14:41 +04:00
|
|
|
#include "mozilla/ipc/GeckoChildProcessHost.h"
|
2009-07-01 00:39:22 +04:00
|
|
|
|
2010-03-31 08:41:44 +04:00
|
|
|
#include "jsapi.h"
|
2010-01-01 04:35:55 +03:00
|
|
|
#include "nsCOMPtr.h"
|
2010-06-18 14:49:28 +04:00
|
|
|
#include "nsITabParent.h"
|
2010-01-01 04:35:55 +03:00
|
|
|
#include "nsIBrowserDOMWindow.h"
|
2010-03-26 21:39:39 +03:00
|
|
|
#include "nsWeakReference.h"
|
2010-05-17 15:25:22 +04:00
|
|
|
#include "nsIDialogParamBlock.h"
|
2010-06-25 02:20:42 +04:00
|
|
|
#include "nsIAuthPromptProvider.h"
|
2010-08-13 12:06:40 +04:00
|
|
|
#include "nsISecureBrowserUI.h"
|
2010-01-01 04:35:55 +03:00
|
|
|
|
2010-08-06 02:11:23 +04:00
|
|
|
class nsFrameLoader;
|
2009-07-01 00:39:22 +04:00
|
|
|
class nsIURI;
|
2009-11-05 21:14:22 +03:00
|
|
|
class nsIDOMElement;
|
2010-07-17 10:59:36 +04:00
|
|
|
struct gfxMatrix;
|
2009-07-01 00:39:22 +04:00
|
|
|
|
2009-11-06 23:43:39 +03:00
|
|
|
struct JSContext;
|
|
|
|
struct JSObject;
|
|
|
|
|
2009-07-01 00:39:22 +04:00
|
|
|
namespace mozilla {
|
2009-08-12 20:18:08 +04:00
|
|
|
namespace dom {
|
2009-07-01 00:39:22 +04:00
|
|
|
|
2010-05-17 15:25:22 +04:00
|
|
|
class ContentDialogParent : public PContentDialogParent {};
|
|
|
|
|
2010-07-19 22:33:33 +04:00
|
|
|
class TabParent : public PBrowserParent
|
2010-06-25 02:20:42 +04:00
|
|
|
, public nsITabParent
|
|
|
|
, public nsIAuthPromptProvider
|
2010-08-13 12:06:40 +04:00
|
|
|
, public nsISecureBrowserUI
|
2009-07-01 00:39:22 +04:00
|
|
|
{
|
|
|
|
public:
|
2009-08-12 20:18:08 +04:00
|
|
|
TabParent();
|
2009-07-01 00:39:22 +04:00
|
|
|
virtual ~TabParent();
|
2010-08-18 07:19:24 +04:00
|
|
|
nsIDOMElement* GetOwnerElement() { return mFrameElement; }
|
2010-12-09 21:57:05 +03:00
|
|
|
void SetOwnerElement(nsIDOMElement* aElement);
|
2010-08-18 07:19:24 +04:00
|
|
|
nsIBrowserDOMWindow *GetBrowserDOMWindow() { return mBrowserDOMWindow; }
|
2010-01-01 04:35:55 +03:00
|
|
|
void SetBrowserDOMWindow(nsIBrowserDOMWindow* aBrowserDOMWindow) {
|
|
|
|
mBrowserDOMWindow = aBrowserDOMWindow;
|
|
|
|
}
|
2010-08-18 07:19:24 +04:00
|
|
|
|
2011-01-06 07:54:47 +03:00
|
|
|
void Destroy();
|
|
|
|
|
2010-07-19 22:33:33 +04:00
|
|
|
virtual bool RecvMoveFocus(const bool& aForward);
|
|
|
|
virtual bool RecvEvent(const RemoteDOMEvent& aEvent);
|
2010-03-26 21:39:39 +03:00
|
|
|
|
2010-07-19 22:33:33 +04:00
|
|
|
virtual bool AnswerCreateWindow(PBrowserParent** retval);
|
|
|
|
virtual bool RecvSyncMessage(const nsString& aMessage,
|
|
|
|
const nsString& aJSON,
|
2010-11-09 05:49:00 +03:00
|
|
|
InfallibleTArray<nsString>* aJSONRetVal);
|
2010-07-19 22:33:33 +04:00
|
|
|
virtual bool RecvAsyncMessage(const nsString& aMessage,
|
|
|
|
const nsString& aJSON);
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual bool RecvNotifyIMEFocus(const bool& aFocus,
|
2010-10-01 18:17:37 +04:00
|
|
|
nsIMEUpdatePreference* aPreference,
|
|
|
|
PRUint32* aSeqno);
|
2010-09-24 07:28:15 +04:00
|
|
|
virtual bool RecvNotifyIMETextChange(const PRUint32& aStart,
|
|
|
|
const PRUint32& aEnd,
|
|
|
|
const PRUint32& aNewEnd);
|
2010-10-01 18:17:37 +04:00
|
|
|
virtual bool RecvNotifyIMESelection(const PRUint32& aSeqno,
|
|
|
|
const PRUint32& aAnchor,
|
2010-09-24 07:28:15 +04:00
|
|
|
const PRUint32& aFocus);
|
|
|
|
virtual bool RecvNotifyIMETextHint(const nsString& aText);
|
2011-09-29 10:19:26 +04:00
|
|
|
virtual bool RecvEndIMEComposition(const bool& aCancel,
|
2010-09-24 07:28:15 +04:00
|
|
|
nsString* aComposition);
|
2011-11-27 15:51:53 +04:00
|
|
|
virtual bool RecvGetInputContext(PRInt32* aIMEEnabled,
|
|
|
|
PRInt32* aIMEOpen);
|
|
|
|
virtual bool RecvSetInputContext(const PRInt32& aIMEEnabled,
|
|
|
|
const PRInt32& aIMEOpen,
|
2011-11-27 15:51:52 +04:00
|
|
|
const nsString& aType,
|
|
|
|
const nsString& aActionHint,
|
|
|
|
const PRInt32& aCause,
|
|
|
|
const PRInt32& aFocusChange);
|
2011-06-22 04:32:43 +04:00
|
|
|
virtual bool RecvSetCursor(const PRUint32& aValue);
|
2011-10-21 02:17:09 +04:00
|
|
|
virtual bool RecvSetBackgroundColor(const nscolor& aValue);
|
2010-12-03 04:24:04 +03:00
|
|
|
virtual bool RecvGetDPI(float* aValue);
|
2011-07-22 04:49:35 +04:00
|
|
|
virtual bool RecvGetWidgetNativeData(WindowsHandle* aValue);
|
2010-05-17 15:25:22 +04:00
|
|
|
virtual PContentDialogParent* AllocPContentDialog(const PRUint32& aType,
|
|
|
|
const nsCString& aName,
|
|
|
|
const nsCString& aFeatures,
|
2010-11-09 05:49:00 +03:00
|
|
|
const InfallibleTArray<int>& aIntParams,
|
|
|
|
const InfallibleTArray<nsString>& aStringParams);
|
2010-05-17 15:25:22 +04:00
|
|
|
virtual bool DeallocPContentDialog(PContentDialogParent* aDialog)
|
|
|
|
{
|
|
|
|
delete aDialog;
|
|
|
|
return true;
|
|
|
|
}
|
2009-07-01 00:39:22 +04:00
|
|
|
|
2010-12-03 04:24:04 +03:00
|
|
|
|
2009-07-01 00:39:22 +04:00
|
|
|
void LoadURL(nsIURI* aURI);
|
2010-08-21 03:24:40 +04: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);
|
2011-07-16 01:46:56 +04:00
|
|
|
void UpdateDimensions(const nsRect& rect, const nsIntSize& size);
|
2009-11-05 21:14:22 +03:00
|
|
|
void Activate();
|
2011-06-18 04:08:32 +04:00
|
|
|
void Deactivate();
|
2011-09-30 11:00:48 +04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Is this object active? That is, was Activate() called more recently than
|
|
|
|
* Deactivate()?
|
|
|
|
*/
|
|
|
|
bool Active();
|
|
|
|
|
2009-11-05 21:21:09 +03:00
|
|
|
void SendMouseEvent(const nsAString& aType, float aX, float aY,
|
|
|
|
PRInt32 aButton, PRInt32 aClickCount,
|
2011-09-29 10:19:26 +04:00
|
|
|
PRInt32 aModifiers, bool aIgnoreRootScrollFrame);
|
2010-03-19 09:52:18 +03:00
|
|
|
void SendKeyEvent(const nsAString& aType, PRInt32 aKeyCode,
|
|
|
|
PRInt32 aCharCode, PRInt32 aModifiers,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aPreventDefault);
|
2011-06-22 04:32:43 +04:00
|
|
|
bool SendRealMouseEvent(nsMouseEvent& event);
|
|
|
|
bool SendMouseScrollEvent(nsMouseScrollEvent& event);
|
|
|
|
bool SendRealKeyEvent(nsKeyEvent& event);
|
2009-10-29 20:58:31 +03:00
|
|
|
|
2010-10-27 02:20:53 +04:00
|
|
|
virtual PDocumentRendererParent*
|
2010-10-27 02:20:53 +04:00
|
|
|
AllocPDocumentRenderer(const nsRect& documentRect, const gfxMatrix& transform,
|
|
|
|
const nsString& bgcolor,
|
2010-10-27 02:20:53 +04:00
|
|
|
const PRUint32& renderFlags, const bool& flushLayout,
|
|
|
|
const nsIntSize& renderSize);
|
2009-12-03 11:16:14 +03:00
|
|
|
virtual bool DeallocPDocumentRenderer(PDocumentRendererParent* actor);
|
2010-03-24 13:47:18 +03:00
|
|
|
|
2010-09-10 09:00:08 +04:00
|
|
|
virtual PContentPermissionRequestParent* AllocPContentPermissionRequest(const nsCString& aType, const IPC::URI& uri);
|
|
|
|
virtual bool DeallocPContentPermissionRequest(PContentPermissionRequestParent* actor);
|
2010-05-13 21:44:51 +04:00
|
|
|
|
2010-10-20 21:12:32 +04:00
|
|
|
virtual POfflineCacheUpdateParent* AllocPOfflineCacheUpdate(
|
|
|
|
const URI& aManifestURI,
|
|
|
|
const URI& aDocumentURI,
|
|
|
|
const nsCString& aClientID,
|
|
|
|
const bool& stickDocument);
|
|
|
|
virtual bool DeallocPOfflineCacheUpdate(POfflineCacheUpdateParent* actor);
|
|
|
|
|
2010-03-31 08:41:44 +04:00
|
|
|
JSBool GetGlobalJSObject(JSContext* cx, JSObject** globalp);
|
2009-11-06 23:43:39 +03:00
|
|
|
|
2010-03-26 21:39:39 +03:00
|
|
|
NS_DECL_ISUPPORTS
|
2010-06-25 02:20:42 +04:00
|
|
|
NS_DECL_NSIAUTHPROMPTPROVIDER
|
2010-08-13 12:06:40 +04:00
|
|
|
NS_DECL_NSISECUREBROWSERUI
|
2010-03-26 21:39:39 +03:00
|
|
|
|
2010-05-17 15:25:22 +04:00
|
|
|
void HandleDelayedDialogs();
|
2010-09-24 07:28:15 +04:00
|
|
|
|
|
|
|
static TabParent *GetIMETabParent() { return mIMETabParent; }
|
|
|
|
bool HandleQueryContentEvent(nsQueryContentEvent& aEvent);
|
2010-10-01 18:17:37 +04:00
|
|
|
bool SendCompositionEvent(nsCompositionEvent& event);
|
|
|
|
bool SendTextEvent(nsTextEvent& event);
|
|
|
|
bool SendSelectionEvent(nsSelectionEvent& event);
|
2009-11-05 21:14:22 +03:00
|
|
|
protected:
|
2010-03-30 00:29:45 +04:00
|
|
|
bool ReceiveMessage(const nsString& aMessage,
|
2011-09-29 10:19:26 +04:00
|
|
|
bool aSync,
|
2010-03-30 00:29:45 +04:00
|
|
|
const nsString& aJSON,
|
2010-11-09 05:49:00 +03:00
|
|
|
InfallibleTArray<nsString>* aJSONRetVal = nsnull);
|
2010-03-30 00:29:45 +04:00
|
|
|
|
2010-04-12 04:34:02 +04:00
|
|
|
void ActorDestroy(ActorDestroyReason why);
|
|
|
|
|
2009-11-05 21:14:22 +03:00
|
|
|
nsIDOMElement* mFrameElement;
|
2010-01-01 04:35:55 +03:00
|
|
|
nsCOMPtr<nsIBrowserDOMWindow> mBrowserDOMWindow;
|
2010-03-26 21:39:39 +03:00
|
|
|
|
2010-05-17 15:25:22 +04: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;
|
|
|
|
};
|
2010-11-09 05:49:00 +03:00
|
|
|
InfallibleTArray<DelayedDialogData*> mDelayedDialogs;
|
2010-05-17 15:25:22 +04:00
|
|
|
|
2011-09-29 10:19:26 +04:00
|
|
|
bool ShouldDelayDialogs();
|
|
|
|
bool AllowContentIME();
|
2010-08-06 02:11:23 +04:00
|
|
|
|
2010-08-21 03:24:41 +04:00
|
|
|
NS_OVERRIDE
|
|
|
|
virtual PRenderFrameParent* AllocPRenderFrame();
|
|
|
|
NS_OVERRIDE
|
|
|
|
virtual bool DeallocPRenderFrame(PRenderFrameParent* aFrame);
|
|
|
|
|
2010-09-24 07:28:15 +04:00
|
|
|
// IME
|
2010-09-24 07:28:15 +04:00
|
|
|
static TabParent *mIMETabParent;
|
2010-09-24 07:28:15 +04:00
|
|
|
nsString mIMECacheText;
|
2010-09-24 07:28:15 +04:00
|
|
|
PRUint32 mIMESelectionAnchor;
|
|
|
|
PRUint32 mIMESelectionFocus;
|
2011-09-29 10:19:26 +04:00
|
|
|
bool mIMEComposing;
|
|
|
|
bool mIMECompositionEnding;
|
2010-09-24 07:28:15 +04:00
|
|
|
// Buffer to store composition text during ResetInputState
|
|
|
|
// Compositions in almost all cases are small enough for nsAutoString
|
|
|
|
nsAutoString mIMECompositionText;
|
2010-09-24 07:34:26 +04:00
|
|
|
PRUint32 mIMECompositionStart;
|
2010-10-01 18:17:37 +04:00
|
|
|
PRUint32 mIMESeqno;
|
2010-09-24 07:28:15 +04:00
|
|
|
|
2010-12-09 21:57:05 +03:00
|
|
|
float mDPI;
|
2011-09-30 11:00:48 +04:00
|
|
|
bool mActive;
|
2012-04-25 20:35:58 +04:00
|
|
|
bool mShown;
|
2010-12-09 21:57:05 +03:00
|
|
|
|
2010-08-06 02:11:23 +04:00
|
|
|
private:
|
|
|
|
already_AddRefed<nsFrameLoader> GetFrameLoader() const;
|
2010-09-24 07:28:15 +04:00
|
|
|
already_AddRefed<nsIWidget> GetWidget() const;
|
2012-04-25 20:35:58 +04:00
|
|
|
void TryCacheDPI();
|
2009-07-01 00:39:22 +04:00
|
|
|
};
|
|
|
|
|
2009-08-12 20:18:08 +04:00
|
|
|
} // namespace dom
|
2009-07-01 00:39:22 +04:00
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif
|