Move handling of DraggableRegionsChanged notification from "view" to "frame".

https://codereview.chromium.org/2929493003
This commit is contained in:
Aleksei Kuzmin 2017-08-31 19:51:40 +03:00 committed by Cheng Zhao
parent 624b63a1ca
commit 8c40854983
4 changed files with 21 additions and 17 deletions

View file

@ -4,8 +4,13 @@
#include "atom/renderer/atom_render_frame_observer.h"
#include <vector>
#include "atom/common/api/api_messages.h"
#include "content/public/renderer/render_frame.h"
#include "content/public/renderer/render_view.h"
#include "third_party/WebKit/public/web/WebDocument.h"
#include "third_party/WebKit/public/web/WebDraggableRegion.h"
#include "third_party/WebKit/public/web/WebLocalFrame.h"
#include "third_party/WebKit/public/web/WebScriptSource.h"
@ -35,6 +40,21 @@ void AtomRenderFrameObserver::DidCreateScriptContext(
}
}
void AtomRenderFrameObserver::DraggableRegionsChanged() {
blink::WebVector<blink::WebDraggableRegion> webregions =
render_frame_->GetWebFrame()->GetDocument().DraggableRegions();
std::vector<DraggableRegion> regions;
for (auto& webregion : webregions) {
DraggableRegion region;
render_frame_->GetRenderView()->ConvertViewportToWindowViaWidget(
&webregion.bounds);
region.bounds = webregion.bounds;
region.draggable = webregion.draggable;
regions.push_back(region);
}
Send(new AtomViewHostMsg_UpdateDraggableRegions(routing_id(), regions));
}
void AtomRenderFrameObserver::WillReleaseScriptContext(
v8::Local<v8::Context> context,
int world_id) {