Move handling of DraggableRegionsChanged notification from "view" to "frame".
https://codereview.chromium.org/2929493003
This commit is contained in:
parent
624b63a1ca
commit
8c40854983
4 changed files with 21 additions and 17 deletions
|
@ -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) {
|
||||
|
|
|
@ -27,6 +27,7 @@ class AtomRenderFrameObserver : public content::RenderFrameObserver {
|
|||
void DidClearWindowObject() override;
|
||||
void DidCreateScriptContext(v8::Handle<v8::Context> context,
|
||||
int world_id) override;
|
||||
void DraggableRegionsChanged() override;
|
||||
void WillReleaseScriptContext(v8::Local<v8::Context> context,
|
||||
int world_id) override;
|
||||
void OnDestruct() override;
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
#include "net/base/net_module.h"
|
||||
#include "net/grit/net_resources.h"
|
||||
#include "third_party/WebKit/public/web/WebDocument.h"
|
||||
#include "third_party/WebKit/public/web/WebDraggableRegion.h"
|
||||
#include "third_party/WebKit/public/web/WebElement.h"
|
||||
#include "third_party/WebKit/public/web/WebFrame.h"
|
||||
#include "third_party/WebKit/public/web/WebKit.h"
|
||||
|
@ -113,20 +112,6 @@ void AtomRenderViewObserver::EmitIPCEvent(blink::WebLocalFrame* frame,
|
|||
}
|
||||
}
|
||||
|
||||
void AtomRenderViewObserver::DraggableRegionsChanged(blink::WebFrame* frame) {
|
||||
blink::WebVector<blink::WebDraggableRegion> webregions =
|
||||
frame->GetDocument().DraggableRegions();
|
||||
std::vector<DraggableRegion> regions;
|
||||
for (auto& webregion : webregions) {
|
||||
DraggableRegion region;
|
||||
render_view()->ConvertViewportToWindowViaWidget(&webregion.bounds);
|
||||
region.bounds = webregion.bounds;
|
||||
region.draggable = webregion.draggable;
|
||||
regions.push_back(region);
|
||||
}
|
||||
Send(new AtomViewHostMsg_UpdateDraggableRegions(routing_id(), regions));
|
||||
}
|
||||
|
||||
bool AtomRenderViewObserver::OnMessageReceived(const IPC::Message& message) {
|
||||
bool handled = true;
|
||||
IPC_BEGIN_MESSAGE_MAP(AtomRenderViewObserver, message)
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
|
||||
#include "base/strings/string16.h"
|
||||
#include "content/public/renderer/render_view_observer.h"
|
||||
#include "third_party/WebKit/public/web/WebFrame.h"
|
||||
#include "third_party/WebKit/public/web/WebLocalFrame.h"
|
||||
|
||||
namespace base {
|
||||
|
@ -32,7 +31,6 @@ class AtomRenderViewObserver : public content::RenderViewObserver {
|
|||
|
||||
private:
|
||||
// content::RenderViewObserver implementation.
|
||||
void DraggableRegionsChanged(blink::WebFrame* frame) override;
|
||||
bool OnMessageReceived(const IPC::Message& message) override;
|
||||
void OnDestruct() override;
|
||||
|
||||
|
|
Loading…
Reference in a new issue