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

Side by Side Diff: chrome/common/extensions/chrome_extensions_client.cc

Issue 296133011: Move extension API schema registration to ExtensionsClient. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ifdefs =( Created 6 years, 7 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
« no previous file with comments | « chrome/common/extensions/chrome_extensions_client.h ('k') | extensions/DEPS » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/common/extensions/chrome_extensions_client.h" 5 #include "chrome/common/extensions/chrome_extensions_client.h"
6 6
7 #include "apps/common/api/generated_schemas.h" 7 #include "apps/common/api/generated_schemas.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "chrome/common/chrome_version_info.h" 9 #include "chrome/common/chrome_version_info.h"
10 #include "chrome/common/extensions/api/generated_schemas.h" 10 #include "chrome/common/extensions/api/generated_schemas.h"
11 #include "chrome/common/extensions/chrome_manifest_handlers.h" 11 #include "chrome/common/extensions/chrome_manifest_handlers.h"
12 #include "chrome/common/extensions/extension_constants.h" 12 #include "chrome/common/extensions/extension_constants.h"
13 #include "chrome/common/extensions/features/chrome_channel_feature_filter.h" 13 #include "chrome/common/extensions/features/chrome_channel_feature_filter.h"
14 #include "chrome/common/extensions/features/feature_channel.h" 14 #include "chrome/common/extensions/features/feature_channel.h"
15 #include "chrome/common/url_constants.h" 15 #include "chrome/common/url_constants.h"
16 #include "content/public/common/url_constants.h" 16 #include "content/public/common/url_constants.h"
17 #include "extensions/common/api/generated_schemas.h" 17 #include "extensions/common/api/generated_schemas.h"
18 #include "extensions/common/common_manifest_handlers.h" 18 #include "extensions/common/common_manifest_handlers.h"
19 #include "extensions/common/extension.h" 19 #include "extensions/common/extension.h"
20 #include "extensions/common/extension_api.h"
20 #include "extensions/common/features/api_feature.h" 21 #include "extensions/common/features/api_feature.h"
21 #include "extensions/common/features/base_feature_provider.h" 22 #include "extensions/common/features/base_feature_provider.h"
22 #include "extensions/common/features/feature_provider.h" 23 #include "extensions/common/features/feature_provider.h"
23 #include "extensions/common/features/json_feature_provider_source.h" 24 #include "extensions/common/features/json_feature_provider_source.h"
24 #include "extensions/common/features/manifest_feature.h" 25 #include "extensions/common/features/manifest_feature.h"
25 #include "extensions/common/features/permission_feature.h" 26 #include "extensions/common/features/permission_feature.h"
26 #include "extensions/common/features/simple_feature.h" 27 #include "extensions/common/features/simple_feature.h"
27 #include "extensions/common/manifest_constants.h" 28 #include "extensions/common/manifest_constants.h"
28 #include "extensions/common/manifest_handler.h" 29 #include "extensions/common/manifest_handler.h"
29 #include "extensions/common/permissions/api_permission_set.h" 30 #include "extensions/common/permissions/api_permission_set.h"
30 #include "extensions/common/permissions/permission_message.h" 31 #include "extensions/common/permissions/permission_message.h"
31 #include "extensions/common/permissions/permissions_info.h" 32 #include "extensions/common/permissions/permissions_info.h"
32 #include "extensions/common/switches.h" 33 #include "extensions/common/switches.h"
33 #include "extensions/common/url_pattern.h" 34 #include "extensions/common/url_pattern.h"
34 #include "extensions/common/url_pattern_set.h" 35 #include "extensions/common/url_pattern_set.h"
35 #include "grit/common_resources.h" 36 #include "grit/common_resources.h"
37 #if defined(ENABLE_EXTENSIONS)
38 #include "grit/extensions_api_resources.h"
39 #endif
36 #include "grit/extensions_resources.h" 40 #include "grit/extensions_resources.h"
37 #include "grit/generated_resources.h" 41 #include "grit/generated_resources.h"
38 #include "ui/base/l10n/l10n_util.h" 42 #include "ui/base/l10n/l10n_util.h"
39 #include "url/gurl.h" 43 #include "url/gurl.h"
40 44
41 namespace extensions { 45 namespace extensions {
42 46
43 namespace { 47 namespace {
44 48
45 const char kThumbsWhiteListedExtension[] = "khopmbdjffemhegeeobelklnbglcdgfh"; 49 const char kThumbsWhiteListedExtension[] = "khopmbdjffemhegeeobelklnbglcdgfh";
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 // Test from most common to least common. 228 // Test from most common to least common.
225 if (api::GeneratedSchemas::IsGenerated(name)) 229 if (api::GeneratedSchemas::IsGenerated(name))
226 return api::GeneratedSchemas::Get(name); 230 return api::GeneratedSchemas::Get(name);
227 231
228 if (core_api::GeneratedSchemas::IsGenerated(name)) 232 if (core_api::GeneratedSchemas::IsGenerated(name))
229 return core_api::GeneratedSchemas::Get(name); 233 return core_api::GeneratedSchemas::Get(name);
230 234
231 return apps::api::GeneratedSchemas::Get(name); 235 return apps::api::GeneratedSchemas::Get(name);
232 } 236 }
233 237
238 void ChromeExtensionsClient::RegisterAPISchemaResources(
239 ExtensionAPI* api) const {
240 #if defined(ENABLE_EXTENSIONS)
241 api->RegisterSchemaResource("accessibilityPrivate",
242 IDR_EXTENSION_API_JSON_ACCESSIBILITYPRIVATE);
243 api->RegisterSchemaResource("app", IDR_EXTENSION_API_JSON_APP);
244 api->RegisterSchemaResource("browserAction",
245 IDR_EXTENSION_API_JSON_BROWSERACTION);
246 api->RegisterSchemaResource("commands", IDR_EXTENSION_API_JSON_COMMANDS);
247 api->RegisterSchemaResource("declarativeContent",
248 IDR_EXTENSION_API_JSON_DECLARATIVE_CONTENT);
249 api->RegisterSchemaResource("declarativeWebRequest",
250 IDR_EXTENSION_API_JSON_DECLARATIVE_WEBREQUEST);
251 api->RegisterSchemaResource("fileBrowserHandler",
252 IDR_EXTENSION_API_JSON_FILEBROWSERHANDLER);
253 api->RegisterSchemaResource("inputMethodPrivate",
254 IDR_EXTENSION_API_JSON_INPUTMETHODPRIVATE);
255 api->RegisterSchemaResource("pageAction", IDR_EXTENSION_API_JSON_PAGEACTION);
256 api->RegisterSchemaResource("pageActions",
257 IDR_EXTENSION_API_JSON_PAGEACTIONS);
258 api->RegisterSchemaResource("privacy", IDR_EXTENSION_API_JSON_PRIVACY);
259 api->RegisterSchemaResource("processes", IDR_EXTENSION_API_JSON_PROCESSES);
260 api->RegisterSchemaResource("proxy", IDR_EXTENSION_API_JSON_PROXY);
261 api->RegisterSchemaResource("scriptBadge",
262 IDR_EXTENSION_API_JSON_SCRIPTBADGE);
263 api->RegisterSchemaResource("ttsEngine", IDR_EXTENSION_API_JSON_TTSENGINE);
264 api->RegisterSchemaResource("tts", IDR_EXTENSION_API_JSON_TTS);
265 api->RegisterSchemaResource("types", IDR_EXTENSION_API_JSON_TYPES);
266 api->RegisterSchemaResource("types.private",
267 IDR_EXTENSION_API_JSON_TYPES_PRIVATE);
268 api->RegisterSchemaResource("webstore", IDR_EXTENSION_API_JSON_WEBSTORE);
269 api->RegisterSchemaResource("webViewRequest",
270 IDR_EXTENSION_API_JSON_WEBVIEW_REQUEST);
271 #endif // defined(ENABLE_EXTENSIONS)
272 }
273
234 bool ChromeExtensionsClient::ShouldSuppressFatalErrors() const { 274 bool ChromeExtensionsClient::ShouldSuppressFatalErrors() const {
235 // <= dev means dev, canary, and trunk. 275 // <= dev means dev, canary, and trunk.
236 return GetCurrentChannel() <= chrome::VersionInfo::CHANNEL_DEV; 276 return GetCurrentChannel() <= chrome::VersionInfo::CHANNEL_DEV;
237 } 277 }
238 278
239 // static 279 // static
240 ChromeExtensionsClient* ChromeExtensionsClient::GetInstance() { 280 ChromeExtensionsClient* ChromeExtensionsClient::GetInstance() {
241 return g_client.Pointer(); 281 return g_client.Pointer();
242 } 282 }
243 283
244 } // namespace extensions 284 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/common/extensions/chrome_extensions_client.h ('k') | extensions/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698