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

Side by Side Diff: chrome/renderer/extensions/api_definitions_natives.cc

Issue 235943018: Move extensions bindings code out of //chrome (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: nit Created 6 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 | Annotate | Revision Log
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/renderer/extensions/api_definitions_natives.h"
6
7 #include <algorithm>
8
9 #include "extensions/common/features/feature.h"
10 #include "extensions/common/features/feature_provider.h"
11
12 namespace extensions {
13
14 ApiDefinitionsNatives::ApiDefinitionsNatives(Dispatcher* dispatcher,
15 ChromeV8Context* context)
16 : ChromeV8Extension(dispatcher, context) {
17 RouteFunction("GetExtensionAPIDefinitionsForTest",
18 base::Bind(
19 &ApiDefinitionsNatives::GetExtensionAPIDefinitionsForTest,
20 base::Unretained(this)));
21 }
22
23 void ApiDefinitionsNatives::GetExtensionAPIDefinitionsForTest(
24 const v8::FunctionCallbackInfo<v8::Value>& args) {
25 std::vector<std::string> apis;
26 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(); ++i) {
31 if (!feature_provider->GetParent(feature_provider->GetFeature(*i)) &&
32 context()->GetAvailability(*i).is_available()) {
33 apis.push_back(*i);
34 }
35 }
36 args.GetReturnValue().Set(
37 dispatcher()->v8_schema_registry()->GetSchemas(apis));
38 }
39
40 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/renderer/extensions/api_definitions_natives.h ('k') | chrome/renderer/extensions/binding_generating_native_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698