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/manifest.h" | 11 #include "chrome/common/extensions/manifest.h" |
12 #include "chrome/renderer/extensions/extension_dispatcher.h" | |
13 #include "chrome/renderer/extensions/chrome_v8_context.h" | 12 #include "chrome/renderer/extensions/chrome_v8_context.h" |
14 #include "content/public/renderer/v8_value_converter.h" | 13 #include "content/public/renderer/v8_value_converter.h" |
15 | 14 |
16 using content::V8ValueConverter; | 15 using content::V8ValueConverter; |
17 | 16 |
18 namespace extensions { | 17 namespace extensions { |
19 | 18 |
20 RuntimeCustomBindings::RuntimeCustomBindings(ChromeV8Context* context) | 19 RuntimeCustomBindings::RuntimeCustomBindings(ChromeV8Context* context) |
21 : ChromeV8Extension(NULL), context_(context) { | 20 : ChromeV8Extension(NULL), context_(context) { |
22 RouteFunction("GetManifest", | 21 RouteFunction("GetManifest", |
23 base::Bind(&RuntimeCustomBindings::GetManifest, base::Unretained(this))); | 22 base::Bind(&RuntimeCustomBindings::GetManifest, base::Unretained(this))); |
24 } | 23 } |
25 | 24 |
26 RuntimeCustomBindings::~RuntimeCustomBindings() {} | 25 RuntimeCustomBindings::~RuntimeCustomBindings() {} |
27 | 26 |
28 v8::Handle<v8::Value> RuntimeCustomBindings::GetManifest( | 27 v8::Handle<v8::Value> RuntimeCustomBindings::GetManifest( |
29 const v8::Arguments& args) { | 28 const v8::Arguments& args) { |
30 CHECK(context_->extension()); | 29 CHECK(context_->extension()); |
31 | 30 |
32 scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create()); | 31 scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create()); |
33 return converter->ToV8Value(context_->extension()->manifest()->value(), | 32 return converter->ToV8Value(context_->extension()->manifest()->value(), |
34 context_->v8_context()); | 33 context_->v8_context()); |
35 } | 34 } |
36 | 35 |
37 } // extensions | 36 } // extensions |
OLD | NEW |