| 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 (blink::WebDraggableRegion& webregion : webregions) { |
| 347 render_frame()->GetRenderView()->ConvertViewportToWindowViaWidget( |
| 348 &webregion.bounds); |
| 349 |
| 350 regions.push_back(DraggableRegion()); |
| 351 DraggableRegion& region = regions.back(); |
| 352 region.bounds = webregion.bounds; |
| 353 region.draggable = webregion.draggable; |
| 354 } |
| 355 Send(new ExtensionHostMsg_UpdateDraggableRegions(routing_id(), regions)); |
| 356 } |
| 357 |
| 338 } // namespace extensions | 358 } // namespace extensions |
| OLD | NEW |