Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Side by Side Diff: extensions/renderer/test_features_native_handler.cc

Issue 1866103002: [Extensions] Expand bindings access checks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Latest master Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/test_features_native_handler.h" 5 #include "extensions/renderer/test_features_native_handler.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "content/public/child/v8_value_converter.h" 8 #include "content/public/child/v8_value_converter.h"
9 #include "extensions/common/extensions_client.h" 9 #include "extensions/common/extensions_client.h"
10 #include "extensions/common/features/json_feature_provider_source.h" 10 #include "extensions/common/features/json_feature_provider_source.h"
11 #include "extensions/renderer/script_context.h" 11 #include "extensions/renderer/script_context.h"
12 12
13 namespace extensions { 13 namespace extensions {
14 14
15 TestFeaturesNativeHandler::TestFeaturesNativeHandler(ScriptContext* context) 15 TestFeaturesNativeHandler::TestFeaturesNativeHandler(ScriptContext* context)
16 : ObjectBackedNativeHandler(context) { 16 : ObjectBackedNativeHandler(context) {
17 RouteFunction("GetAPIFeatures", 17 RouteFunction("GetAPIFeatures", "test",
18 base::Bind(&TestFeaturesNativeHandler::GetAPIFeatures, 18 base::Bind(&TestFeaturesNativeHandler::GetAPIFeatures,
19 base::Unretained(this))); 19 base::Unretained(this)));
20 } 20 }
21 21
22 void TestFeaturesNativeHandler::GetAPIFeatures( 22 void TestFeaturesNativeHandler::GetAPIFeatures(
23 const v8::FunctionCallbackInfo<v8::Value>& args) { 23 const v8::FunctionCallbackInfo<v8::Value>& args) {
24 scoped_ptr<JSONFeatureProviderSource> source( 24 scoped_ptr<JSONFeatureProviderSource> source(
25 ExtensionsClient::Get()->CreateFeatureProviderSource("api")); 25 ExtensionsClient::Get()->CreateFeatureProviderSource("api"));
26 scoped_ptr<content::V8ValueConverter> converter( 26 scoped_ptr<content::V8ValueConverter> converter(
27 content::V8ValueConverter::create()); 27 content::V8ValueConverter::create());
28 args.GetReturnValue().Set( 28 args.GetReturnValue().Set(
29 converter->ToV8Value(&source->dictionary(), context()->v8_context())); 29 converter->ToV8Value(&source->dictionary(), context()->v8_context()));
30 } 30 }
31 31
32 } // namespace extensions 32 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/renderer/runtime_custom_bindings.cc ('k') | extensions/renderer/test_native_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698