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/api_definitions_natives.h" | 5 #include "chrome/renderer/extensions/api_definitions_natives.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "chrome/common/extensions/api/extension_api.h" | 9 #include "chrome/common/extensions/features/base_feature_provider.h" |
10 | 10 |
11 namespace { | 11 namespace { |
12 const char kInvalidExtensionNamespace[] = "Invalid extension namespace"; | 12 const char kInvalidExtensionNamespace[] = "Invalid extension namespace"; |
13 } | 13 } |
14 | 14 |
15 namespace extensions { | 15 namespace extensions { |
16 | 16 |
17 ApiDefinitionsNatives::ApiDefinitionsNatives(Dispatcher* dispatcher, | 17 ApiDefinitionsNatives::ApiDefinitionsNatives(Dispatcher* dispatcher, |
18 ChromeV8Context* context) | 18 ChromeV8Context* context) |
19 : ChromeV8Extension(dispatcher, context->v8_context()), | 19 : ChromeV8Extension(dispatcher, context->v8_context()), |
20 context_(context) { | 20 context_(context) { |
21 RouteFunction("GetExtensionAPIDefinitions", | 21 RouteFunction("GetExtensionAPIDefinitions", |
22 base::Bind(&ApiDefinitionsNatives::GetExtensionAPIDefinitions, | 22 base::Bind(&ApiDefinitionsNatives::GetExtensionAPIDefinitions, |
23 base::Unretained(this))); | 23 base::Unretained(this))); |
24 } | 24 } |
25 | 25 |
26 v8::Handle<v8::Value> ApiDefinitionsNatives::GetExtensionAPIDefinitions( | 26 v8::Handle<v8::Value> ApiDefinitionsNatives::GetExtensionAPIDefinitions( |
27 const v8::Arguments& args) { | 27 const v8::Arguments& args) { |
28 return dispatcher()->v8_schema_registry()->GetSchemas( | 28 std::vector<std::string> apis; |
29 ExtensionAPI::GetSharedInstance()->GetAllAPINames()); | 29 std::vector<std::string> feature_names = |
not at google - send to devlin
2013/05/24 19:09:18
also const&
cduvall
2013/05/30 00:50:51
Done.
| |
30 BaseFeatureProvider::GetByName("api")->GetAllFeatureNames(); | |
31 for (std::vector<std::string>::const_iterator i = feature_names.begin(); | |
32 i != feature_names.end(); ++i) { | |
33 if (!BaseFeatureProvider::GetByName("api")->GetFeature(*i)->HasParent()) | |
34 apis.push_back(*i); | |
35 } | |
36 return dispatcher()->v8_schema_registry()->GetSchemas(apis); | |
30 } | 37 } |
31 | 38 |
32 } // namespace extensions | 39 } // namespace extensions |
OLD | NEW |