Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(191)

Side by Side Diff: extensions/renderer/extension_helper.cc

Issue 2929493003: Move handling of DraggableRegionsChanged notification from "view" to "frame". (Closed)
Patch Set: Also add main frame filtering to the browser-side. Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 27 matching lines...) Expand all
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() { 44 void ExtensionHelper::OnDestruct() {
45 delete this; 45 delete this;
46 } 46 }
47 47
48 void ExtensionHelper::DraggableRegionsChanged(blink::WebFrame* frame) {
49 blink::WebVector<blink::WebDraggableRegion> webregions =
50 frame->GetDocument().DraggableRegions();
51 std::vector<DraggableRegion> regions;
52 for (size_t i = 0; i < webregions.size(); ++i) {
53 DraggableRegion region;
54 render_view()->ConvertViewportToWindowViaWidget(&webregions[i].bounds);
55 region.bounds = webregions[i].bounds;
56 region.draggable = webregions[i].draggable;
57 regions.push_back(region);
58 }
59 Send(new ExtensionHostMsg_UpdateDraggableRegions(routing_id(), regions));
60 }
61
62 void ExtensionHelper::OnSetFrameName(const std::string& name) { 48 void ExtensionHelper::OnSetFrameName(const std::string& name) {
63 blink::WebView* web_view = render_view()->GetWebView(); 49 blink::WebView* web_view = render_view()->GetWebView();
64 if (web_view) 50 if (web_view)
65 web_view->MainFrame()->SetName(blink::WebString::FromUTF8(name)); 51 web_view->MainFrame()->SetName(blink::WebString::FromUTF8(name));
66 } 52 }
67 53
68 void ExtensionHelper::OnAppWindowClosed() { 54 void ExtensionHelper::OnAppWindowClosed() {
69 v8::HandleScope scope(v8::Isolate::GetCurrent()); 55 v8::HandleScope scope(v8::Isolate::GetCurrent());
70 v8::Local<v8::Context> v8_context = 56 v8::Local<v8::Context> v8_context =
71 render_view()->GetWebView()->MainFrame()->MainWorldScriptContext(); 57 render_view()->GetWebView()->MainFrame()->MainWorldScriptContext();
72 ScriptContext* script_context = 58 ScriptContext* script_context =
73 dispatcher_->script_context_set().GetByV8Context(v8_context); 59 dispatcher_->script_context_set().GetByV8Context(v8_context);
74 if (!script_context) 60 if (!script_context)
75 return; 61 return;
76 script_context->module_system()->CallModuleMethodSafe("app.window", 62 script_context->module_system()->CallModuleMethodSafe("app.window",
77 "onAppWindowClosed"); 63 "onAppWindowClosed");
78 } 64 }
79 65
80 } // namespace extensions 66 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698