Bug 1347117 - Add Activate/Deactivate/ParentActivated to PContentBridge; r=billm

In a nested content process setup, FocusManager needs to activate focus
to a remote frame through ContentBridgeParent, not ContentParent.
This commit is contained in:
Evelyn Hung 2017-03-15 02:00:00 +01:00
parent e6024768b9
commit 00c1af4647
9 changed files with 83 additions and 5 deletions

View File

@ -1144,7 +1144,7 @@ bool
ActivateOrDeactivateChild(TabParent* aParent, void* aArg)
{
bool active = static_cast<bool>(aArg);
Unused << aParent->Manager()->AsContentParent()->SendParentActivated(aParent, active);
Unused << aParent->Manager()->SendParentActivated(aParent, active);
return false;
}

View File

@ -204,5 +204,26 @@ ContentBridgeChild::DeallocPFileDescriptorSetChild(PFileDescriptorSetChild* aAct
return nsIContentChild::DeallocPFileDescriptorSetChild(aActor);
}
mozilla::ipc::IPCResult
ContentBridgeChild::RecvActivate(PBrowserChild* aTab)
{
TabChild* tab = static_cast<TabChild*>(aTab);
return tab->RecvActivate();
}
mozilla::ipc::IPCResult
ContentBridgeChild::RecvDeactivate(PBrowserChild* aTab)
{
TabChild* tab = static_cast<TabChild*>(aTab);
return tab->RecvDeactivate();
}
mozilla::ipc::IPCResult
ContentBridgeChild::RecvParentActivated(PBrowserChild* aTab, const bool& aActivated)
{
TabChild* tab = static_cast<TabChild*>(aTab);
return tab->RecvParentActivated(aActivated);
}
} // namespace dom
} // namespace mozilla

View File

@ -51,6 +51,13 @@ public:
virtual mozilla::ipc::PChildToParentStreamChild*
SendPChildToParentStreamConstructor(mozilla::ipc::PChildToParentStreamChild*) override;
virtual mozilla::ipc::IPCResult RecvActivate(PBrowserChild* aTab) override;
virtual mozilla::ipc::IPCResult RecvDeactivate(PBrowserChild* aTab) override;
virtual mozilla::ipc::IPCResult RecvParentActivated(PBrowserChild* aTab,
const bool& aActivated) override;
FORWARD_SHMEM_ALLOCATOR_TO(PContentBridgeChild)
protected:

View File

@ -69,6 +69,22 @@ public:
virtual mozilla::ipc::PParentToChildStreamParent*
SendPParentToChildStreamConstructor(mozilla::ipc::PParentToChildStreamParent*) override;
virtual bool SendActivate(PBrowserParent* aTab) override
{
return PContentBridgeParent::SendActivate(aTab);
}
virtual bool SendDeactivate(PBrowserParent* aTab) override
{
return PContentBridgeParent::SendDeactivate(aTab);
}
virtual bool SendParentActivated(PBrowserParent* aTab,
const bool& aActivated) override
{
return PContentBridgeParent::SendParentActivated(aTab, aActivated);
}
protected:
virtual ~ContentBridgeParent();

View File

@ -611,6 +611,23 @@ public:
const Principal& aPrincipal,
const bool& aUseTrackingProtection,
bool* aSuccess) override;
virtual bool SendActivate(PBrowserParent* aTab) override
{
return PContentParent::SendActivate(aTab);
}
virtual bool SendDeactivate(PBrowserParent* aTab) override
{
return PContentParent::SendDeactivate(aTab);
}
virtual bool SendParentActivated(PBrowserParent* aTab,
const bool& aActivated) override
{
return PContentParent::SendParentActivated(aTab, aActivated);
}
virtual bool
DeallocPURLClassifierParent(PURLClassifierParent* aActor) override;

View File

@ -45,6 +45,16 @@ nested(upto inside_cpow) sync protocol PContentBridge
child:
async PParentToChildStream();
child:
/**
* Sending an activate message moves focus to the child.
*/
async Activate(PBrowser aTab);
async Deactivate(PBrowser aTab);
async ParentActivated(PBrowser aTab, bool aActivated);
parent:
sync SyncMessage(nsString aMessage, ClonedMessageData aData,
CpowEntry[] aCpows, Principal aPrincipal)

View File

@ -358,6 +358,8 @@ public:
mozilla::ipc::IPCResult RecvDeactivate();
mozilla::ipc::IPCResult RecvParentActivated(const bool& aActivated);
virtual mozilla::ipc::IPCResult RecvMouseEvent(const nsString& aType,
const float& aX,
const float& aY,
@ -692,8 +694,6 @@ protected:
virtual mozilla::ipc::IPCResult RecvSuppressDisplayport(const bool& aEnabled) override;
mozilla::ipc::IPCResult RecvParentActivated(const bool& aActivated);
virtual mozilla::ipc::IPCResult RecvSetKeyboardIndicators(const UIStateChangeType& aShowAccelerators,
const UIStateChangeType& aShowFocusRings) override;

View File

@ -859,7 +859,7 @@ void
TabParent::Activate()
{
if (!mIsDestroyed) {
Unused << Manager()->AsContentParent()->SendActivate(this);
Unused << Manager()->SendActivate(this);
}
}
@ -867,7 +867,7 @@ void
TabParent::Deactivate()
{
if (!mIsDestroyed) {
Unused << Manager()->AsContentParent()->SendDeactivate(this);
Unused << Manager()->SendDeactivate(this);
}
}

View File

@ -91,6 +91,13 @@ public:
nsFrameMessageManager* GetMessageManager() const { return mMessageManager; }
virtual bool SendActivate(PBrowserParent* aTab) = 0;
virtual bool SendDeactivate(PBrowserParent* aTab) = 0;
virtual bool SendParentActivated(PBrowserParent* aTab,
const bool& aActivated) = 0;
virtual int32_t Pid() const = 0;
virtual mozilla::ipc::PParentToChildStreamParent*