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 23 matching lines...) Expand all Loading... |
34 bool handled = true; | 34 bool handled = true; |
35 IPC_BEGIN_MESSAGE_MAP(ExtensionHelper, message) | 35 IPC_BEGIN_MESSAGE_MAP(ExtensionHelper, message) |
36 IPC_MESSAGE_HANDLER(ExtensionMsg_SetFrameName, OnSetFrameName) | 36 IPC_MESSAGE_HANDLER(ExtensionMsg_SetFrameName, OnSetFrameName) |
37 IPC_MESSAGE_HANDLER(ExtensionMsg_AppWindowClosed, | 37 IPC_MESSAGE_HANDLER(ExtensionMsg_AppWindowClosed, |
38 OnAppWindowClosed) | 38 OnAppWindowClosed) |
39 IPC_MESSAGE_UNHANDLED(handled = false) | 39 IPC_MESSAGE_UNHANDLED(handled = false) |
40 IPC_END_MESSAGE_MAP() | 40 IPC_END_MESSAGE_MAP() |
41 return handled; | 41 return handled; |
42 } | 42 } |
43 | 43 |
| 44 void ExtensionHelper::OnDestruct() { |
| 45 delete this; |
| 46 } |
| 47 |
44 void ExtensionHelper::DraggableRegionsChanged(blink::WebFrame* frame) { | 48 void ExtensionHelper::DraggableRegionsChanged(blink::WebFrame* frame) { |
45 blink::WebVector<blink::WebDraggableRegion> webregions = | 49 blink::WebVector<blink::WebDraggableRegion> webregions = |
46 frame->document().draggableRegions(); | 50 frame->document().draggableRegions(); |
47 std::vector<DraggableRegion> regions; | 51 std::vector<DraggableRegion> regions; |
48 for (size_t i = 0; i < webregions.size(); ++i) { | 52 for (size_t i = 0; i < webregions.size(); ++i) { |
49 DraggableRegion region; | 53 DraggableRegion region; |
50 render_view()->ConvertViewportToWindowViaWidget(&webregions[i].bounds); | 54 render_view()->ConvertViewportToWindowViaWidget(&webregions[i].bounds); |
51 region.bounds = webregions[i].bounds; | 55 region.bounds = webregions[i].bounds; |
52 region.draggable = webregions[i].draggable; | 56 region.draggable = webregions[i].draggable; |
53 regions.push_back(region); | 57 regions.push_back(region); |
(...skipping 13 matching lines...) Expand all Loading... |
67 render_view()->GetWebView()->mainFrame()->mainWorldScriptContext(); | 71 render_view()->GetWebView()->mainFrame()->mainWorldScriptContext(); |
68 ScriptContext* script_context = | 72 ScriptContext* script_context = |
69 dispatcher_->script_context_set().GetByV8Context(v8_context); | 73 dispatcher_->script_context_set().GetByV8Context(v8_context); |
70 if (!script_context) | 74 if (!script_context) |
71 return; | 75 return; |
72 script_context->module_system()->CallModuleMethod("app.window", | 76 script_context->module_system()->CallModuleMethod("app.window", |
73 "onAppWindowClosed"); | 77 "onAppWindowClosed"); |
74 } | 78 } |
75 | 79 |
76 } // namespace extensions | 80 } // namespace extensions |
OLD | NEW |