fix: draggable region ipc should be frame based

This commit is contained in:
deepak1556 2018-01-01 22:54:02 +05:30
parent 5f4b62b6c8
commit 99e26b8318
6 changed files with 13 additions and 7 deletions

View file

@ -688,10 +688,11 @@ void NativeWindow::DidFirstVisuallyNonEmptyPaint() {
base::Bind(&NativeWindow::NotifyReadyToShow, GetWeakPtr()));
}
bool NativeWindow::OnMessageReceived(const IPC::Message& message) {
bool NativeWindow::OnMessageReceived(const IPC::Message& message,
content::RenderFrameHost* rfh) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(NativeWindow, message)
IPC_MESSAGE_HANDLER(AtomViewHostMsg_UpdateDraggableRegions,
IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(NativeWindow, message, rfh)
IPC_MESSAGE_HANDLER(AtomFrameHostMsg_UpdateDraggableRegions,
UpdateDraggableRegions)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
@ -700,6 +701,7 @@ bool NativeWindow::OnMessageReceived(const IPC::Message& message) {
}
void NativeWindow::UpdateDraggableRegions(
content::RenderFrameHost* rfh,
const std::vector<DraggableRegion>& regions) {
// Draggable region is not supported for non-frameless window.
if (has_frame_)

View file

@ -313,13 +313,15 @@ class NativeWindow : public base::SupportsUserData,
// Called when the window needs to update its draggable region.
virtual void UpdateDraggableRegions(
content::RenderFrameHost* rfh,
const std::vector<DraggableRegion>& regions);
// content::WebContentsObserver:
void RenderViewCreated(content::RenderViewHost* render_view_host) override;
void BeforeUnloadDialogCancelled() override;
void DidFirstVisuallyNonEmptyPaint() override;
bool OnMessageReceived(const IPC::Message& message) override;
bool OnMessageReceived(const IPC::Message& message,
content::RenderFrameHost* rfh) override;
private:
// Schedule a notification unresponsive event.

View file

@ -159,6 +159,7 @@ class NativeWindowMac : public NativeWindow,
gfx::Rect ContentBoundsToWindowBounds(const gfx::Rect& bounds) const;
gfx::Rect WindowBoundsToContentBounds(const gfx::Rect& bounds) const;
void UpdateDraggableRegions(
content::RenderFrameHost* rfh,
const std::vector<DraggableRegion>& regions) override;
void InternalSetParentWindow(NativeWindow* parent, bool attach);

View file

@ -1814,8 +1814,9 @@ gfx::Rect NativeWindowMac::WindowBoundsToContentBounds(
}
void NativeWindowMac::UpdateDraggableRegions(
content::RenderFrameHost* rfh,
const std::vector<DraggableRegion>& regions) {
NativeWindow::UpdateDraggableRegions(regions);
NativeWindow::UpdateDraggableRegions(rfh, regions);
draggable_regions_ = regions;
UpdateDraggableRegionViews(regions);
}

View file

@ -49,7 +49,7 @@ IPC_MESSAGE_ROUTED1(AtomAutofillFrameMsg_AcceptSuggestion,
base::string16 /* suggestion */)
// Sent by the renderer when the draggable regions are updated.
IPC_MESSAGE_ROUTED1(AtomViewHostMsg_UpdateDraggableRegions,
IPC_MESSAGE_ROUTED1(AtomFrameHostMsg_UpdateDraggableRegions,
std::vector<atom::DraggableRegion> /* regions */)
// Update renderer process preferences.

View file

@ -52,7 +52,7 @@ void AtomRenderFrameObserver::DraggableRegionsChanged() {
region.draggable = webregion.draggable;
regions.push_back(region);
}
Send(new AtomViewHostMsg_UpdateDraggableRegions(routing_id(), regions));
Send(new AtomFrameHostMsg_UpdateDraggableRegions(routing_id(), regions));
}
void AtomRenderFrameObserver::WillReleaseScriptContext(