2016-01-08 23:40:26 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 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
|
|
|
|
|
|
|
#ifndef mozilla_tabs_TabParent_h
|
|
|
|
#define mozilla_tabs_TabParent_h
|
|
|
|
|
2015-03-26 10:29:31 +03:00
|
|
|
#include "js/TypeDecls.h"
|
2017-02-01 18:38:16 +03:00
|
|
|
#include "LiveResizeListener.h"
|
2015-06-05 12:28:18 +03:00
|
|
|
#include "mozilla/ContentCache.h"
|
2015-12-11 19:17:33 +03:00
|
|
|
#include "mozilla/dom/AudioChannelBinding.h"
|
2015-03-26 10:29:31 +03:00
|
|
|
#include "mozilla/dom/ipc/IdType.h"
|
2010-07-19 22:33:33 +04:00
|
|
|
#include "mozilla/dom/PBrowserParent.h"
|
2015-10-30 02:30:57 +03:00
|
|
|
#include "mozilla/dom/PContent.h"
|
2014-02-18 04:30:06 +04:00
|
|
|
#include "mozilla/dom/PFilePickerParent.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"
|
2015-03-26 10:29:31 +03:00
|
|
|
#include "mozilla/EventForwards.h"
|
2015-04-08 21:48:11 +03:00
|
|
|
#include "mozilla/dom/File.h"
|
2016-05-11 04:16:41 +03:00
|
|
|
#include "mozilla/layers/CompositorBridgeParent.h"
|
2015-10-18 08:24:48 +03:00
|
|
|
#include "mozilla/RefPtr.h"
|
2016-05-11 04:16:41 +03:00
|
|
|
#include "mozilla/Move.h"
|
2010-01-01 04:35:55 +03:00
|
|
|
#include "nsCOMPtr.h"
|
2012-06-23 05:27:30 +04:00
|
|
|
#include "nsIAuthPromptProvider.h"
|
2010-01-01 04:35:55 +03:00
|
|
|
#include "nsIBrowserDOMWindow.h"
|
2015-03-26 10:29:31 +03:00
|
|
|
#include "nsIDOMEventListener.h"
|
Bug 1257759 part.5 PluginInstanceChild should post received native key event to chrome process if the key combination may be a shortcut key r=jimm
When PluginInstanceChild receives native key events, it should post the events to the chrome process first for checking if the key combination is reserved. However, posting all key events to the chrome process may make damage to the performance of text input. Therefore, this patch starts to post a key event whose key combination may be a shortcut key. However, for avoiding to shuffle the event order, it posts following key events until all posted key events are handled by the chrome process.
For receiving response from widget, this patch defines nsIKeyEventInPluginCallback. It's specified by nsIWidget::OnWindowedPluginKeyEvent() for ensuring the caller will receive the reply. Basically, the caller of nsIWidget::OnWindowedPluginKeyEvent() should reply to the child process. However, if the widget is a PuppetWidget, it cannot return the result synchronously. Therefore, PuppetWidget::OnWindowedPluginKeyEvent() returns NS_SUCCESS_EVENT_HANDLED_ASYNCHRONOUSLY and stores the callback to mKeyEventInPluginCallbacks. Then, TabParent::HandledWindowedPluginKeyEvent() will call PuppetWidget::HandledWindowedPluginKeyEvent().
MozReview-Commit-ID: G6brOU26NwQ
--HG--
extra : rebase_source : 8140456de278956d2d594e85c7b397ae366b4962
2016-04-19 14:09:37 +03:00
|
|
|
#include "nsIKeyEventInPluginCallback.h"
|
2010-08-13 12:06:40 +04:00
|
|
|
#include "nsISecureBrowserUI.h"
|
2012-06-23 05:27:30 +04:00
|
|
|
#include "nsITabParent.h"
|
2015-08-06 00:25:39 +03:00
|
|
|
#include "nsIWebBrowserPersistable.h"
|
2014-01-23 00:27:23 +04:00
|
|
|
#include "nsIXULBrowserWindow.h"
|
2015-04-21 17:33:56 +03:00
|
|
|
#include "nsRefreshDriver.h"
|
2014-06-06 06:49:43 +04:00
|
|
|
#include "nsWeakReference.h"
|
2013-07-11 18:43:35 +04:00
|
|
|
#include "Units.h"
|
2015-04-15 02:29:10 +03:00
|
|
|
#include "nsIWidget.h"
|
2016-10-14 10:31:02 +03:00
|
|
|
#include "nsIPartialSHistory.h"
|
2010-01-01 04:35:55 +03:00
|
|
|
|
2012-06-23 05:27:30 +04:00
|
|
|
class nsFrameLoader;
|
2015-02-06 00:47:32 +03:00
|
|
|
class nsIFrameLoader;
|
2013-10-19 00:57:55 +04:00
|
|
|
class nsIContent;
|
2013-11-06 21:21:15 +04:00
|
|
|
class nsIPrincipal;
|
2012-06-23 05:27:30 +04:00
|
|
|
class nsIURI;
|
2014-01-11 05:10:57 +04:00
|
|
|
class nsILoadContext;
|
2014-10-29 21:11:00 +03:00
|
|
|
class nsIDocShell;
|
2009-11-06 23:43:39 +03:00
|
|
|
|
2009-07-01 00:39:22 +04:00
|
|
|
namespace mozilla {
|
2012-07-20 10:48:27 +04:00
|
|
|
|
2015-10-08 17:51:31 +03:00
|
|
|
namespace a11y {
|
2015-10-06 20:10:47 +03:00
|
|
|
class DocAccessibleParent;
|
2015-10-08 17:51:31 +03:00
|
|
|
}
|
2015-10-06 20:10:47 +03:00
|
|
|
|
2015-01-27 00:32:18 +03:00
|
|
|
namespace jsipc {
|
|
|
|
class CpowHolder;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace jsipc
|
2015-01-27 00:32:18 +03:00
|
|
|
|
2012-07-20 10:48:27 +04:00
|
|
|
namespace layers {
|
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
|
|
|
struct TextureFactoryIdentifier;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace layers
|
2012-07-20 10:48:27 +04:00
|
|
|
|
|
|
|
namespace layout {
|
|
|
|
class RenderFrameParent;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace layout
|
2012-07-20 10:48:27 +04:00
|
|
|
|
2014-09-11 17:46:17 +04:00
|
|
|
namespace widget {
|
|
|
|
struct IMENotification;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace widget
|
2014-09-11 17:46:17 +04:00
|
|
|
|
2015-04-08 21:48:11 +03:00
|
|
|
namespace gfx {
|
|
|
|
class SourceSurface;
|
|
|
|
class DataSourceSurface;
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace gfx
|
2015-04-08 21:48:11 +03:00
|
|
|
|
2009-08-12 20:18:08 +04:00
|
|
|
namespace dom {
|
2009-07-01 00:39:22 +04:00
|
|
|
|
2012-08-02 10:02:29 +04:00
|
|
|
class ClonedMessageData;
|
2014-06-11 09:44:03 +04:00
|
|
|
class nsIContentParent;
|
2013-07-24 03:39:17 +04:00
|
|
|
class Element;
|
2015-04-08 21:48:11 +03:00
|
|
|
class DataTransfer;
|
2015-09-10 23:50:58 +03:00
|
|
|
|
|
|
|
namespace ipc {
|
|
|
|
class StructuredCloneData;
|
|
|
|
} // ipc namespace
|
2012-08-02 10:02:29 +04:00
|
|
|
|
2015-03-21 21:35:18 +03:00
|
|
|
class TabParent final : public PBrowserParent
|
2015-03-31 23:39:02 +03:00
|
|
|
, public nsIDOMEventListener
|
2015-03-21 21:35:18 +03:00
|
|
|
, public nsITabParent
|
|
|
|
, public nsIAuthPromptProvider
|
|
|
|
, public nsISecureBrowserUI
|
Bug 1257759 part.5 PluginInstanceChild should post received native key event to chrome process if the key combination may be a shortcut key r=jimm
When PluginInstanceChild receives native key events, it should post the events to the chrome process first for checking if the key combination is reserved. However, posting all key events to the chrome process may make damage to the performance of text input. Therefore, this patch starts to post a key event whose key combination may be a shortcut key. However, for avoiding to shuffle the event order, it posts following key events until all posted key events are handled by the chrome process.
For receiving response from widget, this patch defines nsIKeyEventInPluginCallback. It's specified by nsIWidget::OnWindowedPluginKeyEvent() for ensuring the caller will receive the reply. Basically, the caller of nsIWidget::OnWindowedPluginKeyEvent() should reply to the child process. However, if the widget is a PuppetWidget, it cannot return the result synchronously. Therefore, PuppetWidget::OnWindowedPluginKeyEvent() returns NS_SUCCESS_EVENT_HANDLED_ASYNCHRONOUSLY and stores the callback to mKeyEventInPluginCallbacks. Then, TabParent::HandledWindowedPluginKeyEvent() will call PuppetWidget::HandledWindowedPluginKeyEvent().
MozReview-Commit-ID: G6brOU26NwQ
--HG--
extra : rebase_source : 8140456de278956d2d594e85c7b397ae366b4962
2016-04-19 14:09:37 +03:00
|
|
|
, public nsIKeyEventInPluginCallback
|
2015-03-21 21:35:18 +03:00
|
|
|
, public nsSupportsWeakReference
|
|
|
|
, public TabContext
|
2015-04-21 17:33:56 +03:00
|
|
|
, public nsAPostRefreshObserver
|
2015-08-06 00:25:39 +03:00
|
|
|
, public nsIWebBrowserPersistable
|
2017-02-01 18:38:16 +03:00
|
|
|
, public LiveResizeListener
|
2009-07-01 00:39:22 +04:00
|
|
|
{
|
2016-01-05 12:59:30 +03:00
|
|
|
typedef mozilla::dom::ClonedMessageData ClonedMessageData;
|
2012-08-02 10:02:29 +04:00
|
|
|
|
2016-01-05 12:59:30 +03:00
|
|
|
virtual ~TabParent();
|
2014-06-23 23:56:07 +04:00
|
|
|
|
2009-07-01 00:39:22 +04:00
|
|
|
public:
|
2016-01-05 12:59:30 +03:00
|
|
|
// Helper class for ContentParent::RecvCreateWindow.
|
|
|
|
struct AutoUseNewTab;
|
2012-08-09 06:58:06 +04:00
|
|
|
|
2016-01-05 12:59:30 +03:00
|
|
|
// nsITabParent
|
|
|
|
NS_DECL_NSITABPARENT
|
|
|
|
// nsIDOMEventListener interfaces
|
|
|
|
NS_DECL_NSIDOMEVENTLISTENER
|
2015-10-30 02:30:57 +03:00
|
|
|
|
2016-01-05 12:59:30 +03:00
|
|
|
TabParent(nsIContentParent* aManager,
|
|
|
|
const TabId& aTabId,
|
|
|
|
const TabContext& aContext,
|
|
|
|
uint32_t aChromeFlags);
|
|
|
|
|
|
|
|
Element* GetOwnerElement() const { return mFrameElement; }
|
2016-04-27 22:40:36 +03:00
|
|
|
already_AddRefed<nsPIDOMWindowOuter> GetParentWindowOuter();
|
2016-01-05 12:59:30 +03:00
|
|
|
|
|
|
|
void SetOwnerElement(Element* aElement);
|
|
|
|
|
|
|
|
void CacheFrameLoader(nsFrameLoader* aFrameLoader);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Get the mozapptype attribute from this TabParent's owner DOM element.
|
|
|
|
*/
|
|
|
|
void GetAppType(nsAString& aOut);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Returns true iff this TabParent's nsIFrameLoader is visible.
|
|
|
|
*
|
|
|
|
* The frameloader's visibility can be independent of e.g. its docshell's
|
|
|
|
* visibility.
|
|
|
|
*/
|
|
|
|
bool IsVisible() const;
|
|
|
|
|
|
|
|
nsIBrowserDOMWindow *GetBrowserDOMWindow() const { return mBrowserDOMWindow; }
|
|
|
|
|
|
|
|
void SetBrowserDOMWindow(nsIBrowserDOMWindow* aBrowserDOMWindow)
|
|
|
|
{
|
|
|
|
mBrowserDOMWindow = aBrowserDOMWindow;
|
|
|
|
}
|
|
|
|
|
|
|
|
void SetHasContentOpener(bool aHasContentOpener);
|
|
|
|
|
|
|
|
void SwapFrameScriptsFrom(nsTArray<FrameScriptInfo>& aFrameScripts)
|
|
|
|
{
|
|
|
|
aFrameScripts.SwapElements(mDelayedFrameScripts);
|
|
|
|
}
|
|
|
|
|
|
|
|
already_AddRefed<nsILoadContext> GetLoadContext();
|
|
|
|
|
|
|
|
already_AddRefed<nsIWidget> GetTopLevelWidget();
|
|
|
|
|
|
|
|
nsIXULBrowserWindow* GetXULBrowserWindow();
|
|
|
|
|
|
|
|
void Destroy();
|
|
|
|
|
|
|
|
void RemoveWindowListeners();
|
|
|
|
|
|
|
|
void AddWindowListeners();
|
2015-10-30 02:30:57 +03:00
|
|
|
|
2016-01-05 12:59:30 +03:00
|
|
|
void DidRefresh() override;
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvMoveFocus(const bool& aForward,
|
|
|
|
const bool& aForDocumentNavigation) override;
|
2016-01-05 12:59:30 +03:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvSizeShellTo(const uint32_t& aFlags,
|
|
|
|
const int32_t& aWidth,
|
|
|
|
const int32_t& aHeight,
|
|
|
|
const int32_t& aShellItemWidth,
|
|
|
|
const int32_t& aShellItemHeight) override;
|
2016-05-11 12:44:57 +03:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvDropLinks(nsTArray<nsString>&& aLinks) override;
|
2015-11-11 01:35:12 +03:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvEvent(const RemoteDOMEvent& aEvent) override;
|
2016-01-05 12:59:30 +03:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvReplyKeyEvent(const WidgetKeyboardEvent& aEvent) override;
|
2016-01-05 12:59:30 +03:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult
|
2016-05-11 15:56:42 +03:00
|
|
|
RecvAccessKeyNotHandled(const WidgetKeyboardEvent& aEvent) override;
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvBrowserFrameOpenWindow(PBrowserParent* aOpener,
|
|
|
|
PRenderFrameParent* aRenderFrame,
|
|
|
|
const nsString& aURL,
|
|
|
|
const nsString& aName,
|
|
|
|
const nsString& aFeatures,
|
|
|
|
bool* aOutWindowOpened,
|
|
|
|
TextureFactoryIdentifier* aTextureFactoryIdentifier,
|
|
|
|
uint64_t* aLayersId) override;
|
2016-01-05 12:59:30 +03:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult
|
2016-01-05 12:59:30 +03:00
|
|
|
RecvSyncMessage(const nsString& aMessage,
|
|
|
|
const ClonedMessageData& aData,
|
|
|
|
InfallibleTArray<CpowEntry>&& aCpows,
|
|
|
|
const IPC::Principal& aPrincipal,
|
|
|
|
nsTArray<ipc::StructuredCloneData>* aRetVal) override;
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult
|
2016-01-05 12:59:30 +03:00
|
|
|
RecvRpcMessage(const nsString& aMessage,
|
|
|
|
const ClonedMessageData& aData,
|
|
|
|
InfallibleTArray<CpowEntry>&& aCpows,
|
|
|
|
const IPC::Principal& aPrincipal,
|
|
|
|
nsTArray<ipc::StructuredCloneData>* aRetVal) override;
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvAsyncMessage(const nsString& aMessage,
|
|
|
|
InfallibleTArray<CpowEntry>&& aCpows,
|
|
|
|
const IPC::Principal& aPrincipal,
|
|
|
|
const ClonedMessageData& aData) override;
|
2016-01-05 12:59:30 +03:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult
|
2016-01-05 12:59:30 +03:00
|
|
|
RecvNotifyIMEFocus(const ContentCache& aContentCache,
|
|
|
|
const widget::IMENotification& aEventMessage,
|
|
|
|
nsIMEUpdatePreference* aPreference) override;
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult
|
2016-01-05 12:59:30 +03:00
|
|
|
RecvNotifyIMETextChange(const ContentCache& aContentCache,
|
|
|
|
const widget::IMENotification& aEventMessage) override;
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult
|
2016-01-05 12:59:30 +03:00
|
|
|
RecvNotifyIMECompositionUpdate(const ContentCache& aContentCache,
|
|
|
|
const widget::IMENotification& aEventMessage) override;
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult
|
2016-01-05 12:59:30 +03:00
|
|
|
RecvNotifyIMESelection(const ContentCache& aContentCache,
|
|
|
|
const widget::IMENotification& aEventMessage) override;
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult
|
2016-01-05 12:59:30 +03:00
|
|
|
RecvUpdateContentCache(const ContentCache& aContentCache) override;
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult
|
2016-01-05 12:59:30 +03:00
|
|
|
RecvNotifyIMEMouseButtonEvent(const widget::IMENotification& aEventMessage,
|
|
|
|
bool* aConsumedByIME) override;
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult
|
2016-01-05 12:59:30 +03:00
|
|
|
RecvNotifyIMEPositionChange(const ContentCache& aContentCache,
|
|
|
|
const widget::IMENotification& aEventMessage) override;
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult
|
2016-01-05 12:59:30 +03:00
|
|
|
RecvOnEventNeedingAckHandled(const EventMessage& aMessage) override;
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult
|
2016-01-05 12:59:30 +03:00
|
|
|
RecvRequestIMEToCommitComposition(const bool& aCancel,
|
|
|
|
bool* aIsCommitted,
|
|
|
|
nsString* aCommittedString) override;
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult
|
2016-01-05 12:59:30 +03:00
|
|
|
RecvStartPluginIME(const WidgetKeyboardEvent& aKeyboardEvent,
|
|
|
|
const int32_t& aPanelX,
|
|
|
|
const int32_t& aPanelY,
|
|
|
|
nsString* aCommitted) override;
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvSetPluginFocused(const bool& aFocused) override;
|
2016-01-05 12:59:30 +03:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvSetCandidateWindowForPlugin(
|
|
|
|
const widget::CandidateWindowPosition& aPosition) override;
|
2016-01-05 12:59:30 +03:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult
|
2016-01-05 12:59:30 +03:00
|
|
|
RecvDefaultProcOfPluginEvent(const WidgetPluginEvent& aEvent) override;
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvGetInputContext(int32_t* aIMEEnabled,
|
|
|
|
int32_t* aIMEOpen) override;
|
2016-01-05 12:59:30 +03:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvSetInputContext(const int32_t& aIMEEnabled,
|
|
|
|
const int32_t& aIMEOpen,
|
|
|
|
const nsString& aType,
|
|
|
|
const nsString& aInputmode,
|
|
|
|
const nsString& aActionHint,
|
|
|
|
const int32_t& aCause,
|
|
|
|
const int32_t& aFocusChange) override;
|
2016-01-05 12:59:30 +03:00
|
|
|
|
Bug 1257759 part.5 PluginInstanceChild should post received native key event to chrome process if the key combination may be a shortcut key r=jimm
When PluginInstanceChild receives native key events, it should post the events to the chrome process first for checking if the key combination is reserved. However, posting all key events to the chrome process may make damage to the performance of text input. Therefore, this patch starts to post a key event whose key combination may be a shortcut key. However, for avoiding to shuffle the event order, it posts following key events until all posted key events are handled by the chrome process.
For receiving response from widget, this patch defines nsIKeyEventInPluginCallback. It's specified by nsIWidget::OnWindowedPluginKeyEvent() for ensuring the caller will receive the reply. Basically, the caller of nsIWidget::OnWindowedPluginKeyEvent() should reply to the child process. However, if the widget is a PuppetWidget, it cannot return the result synchronously. Therefore, PuppetWidget::OnWindowedPluginKeyEvent() returns NS_SUCCESS_EVENT_HANDLED_ASYNCHRONOUSLY and stores the callback to mKeyEventInPluginCallbacks. Then, TabParent::HandledWindowedPluginKeyEvent() will call PuppetWidget::HandledWindowedPluginKeyEvent().
MozReview-Commit-ID: G6brOU26NwQ
--HG--
extra : rebase_source : 8140456de278956d2d594e85c7b397ae366b4962
2016-04-19 14:09:37 +03:00
|
|
|
|
|
|
|
// See nsIKeyEventInPluginCallback
|
|
|
|
virtual void HandledWindowedPluginKeyEvent(
|
|
|
|
const NativeEventData& aKeyEventData,
|
|
|
|
bool aIsConsumed) override;
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvOnWindowedPluginKeyEvent(
|
|
|
|
const NativeEventData& aKeyEventData) override;
|
Bug 1257759 part.5 PluginInstanceChild should post received native key event to chrome process if the key combination may be a shortcut key r=jimm
When PluginInstanceChild receives native key events, it should post the events to the chrome process first for checking if the key combination is reserved. However, posting all key events to the chrome process may make damage to the performance of text input. Therefore, this patch starts to post a key event whose key combination may be a shortcut key. However, for avoiding to shuffle the event order, it posts following key events until all posted key events are handled by the chrome process.
For receiving response from widget, this patch defines nsIKeyEventInPluginCallback. It's specified by nsIWidget::OnWindowedPluginKeyEvent() for ensuring the caller will receive the reply. Basically, the caller of nsIWidget::OnWindowedPluginKeyEvent() should reply to the child process. However, if the widget is a PuppetWidget, it cannot return the result synchronously. Therefore, PuppetWidget::OnWindowedPluginKeyEvent() returns NS_SUCCESS_EVENT_HANDLED_ASYNCHRONOUSLY and stores the callback to mKeyEventInPluginCallbacks. Then, TabParent::HandledWindowedPluginKeyEvent() will call PuppetWidget::HandledWindowedPluginKeyEvent().
MozReview-Commit-ID: G6brOU26NwQ
--HG--
extra : rebase_source : 8140456de278956d2d594e85c7b397ae366b4962
2016-04-19 14:09:37 +03:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvRequestFocus(const bool& aCanRaise) override;
|
2016-01-05 12:59:30 +03:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvLookUpDictionary(
|
|
|
|
const nsString& aText,
|
|
|
|
nsTArray<mozilla::FontRange>&& aFontRangeArray,
|
|
|
|
const bool& aIsVertical,
|
|
|
|
const LayoutDeviceIntPoint& aPoint) override;
|
2016-04-26 11:18:04 +03:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult
|
2016-01-05 12:59:30 +03:00
|
|
|
RecvEnableDisableCommands(const nsString& aAction,
|
|
|
|
nsTArray<nsCString>&& aEnabledCommands,
|
|
|
|
nsTArray<nsCString>&& aDisabledCommands) override;
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult
|
2016-01-05 12:59:30 +03:00
|
|
|
RecvSetCursor(const uint32_t& aValue, const bool& aForce) override;
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvSetCustomCursor(const nsCString& aUri,
|
|
|
|
const uint32_t& aWidth,
|
|
|
|
const uint32_t& aHeight,
|
|
|
|
const uint32_t& aStride,
|
|
|
|
const uint8_t& aFormat,
|
|
|
|
const uint32_t& aHotspotX,
|
|
|
|
const uint32_t& aHotspotY,
|
|
|
|
const bool& aForce) override;
|
2016-01-05 12:59:30 +03:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvSetStatus(const uint32_t& aType,
|
|
|
|
const nsString& aStatus) override;
|
2016-01-05 12:59:30 +03:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvIsParentWindowMainWidgetVisible(bool* aIsVisible) override;
|
2016-01-05 12:59:30 +03:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvShowTooltip(const uint32_t& aX,
|
|
|
|
const uint32_t& aY,
|
|
|
|
const nsString& aTooltip,
|
|
|
|
const nsString& aDirection) override;
|
2016-01-05 12:59:30 +03:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvHideTooltip() override;
|
2016-01-05 12:59:30 +03:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvGetDPI(float* aValue) override;
|
2016-01-05 12:59:30 +03:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvGetDefaultScale(double* aValue) override;
|
2016-01-05 12:59:30 +03:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvGetWidgetRounding(int32_t* aValue) override;
|
2016-09-27 09:37:07 +03:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvGetMaxTouchPoints(uint32_t* aTouchPoints) override;
|
2016-01-05 12:59:30 +03:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvGetWidgetNativeData(WindowsHandle* aValue) override;
|
2016-01-05 12:59:30 +03:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvSetNativeChildOfShareableWindow(const uintptr_t& childWindow) override;
|
2016-01-05 12:59:30 +03:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvDispatchFocusToTopLevelWindow() override;
|
2016-01-05 12:59:30 +03:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvRespondStartSwipeEvent(const uint64_t& aInputBlockId,
|
|
|
|
const bool& aStartSwipe) override;
|
2016-01-05 12:59:30 +03:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult
|
2016-01-05 12:59:30 +03:00
|
|
|
RecvDispatchWheelEvent(const mozilla::WidgetWheelEvent& aEvent) override;
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult
|
2016-01-05 12:59:30 +03:00
|
|
|
RecvDispatchMouseEvent(const mozilla::WidgetMouseEvent& aEvent) override;
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult
|
2016-01-05 12:59:30 +03:00
|
|
|
RecvDispatchKeyboardEvent(const mozilla::WidgetKeyboardEvent& aEvent) override;
|
|
|
|
|
|
|
|
virtual PColorPickerParent*
|
|
|
|
AllocPColorPickerParent(const nsString& aTitle,
|
|
|
|
const nsString& aInitialColor) override;
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
DeallocPColorPickerParent(PColorPickerParent* aColorPicker) override;
|
|
|
|
|
2016-06-20 16:55:00 +03:00
|
|
|
virtual PDatePickerParent*
|
|
|
|
AllocPDatePickerParent(const nsString& aTitle, const nsString& aInitialDate) override;
|
|
|
|
virtual bool DeallocPDatePickerParent(PDatePickerParent* aDatePicker) override;
|
|
|
|
|
2016-01-05 12:59:30 +03:00
|
|
|
virtual PDocAccessibleParent*
|
2016-10-27 22:16:24 +03:00
|
|
|
AllocPDocAccessibleParent(PDocAccessibleParent*, const uint64_t&,
|
2016-12-02 02:28:54 +03:00
|
|
|
const uint32_t&, const IAccessibleHolder&) override;
|
2016-01-05 12:59:30 +03:00
|
|
|
|
|
|
|
virtual bool DeallocPDocAccessibleParent(PDocAccessibleParent*) override;
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult
|
2016-01-05 12:59:30 +03:00
|
|
|
RecvPDocAccessibleConstructor(PDocAccessibleParent* aDoc,
|
|
|
|
PDocAccessibleParent* aParentDoc,
|
2016-10-27 22:16:24 +03:00
|
|
|
const uint64_t& aParentID,
|
2016-12-02 02:28:54 +03:00
|
|
|
const uint32_t& aMsaaID,
|
|
|
|
const IAccessibleHolder& aDocCOMProxy) override;
|
2016-01-05 12:59:30 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Return the top level doc accessible parent for this tab.
|
|
|
|
*/
|
|
|
|
a11y::DocAccessibleParent* GetTopLevelDocAccessible() const;
|
|
|
|
|
|
|
|
void LoadURL(nsIURI* aURI);
|
|
|
|
|
2017-01-17 23:52:45 +03:00
|
|
|
void InitRenderFrame();
|
|
|
|
|
2016-01-05 12:59:30 +03: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 ScreenIntSize& aSize, bool aParentIsActive);
|
|
|
|
|
|
|
|
void UpdateDimensions(const nsIntRect& aRect, const ScreenIntSize& aSize);
|
|
|
|
|
2016-02-23 19:10:00 +03:00
|
|
|
void SizeModeChanged(const nsSizeMode& aSizeMode);
|
|
|
|
|
2016-01-05 12:59:30 +03:00
|
|
|
void UIResolutionChanged();
|
|
|
|
|
|
|
|
void ThemeChanged();
|
|
|
|
|
2016-05-11 15:56:42 +03:00
|
|
|
void HandleAccessKey(const WidgetKeyboardEvent& aEvent,
|
|
|
|
nsTArray<uint32_t>& aCharCodes,
|
2016-01-05 12:59:30 +03:00
|
|
|
const int32_t& aModifierMask);
|
|
|
|
|
|
|
|
void Activate();
|
|
|
|
|
|
|
|
void Deactivate();
|
|
|
|
|
|
|
|
bool MapEventCoordinatesForChildProcess(mozilla::WidgetEvent* aEvent);
|
|
|
|
|
|
|
|
void MapEventCoordinatesForChildProcess(const LayoutDeviceIntPoint& aOffset,
|
|
|
|
mozilla::WidgetEvent* aEvent);
|
|
|
|
|
|
|
|
LayoutDeviceToCSSScale GetLayoutDeviceToCSSScale();
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult
|
2016-01-05 12:59:30 +03:00
|
|
|
RecvRequestNativeKeyBindings(const mozilla::WidgetKeyboardEvent& aEvent,
|
|
|
|
MaybeNativeKeyBinding* aBindings) override;
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult
|
2016-01-05 12:59:30 +03:00
|
|
|
RecvSynthesizeNativeKeyEvent(const int32_t& aNativeKeyboardLayout,
|
|
|
|
const int32_t& aNativeKeyCode,
|
|
|
|
const uint32_t& aModifierFlags,
|
|
|
|
const nsString& aCharacters,
|
|
|
|
const nsString& aUnmodifiedCharacters,
|
|
|
|
const uint64_t& aObserverId) override;
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult
|
2016-01-05 12:59:30 +03:00
|
|
|
RecvSynthesizeNativeMouseEvent(const LayoutDeviceIntPoint& aPoint,
|
|
|
|
const uint32_t& aNativeMessage,
|
|
|
|
const uint32_t& aModifierFlags,
|
|
|
|
const uint64_t& aObserverId) override;
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult
|
2016-01-05 12:59:30 +03:00
|
|
|
RecvSynthesizeNativeMouseMove(const LayoutDeviceIntPoint& aPoint,
|
2016-11-15 06:26:00 +03:00
|
|
|
const uint64_t& aObserverId) override;
|
2016-01-05 12:59:30 +03:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult
|
2016-01-05 12:59:30 +03:00
|
|
|
RecvSynthesizeNativeMouseScrollEvent(const LayoutDeviceIntPoint& aPoint,
|
|
|
|
const uint32_t& aNativeMessage,
|
|
|
|
const double& aDeltaX,
|
|
|
|
const double& aDeltaY,
|
|
|
|
const double& aDeltaZ,
|
|
|
|
const uint32_t& aModifierFlags,
|
|
|
|
const uint32_t& aAdditionalFlags,
|
|
|
|
const uint64_t& aObserverId) override;
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult
|
2016-01-05 12:59:30 +03:00
|
|
|
RecvSynthesizeNativeTouchPoint(const uint32_t& aPointerId,
|
|
|
|
const TouchPointerState& aPointerState,
|
2016-04-15 13:39:36 +03:00
|
|
|
const LayoutDeviceIntPoint& aPoint,
|
2016-01-05 12:59:30 +03:00
|
|
|
const double& aPointerPressure,
|
|
|
|
const uint32_t& aPointerOrientation,
|
|
|
|
const uint64_t& aObserverId) override;
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult
|
2016-04-15 13:39:36 +03:00
|
|
|
RecvSynthesizeNativeTouchTap(const LayoutDeviceIntPoint& aPoint,
|
2016-01-05 12:59:30 +03:00
|
|
|
const bool& aLongTap,
|
|
|
|
const uint64_t& aObserverId) override;
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult
|
2016-01-05 12:59:30 +03:00
|
|
|
RecvClearNativeTouchSequence(const uint64_t& aObserverId) override;
|
|
|
|
|
|
|
|
void SendMouseEvent(const nsAString& aType, float aX, float aY,
|
|
|
|
int32_t aButton, int32_t aClickCount,
|
|
|
|
int32_t aModifiers, bool aIgnoreRootScrollFrame);
|
|
|
|
|
|
|
|
void SendKeyEvent(const nsAString& aType, int32_t aKeyCode,
|
|
|
|
int32_t aCharCode, int32_t aModifiers,
|
|
|
|
bool aPreventDefault);
|
|
|
|
|
2017-01-19 11:27:15 +03:00
|
|
|
bool SendRealMouseEvent(mozilla::WidgetMouseEvent& aEvent);
|
2016-01-05 12:59:30 +03:00
|
|
|
|
|
|
|
bool SendRealDragEvent(mozilla::WidgetDragEvent& aEvent,
|
|
|
|
uint32_t aDragAction,
|
|
|
|
uint32_t aDropEffect);
|
|
|
|
|
2017-01-19 11:27:15 +03:00
|
|
|
bool SendMouseWheelEvent(mozilla::WidgetWheelEvent& aEvent);
|
2016-01-05 12:59:30 +03:00
|
|
|
|
2017-01-19 11:27:15 +03:00
|
|
|
bool SendRealKeyEvent(mozilla::WidgetKeyboardEvent& aEvent);
|
2016-01-05 12:59:30 +03:00
|
|
|
|
2017-01-19 11:27:15 +03:00
|
|
|
bool SendRealTouchEvent(WidgetTouchEvent& aEvent);
|
2016-01-05 12:59:30 +03:00
|
|
|
|
2016-09-21 17:26:33 +03:00
|
|
|
bool SendHandleTap(TapType aType,
|
|
|
|
const LayoutDevicePoint& aPoint,
|
|
|
|
Modifiers aModifiers,
|
|
|
|
const ScrollableLayerGuid& aGuid,
|
|
|
|
uint64_t aInputBlockId);
|
|
|
|
|
2016-01-05 12:59:30 +03:00
|
|
|
virtual PDocumentRendererParent*
|
|
|
|
AllocPDocumentRendererParent(const nsRect& documentRect,
|
|
|
|
const gfx::Matrix& transform,
|
|
|
|
const nsString& bgcolor,
|
|
|
|
const uint32_t& renderFlags,
|
|
|
|
const bool& flushLayout,
|
|
|
|
const nsIntSize& renderSize) override;
|
2014-11-12 23:59:19 +03:00
|
|
|
|
2016-01-05 12:59:30 +03:00
|
|
|
virtual bool
|
|
|
|
DeallocPDocumentRendererParent(PDocumentRendererParent* actor) override;
|
2014-11-16 21:23:22 +03:00
|
|
|
|
2016-01-05 12:59:30 +03:00
|
|
|
virtual PFilePickerParent*
|
|
|
|
AllocPFilePickerParent(const nsString& aTitle,
|
|
|
|
const int16_t& aMode) override;
|
2015-01-16 21:07:50 +03:00
|
|
|
|
2016-01-05 12:59:30 +03:00
|
|
|
virtual bool DeallocPFilePickerParent(PFilePickerParent* actor) override;
|
2015-01-16 21:07:50 +03:00
|
|
|
|
2016-01-05 12:59:30 +03:00
|
|
|
virtual PIndexedDBPermissionRequestParent*
|
|
|
|
AllocPIndexedDBPermissionRequestParent(const Principal& aPrincipal) override;
|
2015-02-27 08:30:44 +03:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult
|
2016-01-05 12:59:30 +03:00
|
|
|
RecvPIndexedDBPermissionRequestConstructor(
|
2016-11-15 06:26:00 +03:00
|
|
|
PIndexedDBPermissionRequestParent* aActor,
|
|
|
|
const Principal& aPrincipal)
|
2016-01-05 12:59:30 +03:00
|
|
|
override;
|
2015-04-08 21:48:11 +03:00
|
|
|
|
2016-01-05 12:59:30 +03:00
|
|
|
virtual bool
|
|
|
|
DeallocPIndexedDBPermissionRequestParent(
|
|
|
|
PIndexedDBPermissionRequestParent* aActor)
|
|
|
|
override;
|
2015-04-08 21:48:11 +03:00
|
|
|
|
2016-01-05 12:59:30 +03:00
|
|
|
bool GetGlobalJSObject(JSContext* cx, JSObject** globalp);
|
2015-08-06 00:25:39 +03:00
|
|
|
|
2016-01-05 12:59:30 +03:00
|
|
|
NS_DECL_ISUPPORTS
|
|
|
|
NS_DECL_NSIAUTHPROMPTPROVIDER
|
|
|
|
NS_DECL_NSISECUREBROWSERUI
|
|
|
|
NS_DECL_NSIWEBBROWSERPERSISTABLE
|
2015-10-02 15:25:22 +03:00
|
|
|
|
2016-01-05 12:59:30 +03:00
|
|
|
bool HandleQueryContentEvent(mozilla::WidgetQueryContentEvent& aEvent);
|
|
|
|
|
2017-01-19 11:27:15 +03:00
|
|
|
bool SendCompositionEvent(mozilla::WidgetCompositionEvent& aEvent);
|
2016-01-05 12:59:30 +03:00
|
|
|
|
2017-01-19 11:27:15 +03:00
|
|
|
bool SendSelectionEvent(mozilla::WidgetSelectionEvent& aEvent);
|
2016-01-05 12:59:30 +03:00
|
|
|
|
2016-08-31 04:30:45 +03:00
|
|
|
bool SendPasteTransferable(const IPCDataTransfer& aDataTransfer,
|
|
|
|
const bool& aIsPrivateData,
|
|
|
|
const IPC::Principal& aRequestingPrincipal);
|
|
|
|
|
2016-01-05 12:59:30 +03:00
|
|
|
static TabParent* GetFrom(nsFrameLoader* aFrameLoader);
|
|
|
|
|
|
|
|
static TabParent* GetFrom(nsIFrameLoader* aFrameLoader);
|
|
|
|
|
|
|
|
static TabParent* GetFrom(nsITabParent* aTabParent);
|
|
|
|
|
|
|
|
static TabParent* GetFrom(PBrowserParent* aTabParent);
|
|
|
|
|
|
|
|
static TabParent* GetFrom(nsIContent* aContent);
|
|
|
|
|
|
|
|
static TabId GetTabIdFrom(nsIDocShell* docshell);
|
|
|
|
|
|
|
|
nsIContentParent* Manager() const { return mManager; }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Let managees query if Destroy() is already called so they don't send out
|
|
|
|
* messages when the PBrowser actor is being destroyed.
|
|
|
|
*/
|
|
|
|
bool IsDestroyed() const { return mIsDestroyed; }
|
|
|
|
|
|
|
|
already_AddRefed<nsIWidget> GetWidget() const;
|
|
|
|
|
|
|
|
const TabId GetTabId() const
|
|
|
|
{
|
|
|
|
return mTabId;
|
|
|
|
}
|
|
|
|
|
|
|
|
LayoutDeviceIntPoint GetChildProcessOffset();
|
2016-07-29 21:44:29 +03:00
|
|
|
LayoutDevicePoint AdjustTapToChildWidget(const LayoutDevicePoint& aPoint);
|
2016-01-05 12:59:30 +03:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Native widget remoting protocol for use with windowed plugins with e10s.
|
|
|
|
*/
|
|
|
|
virtual PPluginWidgetParent* AllocPPluginWidgetParent() override;
|
|
|
|
|
|
|
|
virtual bool
|
|
|
|
DeallocPPluginWidgetParent(PPluginWidgetParent* aActor) override;
|
|
|
|
|
|
|
|
void SetInitedByParent() { mInitedByParent = true; }
|
|
|
|
|
|
|
|
bool IsInitedByParent() const { return mInitedByParent; }
|
|
|
|
|
|
|
|
static TabParent* GetNextTabParent();
|
|
|
|
|
|
|
|
bool SendLoadRemoteScript(const nsString& aURL,
|
|
|
|
const bool& aRunInGlobalScope);
|
|
|
|
|
2016-07-23 02:36:45 +03:00
|
|
|
void LayerTreeUpdate(uint64_t aEpoch, bool aActive);
|
2016-01-05 12:59:30 +03:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult
|
2016-01-05 12:59:30 +03:00
|
|
|
RecvInvokeDragSession(nsTArray<IPCDataTransfer>&& aTransfers,
|
|
|
|
const uint32_t& aAction,
|
2016-06-15 15:49:13 +03:00
|
|
|
const OptionalShmem& aVisualDnDData,
|
2016-01-05 12:59:30 +03:00
|
|
|
const uint32_t& aStride, const uint8_t& aFormat,
|
2016-10-19 22:01:39 +03:00
|
|
|
const LayoutDeviceIntRect& aDragRect) override;
|
2016-01-05 12:59:30 +03:00
|
|
|
|
|
|
|
void AddInitialDnDDataTo(DataTransfer* aDataTransfer);
|
|
|
|
|
2016-10-19 22:01:39 +03:00
|
|
|
bool TakeDragVisualization(RefPtr<mozilla::gfx::SourceSurface>& aSurface,
|
|
|
|
LayoutDeviceIntRect* aDragRect);
|
2016-01-05 12:59:30 +03:00
|
|
|
|
|
|
|
layout::RenderFrameParent* GetRenderFrame();
|
|
|
|
|
2016-01-30 20:05:36 +03:00
|
|
|
void AudioChannelChangeNotification(nsPIDOMWindowOuter* aWindow,
|
2016-01-05 12:59:30 +03:00
|
|
|
AudioChannel aAudioChannel,
|
|
|
|
float aVolume,
|
|
|
|
bool aMuted);
|
2016-03-29 21:32:41 +03:00
|
|
|
bool SetRenderFrame(PRenderFrameParent* aRFParent);
|
|
|
|
bool GetRenderFrameInfo(TextureFactoryIdentifier* aTextureFactoryIdentifier,
|
|
|
|
uint64_t* aLayersId);
|
2015-12-11 19:17:33 +03:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
mozilla::ipc::IPCResult RecvEnsureLayersConnected() override;
|
2016-09-20 11:19:32 +03:00
|
|
|
|
2017-02-01 18:38:16 +03:00
|
|
|
// LiveResizeListener implementation
|
|
|
|
void LiveResizeStarted() override;
|
|
|
|
void LiveResizeStopped() override;
|
|
|
|
|
2009-11-05 21:14:22 +03:00
|
|
|
protected:
|
2016-01-05 12:59:30 +03:00
|
|
|
bool ReceiveMessage(const nsString& aMessage,
|
|
|
|
bool aSync,
|
|
|
|
ipc::StructuredCloneData* aData,
|
|
|
|
mozilla::jsipc::CpowHolder* aCpows,
|
|
|
|
nsIPrincipal* aPrincipal,
|
|
|
|
nsTArray<ipc::StructuredCloneData>* aJSONRetVal = nullptr);
|
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvAsyncAuthPrompt(const nsCString& aUri,
|
|
|
|
const nsString& aRealm,
|
|
|
|
const uint64_t& aCallbackId) override;
|
2010-03-30 00:29:45 +04:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult Recv__delete__() override;
|
2014-06-11 09:44:36 +04:00
|
|
|
|
2016-01-05 12:59:30 +03:00
|
|
|
virtual void ActorDestroy(ActorDestroyReason why) override;
|
2012-07-17 22:27:27 +04:00
|
|
|
|
2016-01-05 12:59:30 +03:00
|
|
|
Element* mFrameElement;
|
|
|
|
nsCOMPtr<nsIBrowserDOMWindow> mBrowserDOMWindow;
|
2010-04-12 04:34:02 +04:00
|
|
|
|
2016-01-05 12:59:30 +03:00
|
|
|
virtual PRenderFrameParent* AllocPRenderFrameParent() override;
|
2010-03-26 21:39:39 +03:00
|
|
|
|
2016-01-05 12:59:30 +03:00
|
|
|
virtual bool DeallocPRenderFrameParent(PRenderFrameParent* aFrame) override;
|
2010-08-21 03:24:41 +04:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvRemotePaintIsReady() override;
|
2014-05-23 22:19:00 +04:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvForcePaintNoOp(const uint64_t& aLayerObserverEpoch) override;
|
2016-07-23 02:36:45 +03:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvSetDimensions(const uint32_t& aFlags,
|
|
|
|
const int32_t& aX, const int32_t& aY,
|
|
|
|
const int32_t& aCx, const int32_t& aCy) override;
|
2015-01-13 03:41:53 +03:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvGetTabCount(uint32_t* aValue) override;
|
2016-04-14 21:03:00 +03:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvAudioChannelActivityNotification(const uint32_t& aAudioChannel,
|
|
|
|
const bool& aActive) override;
|
2015-07-10 19:38:44 +03:00
|
|
|
|
2016-12-15 08:28:40 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvSHistoryUpdate(const uint32_t& aCount,
|
|
|
|
const uint32_t& aLocalIndex,
|
|
|
|
const bool& aTruncate) override;
|
2016-10-14 10:31:02 +03:00
|
|
|
|
2016-11-15 06:26:00 +03:00
|
|
|
virtual mozilla::ipc::IPCResult RecvRequestCrossBrowserNavigation(const uint32_t& aGlobalIndex) override;
|
2016-10-14 10:31:02 +03:00
|
|
|
|
2016-01-05 12:59:30 +03:00
|
|
|
ContentCacheInParent mContentCache;
|
2010-09-24 07:28:15 +04:00
|
|
|
|
2016-01-05 12:59:30 +03:00
|
|
|
nsIntRect mRect;
|
|
|
|
ScreenIntSize mDimensions;
|
|
|
|
ScreenOrientationInternal mOrientation;
|
|
|
|
float mDPI;
|
2016-09-27 09:37:07 +03:00
|
|
|
int32_t mRounding;
|
2016-01-05 12:59:30 +03:00
|
|
|
CSSToLayoutDeviceScale mDefaultScale;
|
|
|
|
bool mUpdatedDimensions;
|
2016-02-23 19:10:00 +03:00
|
|
|
nsSizeMode mSizeMode;
|
2016-03-08 22:14:43 +03:00
|
|
|
LayoutDeviceIntPoint mClientOffset;
|
2016-01-05 12:59:30 +03:00
|
|
|
LayoutDeviceIntPoint mChromeOffset;
|
2010-12-09 21:57:05 +03:00
|
|
|
|
2010-08-06 02:11:23 +04:00
|
|
|
private:
|
2016-01-05 12:59:30 +03:00
|
|
|
void DestroyInternal();
|
|
|
|
|
|
|
|
already_AddRefed<nsFrameLoader>
|
|
|
|
GetFrameLoader(bool aUseCachedFrameLoaderAfterDestroy = false) const;
|
|
|
|
|
|
|
|
RefPtr<nsIContentParent> mManager;
|
|
|
|
void TryCacheDPIAndScale();
|
|
|
|
|
|
|
|
nsresult UpdatePosition();
|
|
|
|
|
|
|
|
bool AsyncPanZoomEnabled() const;
|
|
|
|
|
|
|
|
// Cached value indicating the docshell active state of the remote browser.
|
|
|
|
bool mDocShellIsActive;
|
|
|
|
|
|
|
|
// Update state prior to routing an APZ-aware event to the child process.
|
|
|
|
// |aOutTargetGuid| will contain the identifier
|
|
|
|
// of the APZC instance that handled the event. aOutTargetGuid may be null.
|
|
|
|
// |aOutInputBlockId| will contain the identifier of the input block
|
|
|
|
// that this event was added to, if there was one. aOutInputBlockId may be null.
|
|
|
|
// |aOutApzResponse| will contain the response that the APZ gave when processing
|
|
|
|
// the input block; this is used for generating appropriate pointercancel events.
|
|
|
|
void ApzAwareEventRoutingToChild(ScrollableLayerGuid* aOutTargetGuid,
|
|
|
|
uint64_t* aOutInputBlockId,
|
|
|
|
nsEventStatus* aOutApzResponse);
|
|
|
|
|
|
|
|
// When true, we've initiated normal shutdown and notified our managing PContent.
|
|
|
|
bool mMarkedDestroying;
|
|
|
|
// When true, the TabParent is invalid and we should not send IPC messages anymore.
|
|
|
|
bool mIsDestroyed;
|
|
|
|
|
|
|
|
uint32_t mChromeFlags;
|
|
|
|
|
2016-02-24 03:31:29 +03:00
|
|
|
nsTArray<nsTArray<IPCDataTransferItem>> mInitialDataTransferItems;
|
2016-01-05 12:59:30 +03:00
|
|
|
|
|
|
|
RefPtr<gfx::DataSourceSurface> mDnDVisualization;
|
2016-10-19 22:01:39 +03:00
|
|
|
bool mDragValid;
|
|
|
|
LayoutDeviceIntRect mDragRect;
|
2016-01-05 12:59:30 +03:00
|
|
|
|
|
|
|
// When true, the TabParent is initialized without child side's request.
|
|
|
|
// When false, the TabParent is initialized by window.open() from child side.
|
|
|
|
bool mInitedByParent;
|
|
|
|
|
|
|
|
nsCOMPtr<nsILoadContext> mLoadContext;
|
|
|
|
|
|
|
|
// We keep a strong reference to the frameloader after we've sent the
|
|
|
|
// Destroy message and before we've received __delete__. This allows us to
|
|
|
|
// dispatch message manager messages during this time.
|
|
|
|
RefPtr<nsFrameLoader> mFrameLoader;
|
|
|
|
|
|
|
|
TabId mTabId;
|
|
|
|
|
|
|
|
// When loading a new tab or window via window.open, the child process sends
|
|
|
|
// a new PBrowser to use. We store that tab in sNextTabParent and then
|
|
|
|
// proceed through the browser's normal paths to create a new
|
|
|
|
// window/tab. When it comes time to create a new TabParent, we instead use
|
|
|
|
// sNextTabParent.
|
|
|
|
static TabParent* sNextTabParent;
|
|
|
|
|
|
|
|
// When loading a new tab or window via window.open, the child is
|
|
|
|
// responsible for loading the URL it wants into the new TabChild. When the
|
|
|
|
// parent receives the CreateWindow message, though, it sends a LoadURL
|
|
|
|
// message, usually for about:blank. It's important for the about:blank load
|
|
|
|
// to get processed because the Firefox frontend expects every new window to
|
|
|
|
// immediately start loading something (see bug 1123090). However, we want
|
|
|
|
// the child to process the LoadURL message before it returns from
|
|
|
|
// ProvideWindow so that the URL sent from the parent doesn't override the
|
|
|
|
// child's URL. This is not possible using our IPC mechanisms. To solve the
|
|
|
|
// problem, we skip sending the LoadURL message in the parent and instead
|
|
|
|
// return the URL as a result from CreateWindow. The child simulates
|
|
|
|
// receiving a LoadURL message before returning from ProvideWindow.
|
|
|
|
//
|
|
|
|
// The mCreatingWindow flag is set while dispatching CreateWindow. During
|
|
|
|
// that time, any LoadURL calls are skipped and the URL is stored in
|
|
|
|
// mSkippedURL.
|
|
|
|
bool mCreatingWindow;
|
|
|
|
nsCString mDelayedURL;
|
|
|
|
|
|
|
|
// When loading a new tab or window via window.open, we want to ensure that
|
|
|
|
// frame scripts for that tab are loaded before any scripts start to run in
|
|
|
|
// the window. We can't load the frame scripts the normal way, using
|
|
|
|
// separate IPC messages, since they won't be processed by the child until
|
|
|
|
// returning to the event loop, which is too late. Instead, we queue up
|
|
|
|
// frame scripts that we intend to load and send them as part of the
|
|
|
|
// CreateWindow response. Then TabChild loads them immediately.
|
|
|
|
nsTArray<FrameScriptInfo> mDelayedFrameScripts;
|
|
|
|
|
|
|
|
// Cached cursor setting from TabChild. When the cursor is over the tab,
|
|
|
|
// it should take this appearance.
|
|
|
|
nsCursor mCursor;
|
|
|
|
nsCOMPtr<imgIContainer> mCustomCursor;
|
|
|
|
uint32_t mCustomCursorHotspotX, mCustomCursorHotspotY;
|
|
|
|
|
|
|
|
// True if the cursor changes from the TabChild should change the widget
|
|
|
|
// cursor. This happens whenever the cursor is in the tab's region.
|
|
|
|
bool mTabSetsCursor;
|
|
|
|
|
|
|
|
RefPtr<nsIPresShell> mPresShellWithRefreshListener;
|
|
|
|
|
|
|
|
bool mHasContentOpener;
|
|
|
|
|
2016-02-26 18:52:06 +03:00
|
|
|
#ifdef DEBUG
|
|
|
|
int32_t mActiveSupressDisplayportCount;
|
|
|
|
#endif
|
2016-01-05 12:59:30 +03:00
|
|
|
|
|
|
|
ShowInfo GetShowInfo();
|
|
|
|
|
2014-12-19 02:23:39 +03:00
|
|
|
private:
|
2016-01-05 12:59:30 +03:00
|
|
|
// This is used when APZ needs to find the TabParent associated with a layer
|
|
|
|
// to dispatch events.
|
|
|
|
typedef nsDataHashtable<nsUint64HashKey, TabParent*> LayerToTabParentTable;
|
|
|
|
static LayerToTabParentTable* sLayerToTabParentTable;
|
2014-12-19 02:23:39 +03:00
|
|
|
|
2016-01-05 12:59:30 +03:00
|
|
|
static void AddTabParentToTable(uint64_t aLayersId, TabParent* aTabParent);
|
|
|
|
|
|
|
|
static void RemoveTabParentFromTable(uint64_t aLayersId);
|
2014-12-19 02:23:39 +03:00
|
|
|
|
2016-07-23 02:36:45 +03:00
|
|
|
uint64_t mLayerTreeEpoch;
|
|
|
|
|
|
|
|
// If this flag is set, then the tab's layers will be preserved even when
|
|
|
|
// the tab's docshell is inactive.
|
|
|
|
bool mPreserveLayers;
|
|
|
|
|
2014-12-19 02:23:39 +03:00
|
|
|
public:
|
2016-01-05 12:59:30 +03:00
|
|
|
static TabParent* GetTabParentFromLayersId(uint64_t aLayersId);
|
2009-07-01 00:39:22 +04:00
|
|
|
};
|
|
|
|
|
2015-10-30 02:30:57 +03:00
|
|
|
struct MOZ_STACK_CLASS TabParent::AutoUseNewTab final
|
|
|
|
{
|
|
|
|
public:
|
2016-01-05 12:59:30 +03:00
|
|
|
AutoUseNewTab(TabParent* aNewTab, bool* aWindowIsNew, nsCString* aURLToLoad)
|
|
|
|
: mNewTab(aNewTab), mWindowIsNew(aWindowIsNew), mURLToLoad(aURLToLoad)
|
|
|
|
{
|
|
|
|
MOZ_ASSERT(!TabParent::sNextTabParent);
|
|
|
|
MOZ_ASSERT(!aNewTab->mCreatingWindow);
|
|
|
|
|
|
|
|
TabParent::sNextTabParent = aNewTab;
|
|
|
|
aNewTab->mCreatingWindow = true;
|
|
|
|
aNewTab->mDelayedURL.Truncate();
|
|
|
|
}
|
|
|
|
|
|
|
|
~AutoUseNewTab()
|
|
|
|
{
|
|
|
|
mNewTab->mCreatingWindow = false;
|
|
|
|
*mURLToLoad = mNewTab->mDelayedURL;
|
|
|
|
|
|
|
|
if (TabParent::sNextTabParent) {
|
|
|
|
MOZ_ASSERT(TabParent::sNextTabParent == mNewTab);
|
|
|
|
TabParent::sNextTabParent = nullptr;
|
|
|
|
*mWindowIsNew = false;
|
2015-10-30 02:30:57 +03:00
|
|
|
}
|
2016-01-05 12:59:30 +03:00
|
|
|
}
|
2015-10-30 02:30:57 +03:00
|
|
|
|
|
|
|
private:
|
2016-01-05 12:59:30 +03:00
|
|
|
TabParent* mNewTab;
|
|
|
|
bool* mWindowIsNew;
|
|
|
|
nsCString* mURLToLoad;
|
2015-10-30 02:30:57 +03:00
|
|
|
};
|
|
|
|
|
2009-08-12 20:18:08 +04:00
|
|
|
} // namespace dom
|
2009-07-01 00:39:22 +04:00
|
|
|
} // namespace mozilla
|
|
|
|
|
2016-01-05 12:59:30 +03:00
|
|
|
#endif // mozilla_tabs_TabParent_h
|