Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(729)

Unified Diff: extensions/renderer/extension_frame_helper.cc

Issue 2929493003: Move handling of DraggableRegionsChanged notification from "view" to "frame". (Closed)
Patch Set: Also add main frame filtering to the browser-side. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: extensions/renderer/extension_frame_helper.cc
diff --git a/extensions/renderer/extension_frame_helper.cc b/extensions/renderer/extension_frame_helper.cc
index da47e687f5662c0d8eefb6830a860edf971c2689..093b17b10cea5859167ae441c43fc10491b93f3e 100644
--- a/extensions/renderer/extension_frame_helper.cc
+++ b/extensions/renderer/extension_frame_helper.cc
@@ -8,6 +8,7 @@
#include "base/strings/string_util.h"
#include "base/timer/elapsed_timer.h"
#include "content/public/renderer/render_frame.h"
+#include "content/public/renderer/render_view.h"
#include "extensions/common/api/messaging/message.h"
#include "extensions/common/api/messaging/port_id.h"
#include "extensions/common/constants.h"
@@ -335,4 +336,22 @@ void ExtensionFrameHelper::OnDestruct() {
delete this;
}
+void ExtensionFrameHelper::DraggableRegionsChanged() {
+ if (!render_frame()->IsMainFrame())
+ return;
+
+ blink::WebVector<blink::WebDraggableRegion> webregions =
+ render_frame()->GetWebFrame()->GetDocument().DraggableRegions();
+ std::vector<DraggableRegion> regions;
+ for (size_t i = 0; i < webregions.size(); ++i) {
Devlin 2017/06/13 18:38:30 update this to const blink::WebDraggableRegion&
Łukasz Anforowicz 2017/06/13 20:48:42 Done, good point. (non-const ref, because Convert
+ DraggableRegion region;
Devlin 2017/06/13 18:38:30 A minor optimization here would be something like:
Łukasz Anforowicz 2017/06/13 20:48:42 Done, although I am not sure if this matters much.
+ render_frame()->GetRenderView()->ConvertViewportToWindowViaWidget(
+ &webregions[i].bounds);
+ region.bounds = webregions[i].bounds;
+ region.draggable = webregions[i].draggable;
+ regions.push_back(region);
+ }
+ Send(new ExtensionHostMsg_UpdateDraggableRegions(routing_id(), regions));
+}
+
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698