OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "extensions/renderer/extension_frame_helper.h" | 5 #include "extensions/renderer/extension_frame_helper.h" |
6 | 6 |
7 #include "base/metrics/histogram_macros.h" | 7 #include "base/metrics/histogram_macros.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/timer/elapsed_timer.h" | 9 #include "base/timer/elapsed_timer.h" |
10 #include "content/public/renderer/render_frame.h" | 10 #include "content/public/renderer/render_frame.h" |
11 #include "content/public/renderer/render_view.h" | |
11 #include "extensions/common/api/messaging/message.h" | 12 #include "extensions/common/api/messaging/message.h" |
12 #include "extensions/common/api/messaging/port_id.h" | 13 #include "extensions/common/api/messaging/port_id.h" |
13 #include "extensions/common/constants.h" | 14 #include "extensions/common/constants.h" |
14 #include "extensions/common/extension_messages.h" | 15 #include "extensions/common/extension_messages.h" |
15 #include "extensions/common/manifest_handlers/background_info.h" | 16 #include "extensions/common/manifest_handlers/background_info.h" |
16 #include "extensions/renderer/console.h" | 17 #include "extensions/renderer/console.h" |
17 #include "extensions/renderer/content_watcher.h" | 18 #include "extensions/renderer/content_watcher.h" |
18 #include "extensions/renderer/dispatcher.h" | 19 #include "extensions/renderer/dispatcher.h" |
19 #include "extensions/renderer/messaging_bindings.h" | 20 #include "extensions/renderer/messaging_bindings.h" |
20 #include "extensions/renderer/script_context.h" | 21 #include "extensions/renderer/script_context.h" |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
328 const std::string& function_name, | 329 const std::string& function_name, |
329 const base::ListValue& args) { | 330 const base::ListValue& args) { |
330 extension_dispatcher_->InvokeModuleSystemMethod( | 331 extension_dispatcher_->InvokeModuleSystemMethod( |
331 render_frame(), extension_id, module_name, function_name, args); | 332 render_frame(), extension_id, module_name, function_name, args); |
332 } | 333 } |
333 | 334 |
334 void ExtensionFrameHelper::OnDestruct() { | 335 void ExtensionFrameHelper::OnDestruct() { |
335 delete this; | 336 delete this; |
336 } | 337 } |
337 | 338 |
339 void ExtensionFrameHelper::DraggableRegionsChanged() { | |
340 blink::WebVector<blink::WebDraggableRegion> webregions = | |
341 render_frame()->GetWebFrame()->GetDocument().DraggableRegions(); | |
342 std::vector<DraggableRegion> regions; | |
343 for (size_t i = 0; i < webregions.size(); ++i) { | |
344 DraggableRegion region; | |
345 render_frame()->GetRenderView()->ConvertViewportToWindowViaWidget( | |
alexmos
2017/06/08 21:19:00
Is this going to work for a swapped-out RenderView
Łukasz Anforowicz
2017/06/08 22:27:13
Thanks for catching this.
I guess one option woul
kenrb
2017/06/09 15:43:25
As far as I know, using ConvertViewportToWindowVia
| |
346 &webregions[i].bounds); | |
347 region.bounds = webregions[i].bounds; | |
348 region.draggable = webregions[i].draggable; | |
349 regions.push_back(region); | |
350 } | |
351 Send(new ExtensionHostMsg_UpdateDraggableRegions(routing_id(), regions)); | |
352 } | |
353 | |
338 } // namespace extensions | 354 } // namespace extensions |
OLD | NEW |