Remove linux_chromium_gn_dbg from the chromium CQ.
[chromium-blink-merge.git] / extensions / renderer / api_definitions_natives.cc
blob61ea7109fc282b169c8b29a2b0099afcc23c0ad7
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
3 // found in the LICENSE file.
5 #include "extensions/renderer/api_definitions_natives.h"
7 #include "extensions/common/features/feature.h"
8 #include "extensions/common/features/feature_provider.h"
9 #include "extensions/renderer/dispatcher.h"
10 #include "extensions/renderer/script_context.h"
12 namespace extensions {
14 ApiDefinitionsNatives::ApiDefinitionsNatives(Dispatcher* dispatcher,
15 ScriptContext* context)
16 : ObjectBackedNativeHandler(context), dispatcher_(dispatcher) {
17 RouteFunction(
18 "GetExtensionAPIDefinitionsForTest",
19 base::Bind(&ApiDefinitionsNatives::GetExtensionAPIDefinitionsForTest,
20 base::Unretained(this)));
23 void ApiDefinitionsNatives::GetExtensionAPIDefinitionsForTest(
24 const v8::FunctionCallbackInfo<v8::Value>& args) {
25 std::vector<std::string> apis;
26 const FeatureProvider* feature_provider = FeatureProvider::GetAPIFeatures();
27 const std::vector<std::string>& feature_names =
28 feature_provider->GetAllFeatureNames();
29 for (std::vector<std::string>::const_iterator i = feature_names.begin();
30 i != feature_names.end();
31 ++i) {
32 if (!feature_provider->GetParent(feature_provider->GetFeature(*i)) &&
33 context()->GetAvailability(*i).is_available()) {
34 apis.push_back(*i);
37 args.GetReturnValue().Set(
38 dispatcher_->v8_schema_registry()->GetSchemas(apis));
41 } // namespace extensions