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/runtime_custom_bindings.h" | 5 #include "chrome/renderer/extensions/runtime_custom_bindings.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "chrome/common/extensions/extension.h" | 10 #include "chrome/common/extensions/extension.h" |
11 #include "chrome/common/extensions/extension_messages.h" | 11 #include "chrome/common/extensions/extension_messages.h" |
12 #include "chrome/common/extensions/manifest.h" | 12 #include "chrome/common/extensions/manifest.h" |
13 #include "chrome/renderer/extensions/chrome_v8_context.h" | 13 #include "chrome/renderer/extensions/chrome_v8_context.h" |
14 #include "chrome/renderer/extensions/dispatcher.h" | 14 #include "chrome/renderer/extensions/dispatcher.h" |
15 #include "content/public/renderer/render_view.h" | 15 #include "content/public/renderer/render_view.h" |
16 #include "content/public/renderer/v8_value_converter.h" | 16 #include "content/public/renderer/v8_value_converter.h" |
17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.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/WebView.h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
20 | 20 |
21 using content::V8ValueConverter; | 21 using content::V8ValueConverter; |
22 | 22 |
23 namespace extensions { | 23 namespace extensions { |
24 | 24 |
25 RuntimeCustomBindings::RuntimeCustomBindings(Dispatcher* dispatcher, | 25 RuntimeCustomBindings::RuntimeCustomBindings(Dispatcher* dispatcher, |
26 ChromeV8Context* context) | 26 ChromeV8Context* context) |
27 : ChromeV8Extension(dispatcher, context->v8_context()), | 27 : ChromeV8Extension(dispatcher, context) { |
28 context_(context) { | |
29 RouteFunction("GetManifest", | 28 RouteFunction("GetManifest", |
30 base::Bind(&RuntimeCustomBindings::GetManifest, | 29 base::Bind(&RuntimeCustomBindings::GetManifest, |
31 base::Unretained(this))); | 30 base::Unretained(this))); |
32 RouteFunction("OpenChannelToExtension", | 31 RouteFunction("OpenChannelToExtension", |
33 base::Bind(&RuntimeCustomBindings::OpenChannelToExtension, | 32 base::Bind(&RuntimeCustomBindings::OpenChannelToExtension, |
34 base::Unretained(this))); | 33 base::Unretained(this))); |
35 RouteFunction("OpenChannelToNativeApp", | 34 RouteFunction("OpenChannelToNativeApp", |
36 base::Bind(&RuntimeCustomBindings::OpenChannelToNativeApp, | 35 base::Bind(&RuntimeCustomBindings::OpenChannelToNativeApp, |
37 base::Unretained(this))); | 36 base::Unretained(this))); |
38 } | 37 } |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 v8::Handle<v8::Value> RuntimeCustomBindings::GetManifest( | 97 v8::Handle<v8::Value> RuntimeCustomBindings::GetManifest( |
99 const v8::Arguments& args) { | 98 const v8::Arguments& args) { |
100 CHECK(context_->extension()); | 99 CHECK(context_->extension()); |
101 | 100 |
102 scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create()); | 101 scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create()); |
103 return converter->ToV8Value(context_->extension()->manifest()->value(), | 102 return converter->ToV8Value(context_->extension()->manifest()->value(), |
104 context_->v8_context()); | 103 context_->v8_context()); |
105 } | 104 } |
106 | 105 |
107 } // extensions | 106 } // extensions |
OLD | NEW |