OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/renderer/extensions/app_window_custom_bindings.h" | 5 #include "chrome/renderer/extensions/app_window_custom_bindings.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "chrome/common/extensions/extension_action.h" | 10 #include "chrome/common/extensions/extension_action.h" |
11 #include "chrome/common/extensions/extension_messages.h" | 11 #include "chrome/common/extensions/extension_messages.h" |
12 #include "chrome/common/url_constants.h" | 12 #include "chrome/common/url_constants.h" |
13 #include "chrome/renderer/extensions/extension_dispatcher.h" | 13 #include "chrome/renderer/extensions/dispatcher.h" |
14 #include "chrome/renderer/extensions/extension_helper.h" | 14 #include "chrome/renderer/extensions/extension_helper.h" |
15 #include "content/public/renderer/render_thread.h" | 15 #include "content/public/renderer/render_thread.h" |
16 #include "content/public/renderer/render_view.h" | 16 #include "content/public/renderer/render_view.h" |
17 #include "grit/renderer_resources.h" | 17 #include "grit/renderer_resources.h" |
18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNavigationPolicy.h
" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNavigationPolicy.h
" |
20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 20 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebWindowFeatures.h" | 21 #include "third_party/WebKit/Source/WebKit/chromium/public/WebWindowFeatures.h" |
22 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLReques
t.h" | 22 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebURLReques
t.h" |
23 #include "v8/include/v8.h" | 23 #include "v8/include/v8.h" |
24 #include "webkit/glue/webkit_glue.h" | 24 #include "webkit/glue/webkit_glue.h" |
25 | 25 |
26 #include "content/public/renderer/render_view.h" | 26 #include "content/public/renderer/render_view.h" |
27 #include "content/public/renderer/render_view_visitor.h" | 27 #include "content/public/renderer/render_view_visitor.h" |
28 | 28 |
29 namespace extensions { | 29 namespace extensions { |
30 | 30 |
31 AppWindowCustomBindings::AppWindowCustomBindings( | 31 AppWindowCustomBindings::AppWindowCustomBindings(Dispatcher* dispatcher) |
32 ExtensionDispatcher* extension_dispatcher) | 32 : ChromeV8Extension(dispatcher) { |
33 : ChromeV8Extension(extension_dispatcher) { | |
34 RouteStaticFunction("GetView", &GetView); | 33 RouteStaticFunction("GetView", &GetView); |
35 } | 34 } |
36 | 35 |
37 namespace { | 36 namespace { |
38 class FindViewByID : public content::RenderViewVisitor { | 37 class FindViewByID : public content::RenderViewVisitor { |
39 public: | 38 public: |
40 explicit FindViewByID(int route_id) : route_id_(route_id), view_(NULL) { | 39 explicit FindViewByID(int route_id) : route_id_(route_id), view_(NULL) { |
41 } | 40 } |
42 | 41 |
43 content::RenderView* view() { return view_; } | 42 content::RenderView* view() { return view_; } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 WebKit::WebFrame* frame = view->GetWebView()->mainFrame(); | 93 WebKit::WebFrame* frame = view->GetWebView()->mainFrame(); |
95 frame->setOpener(opener); | 94 frame->setOpener(opener); |
96 content::RenderThread::Get()->Send( | 95 content::RenderThread::Get()->Send( |
97 new ExtensionHostMsg_ResumeRequests(view->GetRoutingID())); | 96 new ExtensionHostMsg_ResumeRequests(view->GetRoutingID())); |
98 | 97 |
99 v8::Local<v8::Value> window = frame->mainWorldScriptContext()->Global(); | 98 v8::Local<v8::Value> window = frame->mainWorldScriptContext()->Global(); |
100 return window; | 99 return window; |
101 } | 100 } |
102 | 101 |
103 } // namespace extensions | 102 } // namespace extensions |
OLD | NEW |