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 "apps/shell/renderer/shell_custom_bindings.h" | 5 #include "extensions/shell/renderer/shell_custom_bindings.h" |
6 | 6 |
7 #include "content/public/renderer/render_thread.h" | 7 #include "content/public/renderer/render_thread.h" |
8 #include "content/public/renderer/render_view.h" | 8 #include "content/public/renderer/render_view.h" |
9 #include "content/public/renderer/v8_value_converter.h" | 9 #include "content/public/renderer/v8_value_converter.h" |
10 #include "extensions/common/extension_messages.h" | 10 #include "extensions/common/extension_messages.h" |
11 #include "extensions/renderer/script_context.h" | 11 #include "extensions/renderer/script_context.h" |
12 #include "extensions/renderer/script_context_set.h" | 12 #include "extensions/renderer/script_context_set.h" |
13 #include "third_party/WebKit/public/web/WebFrame.h" | 13 #include "third_party/WebKit/public/web/WebFrame.h" |
14 #include "third_party/WebKit/public/web/WebView.h" | 14 #include "third_party/WebKit/public/web/WebView.h" |
15 #include "v8/include/v8.h" | 15 #include "v8/include/v8.h" |
16 | 16 |
17 namespace apps { | 17 namespace extensions { |
18 | 18 |
19 ShellCustomBindings::ShellCustomBindings(extensions::ScriptContext* context) | 19 ShellCustomBindings::ShellCustomBindings(ScriptContext* context) |
20 : extensions::ObjectBackedNativeHandler(context) { | 20 : ObjectBackedNativeHandler(context) { |
21 RouteFunction( | 21 RouteFunction( |
22 "GetView", | 22 "GetView", |
23 base::Bind(&ShellCustomBindings::GetView, base::Unretained(this))); | 23 base::Bind(&ShellCustomBindings::GetView, base::Unretained(this))); |
24 } | 24 } |
25 | 25 |
26 void ShellCustomBindings::GetView( | 26 void ShellCustomBindings::GetView( |
27 const v8::FunctionCallbackInfo<v8::Value>& args) { | 27 const v8::FunctionCallbackInfo<v8::Value>& args) { |
28 if (args.Length() != 1 || !args[0]->IsInt32()) | 28 if (args.Length() != 1 || !args[0]->IsInt32()) |
29 return; | 29 return; |
30 | 30 |
(...skipping 16 matching lines...) Expand all Loading... |
47 | 47 |
48 // Resume resource requests. | 48 // Resume resource requests. |
49 content::RenderThread::Get()->Send( | 49 content::RenderThread::Get()->Send( |
50 new ExtensionHostMsg_ResumeRequests(view->GetRoutingID())); | 50 new ExtensionHostMsg_ResumeRequests(view->GetRoutingID())); |
51 | 51 |
52 // Return the script context. | 52 // Return the script context. |
53 v8::Local<v8::Value> window = frame->mainWorldScriptContext()->Global(); | 53 v8::Local<v8::Value> window = frame->mainWorldScriptContext()->Global(); |
54 args.GetReturnValue().Set(window); | 54 args.GetReturnValue().Set(window); |
55 } | 55 } |
56 | 56 |
57 } // namespace apps | 57 } // namespace extensions |
OLD | NEW |