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

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

Issue 15091002: Lazily load API schemas from resource files and convert all APIs to features (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more comments and fixed tests Created 7 years, 6 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
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 const std::vector<std::string>& feature_names =
not at google - send to devlin 2013/05/30 16:38:52 bleh. this function is going to get messy - and I
cduvall 2013/06/12 01:22:19 I renamed to GetExtensionAPIDefinitionsForTest. I
not at google - send to devlin 2013/06/12 22:34:18 Thanks. Yeah I got the webview people to fix that
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698