Chromium Code Reviews| 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 if (!render_frame()->IsMainFrame()) | |
| 341 return; | |
| 342 | |
| 343 blink::WebVector<blink::WebDraggableRegion> webregions = | |
| 344 render_frame()->GetWebFrame()->GetDocument().DraggableRegions(); | |
| 345 std::vector<DraggableRegion> regions; | |
| 346 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
| |
| 347 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.
| |
| 348 render_frame()->GetRenderView()->ConvertViewportToWindowViaWidget( | |
| 349 &webregions[i].bounds); | |
| 350 region.bounds = webregions[i].bounds; | |
| 351 region.draggable = webregions[i].draggable; | |
| 352 regions.push_back(region); | |
| 353 } | |
| 354 Send(new ExtensionHostMsg_UpdateDraggableRegions(routing_id(), regions)); | |
| 355 } | |
| 356 | |
| 338 } // namespace extensions | 357 } // namespace extensions |
| OLD | NEW |