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 "extensions/renderer/runtime_custom_bindings.h" | 5 #include "extensions/renderer/runtime_custom_bindings.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
| 9 #include <memory> |
| 10 |
9 #include "base/bind.h" | 11 #include "base/bind.h" |
10 #include "base/memory/scoped_ptr.h" | |
11 #include "base/values.h" | 12 #include "base/values.h" |
12 #include "content/public/child/v8_value_converter.h" | 13 #include "content/public/child/v8_value_converter.h" |
13 #include "content/public/renderer/render_frame.h" | 14 #include "content/public/renderer/render_frame.h" |
14 #include "extensions/common/extension.h" | 15 #include "extensions/common/extension.h" |
15 #include "extensions/common/extension_messages.h" | 16 #include "extensions/common/extension_messages.h" |
16 #include "extensions/common/features/feature.h" | 17 #include "extensions/common/features/feature.h" |
17 #include "extensions/common/features/feature_provider.h" | 18 #include "extensions/common/features/feature_provider.h" |
18 #include "extensions/common/manifest.h" | 19 #include "extensions/common/manifest.h" |
19 #include "extensions/renderer/api_activity_logger.h" | 20 #include "extensions/renderer/api_activity_logger.h" |
20 #include "extensions/renderer/extension_frame_helper.h" | 21 #include "extensions/renderer/extension_frame_helper.h" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 int port_id = -1; | 103 int port_id = -1; |
103 render_frame->Send(new ExtensionHostMsg_OpenChannelToNativeApp( | 104 render_frame->Send(new ExtensionHostMsg_OpenChannelToNativeApp( |
104 render_frame->GetRoutingID(), extension_id, native_app_name, &port_id)); | 105 render_frame->GetRoutingID(), extension_id, native_app_name, &port_id)); |
105 args.GetReturnValue().Set(static_cast<int32_t>(port_id)); | 106 args.GetReturnValue().Set(static_cast<int32_t>(port_id)); |
106 } | 107 } |
107 | 108 |
108 void RuntimeCustomBindings::GetManifest( | 109 void RuntimeCustomBindings::GetManifest( |
109 const v8::FunctionCallbackInfo<v8::Value>& args) { | 110 const v8::FunctionCallbackInfo<v8::Value>& args) { |
110 CHECK(context()->extension()); | 111 CHECK(context()->extension()); |
111 | 112 |
112 scoped_ptr<V8ValueConverter> converter(V8ValueConverter::create()); | 113 std::unique_ptr<V8ValueConverter> converter(V8ValueConverter::create()); |
113 args.GetReturnValue().Set(converter->ToV8Value( | 114 args.GetReturnValue().Set(converter->ToV8Value( |
114 context()->extension()->manifest()->value(), context()->v8_context())); | 115 context()->extension()->manifest()->value(), context()->v8_context())); |
115 } | 116 } |
116 | 117 |
117 void RuntimeCustomBindings::GetExtensionViews( | 118 void RuntimeCustomBindings::GetExtensionViews( |
118 const v8::FunctionCallbackInfo<v8::Value>& args) { | 119 const v8::FunctionCallbackInfo<v8::Value>& args) { |
119 if (args.Length() != 2) | 120 if (args.Length() != 2) |
120 return; | 121 return; |
121 | 122 |
122 if (!args[0]->IsInt32() || !args[1]->IsString()) | 123 if (!args[0]->IsInt32() || !args[1]->IsString()) |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 v8::Local<v8::Value> window = context->Global(); | 173 v8::Local<v8::Value> window = context->Global(); |
173 DCHECK(!window.IsEmpty()); | 174 DCHECK(!window.IsEmpty()); |
174 v8_views->Set(v8::Integer::New(args.GetIsolate(), v8_index++), window); | 175 v8_views->Set(v8::Integer::New(args.GetIsolate(), v8_index++), window); |
175 } | 176 } |
176 } | 177 } |
177 | 178 |
178 args.GetReturnValue().Set(v8_views); | 179 args.GetReturnValue().Set(v8_views); |
179 } | 180 } |
180 | 181 |
181 } // namespace extensions | 182 } // namespace extensions |
OLD | NEW |