OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_helper.h" | 5 #include "extensions/renderer/extension_helper.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "content/public/renderer/render_view.h" | 9 #include "content/public/renderer/render_view.h" |
10 #include "extensions/common/constants.h" | 10 #include "extensions/common/constants.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 IPC_END_MESSAGE_MAP() | 40 IPC_END_MESSAGE_MAP() |
41 return handled; | 41 return handled; |
42 } | 42 } |
43 | 43 |
44 void ExtensionHelper::DraggableRegionsChanged(blink::WebFrame* frame) { | 44 void ExtensionHelper::DraggableRegionsChanged(blink::WebFrame* frame) { |
45 blink::WebVector<blink::WebDraggableRegion> webregions = | 45 blink::WebVector<blink::WebDraggableRegion> webregions = |
46 frame->document().draggableRegions(); | 46 frame->document().draggableRegions(); |
47 std::vector<DraggableRegion> regions; | 47 std::vector<DraggableRegion> regions; |
48 for (size_t i = 0; i < webregions.size(); ++i) { | 48 for (size_t i = 0; i < webregions.size(); ++i) { |
49 DraggableRegion region; | 49 DraggableRegion region; |
| 50 render_view()->convertViewportToWindow(&webregions[i].bounds); |
50 region.bounds = webregions[i].bounds; | 51 region.bounds = webregions[i].bounds; |
51 region.draggable = webregions[i].draggable; | 52 region.draggable = webregions[i].draggable; |
52 regions.push_back(region); | 53 regions.push_back(region); |
53 } | 54 } |
54 Send(new ExtensionHostMsg_UpdateDraggableRegions(routing_id(), regions)); | 55 Send(new ExtensionHostMsg_UpdateDraggableRegions(routing_id(), regions)); |
55 } | 56 } |
56 | 57 |
57 void ExtensionHelper::OnSetFrameName(const std::string& name) { | 58 void ExtensionHelper::OnSetFrameName(const std::string& name) { |
58 blink::WebView* web_view = render_view()->GetWebView(); | 59 blink::WebView* web_view = render_view()->GetWebView(); |
59 if (web_view) | 60 if (web_view) |
60 web_view->mainFrame()->setName(blink::WebString::fromUTF8(name)); | 61 web_view->mainFrame()->setName(blink::WebString::fromUTF8(name)); |
61 } | 62 } |
62 | 63 |
63 void ExtensionHelper::OnAppWindowClosed() { | 64 void ExtensionHelper::OnAppWindowClosed() { |
64 v8::HandleScope scope(v8::Isolate::GetCurrent()); | 65 v8::HandleScope scope(v8::Isolate::GetCurrent()); |
65 v8::Local<v8::Context> v8_context = | 66 v8::Local<v8::Context> v8_context = |
66 render_view()->GetWebView()->mainFrame()->mainWorldScriptContext(); | 67 render_view()->GetWebView()->mainFrame()->mainWorldScriptContext(); |
67 ScriptContext* script_context = | 68 ScriptContext* script_context = |
68 dispatcher_->script_context_set().GetByV8Context(v8_context); | 69 dispatcher_->script_context_set().GetByV8Context(v8_context); |
69 if (!script_context) | 70 if (!script_context) |
70 return; | 71 return; |
71 script_context->module_system()->CallModuleMethod("app.window", | 72 script_context->module_system()->CallModuleMethod("app.window", |
72 "onAppWindowClosed"); | 73 "onAppWindowClosed"); |
73 } | 74 } |
74 | 75 |
75 } // namespace extensions | 76 } // namespace extensions |
OLD | NEW |