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

Side by Side Diff: chrome/common/extensions/api/extension_api.cc

Issue 11747025: Run the JSON Schema Compiler's bundle compilation on JSON files. Previously it (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix ms release build Created 7 years, 11 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/common/extensions/api/extension_api.h" 5 #include "chrome/common/extensions/api/extension_api.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
337 void ExtensionAPI::InitDefaultConfiguration() { 337 void ExtensionAPI::InitDefaultConfiguration() {
338 RegisterDependencyProvider( 338 RegisterDependencyProvider(
339 "manifest", BaseFeatureProvider::GetManifestFeatures()); 339 "manifest", BaseFeatureProvider::GetManifestFeatures());
340 RegisterDependencyProvider( 340 RegisterDependencyProvider(
341 "permission", BaseFeatureProvider::GetPermissionFeatures()); 341 "permission", BaseFeatureProvider::GetPermissionFeatures());
342 342
343 // Schemas to be loaded from resources. 343 // Schemas to be loaded from resources.
344 CHECK(unloaded_schemas_.empty()); 344 CHECK(unloaded_schemas_.empty());
345 RegisterSchema("app", ReadFromResource( 345 RegisterSchema("app", ReadFromResource(
346 IDR_EXTENSION_API_JSON_APP)); 346 IDR_EXTENSION_API_JSON_APP));
347 RegisterSchema("bookmarks", ReadFromResource(
348 IDR_EXTENSION_API_JSON_BOOKMARKS));
349 RegisterSchema("bookmarkManagerPrivate", ReadFromResource( 347 RegisterSchema("bookmarkManagerPrivate", ReadFromResource(
350 IDR_EXTENSION_API_JSON_BOOKMARKMANAGERPRIVATE)); 348 IDR_EXTENSION_API_JSON_BOOKMARKMANAGERPRIVATE));
351 RegisterSchema("browserAction", ReadFromResource( 349 RegisterSchema("browserAction", ReadFromResource(
352 IDR_EXTENSION_API_JSON_BROWSERACTION)); 350 IDR_EXTENSION_API_JSON_BROWSERACTION));
353 RegisterSchema("browsingData", ReadFromResource( 351 RegisterSchema("browsingData", ReadFromResource(
354 IDR_EXTENSION_API_JSON_BROWSINGDATA)); 352 IDR_EXTENSION_API_JSON_BROWSINGDATA));
355 RegisterSchema("chromeosInfoPrivate", ReadFromResource( 353 RegisterSchema("chromeosInfoPrivate", ReadFromResource(
356 IDR_EXTENSION_API_JSON_CHROMEOSINFOPRIVATE)); 354 IDR_EXTENSION_API_JSON_CHROMEOSINFOPRIVATE));
357 RegisterSchema("cloudPrintPrivate", ReadFromResource(
358 IDR_EXTENSION_API_JSON_CLOUDPRINTPRIVATE));
359 RegisterSchema("commands", ReadFromResource( 355 RegisterSchema("commands", ReadFromResource(
360 IDR_EXTENSION_API_JSON_COMMANDS)); 356 IDR_EXTENSION_API_JSON_COMMANDS));
361 RegisterSchema("contentSettings", ReadFromResource(
362 IDR_EXTENSION_API_JSON_CONTENTSETTINGS));
363 RegisterSchema("contextMenus", ReadFromResource(
364 IDR_EXTENSION_API_JSON_CONTEXTMENUS));
365 RegisterSchema("cookies", ReadFromResource(
366 IDR_EXTENSION_API_JSON_COOKIES));
367 RegisterSchema("debugger", ReadFromResource(
368 IDR_EXTENSION_API_JSON_DEBUGGER));
369 RegisterSchema("declarativeWebRequest", ReadFromResource( 357 RegisterSchema("declarativeWebRequest", ReadFromResource(
370 IDR_EXTENSION_API_JSON_DECLARATIVE_WEBREQUEST)); 358 IDR_EXTENSION_API_JSON_DECLARATIVE_WEBREQUEST));
371 RegisterSchema("devtools", ReadFromResource( 359 RegisterSchema("devtools", ReadFromResource(
372 IDR_EXTENSION_API_JSON_DEVTOOLS)); 360 IDR_EXTENSION_API_JSON_DEVTOOLS));
373 RegisterSchema("events", ReadFromResource(
374 IDR_EXTENSION_API_JSON_EVENTS));
375 RegisterSchema("experimental.accessibility", ReadFromResource( 361 RegisterSchema("experimental.accessibility", ReadFromResource(
376 IDR_EXTENSION_API_JSON_EXPERIMENTAL_ACCESSIBILITY)); 362 IDR_EXTENSION_API_JSON_EXPERIMENTAL_ACCESSIBILITY));
377 RegisterSchema("experimental.app", ReadFromResource( 363 RegisterSchema("experimental.app", ReadFromResource(
378 IDR_EXTENSION_API_JSON_EXPERIMENTAL_APP)); 364 IDR_EXTENSION_API_JSON_EXPERIMENTAL_APP));
379 RegisterSchema("experimental.history", ReadFromResource(
380 IDR_EXTENSION_API_JSON_EXPERIMENTAL_HISTORY));
381 RegisterSchema("experimental.infobars", ReadFromResource( 365 RegisterSchema("experimental.infobars", ReadFromResource(
382 IDR_EXTENSION_API_JSON_EXPERIMENTAL_INFOBARS)); 366 IDR_EXTENSION_API_JSON_EXPERIMENTAL_INFOBARS));
383 RegisterSchema("experimental.input.virtualKeyboard", ReadFromResource( 367 RegisterSchema("experimental.input.virtualKeyboard", ReadFromResource(
384 IDR_EXTENSION_API_JSON_EXPERIMENTAL_INPUT_VIRTUALKEYBOARD)); 368 IDR_EXTENSION_API_JSON_EXPERIMENTAL_INPUT_VIRTUALKEYBOARD));
385 RegisterSchema("experimental.power", ReadFromResource( 369 RegisterSchema("experimental.power", ReadFromResource(
386 IDR_EXTENSION_API_JSON_EXPERIMENTAL_POWER)); 370 IDR_EXTENSION_API_JSON_EXPERIMENTAL_POWER));
387 RegisterSchema("experimental.processes", ReadFromResource( 371 RegisterSchema("experimental.processes", ReadFromResource(
388 IDR_EXTENSION_API_JSON_EXPERIMENTAL_PROCESSES)); 372 IDR_EXTENSION_API_JSON_EXPERIMENTAL_PROCESSES));
389 RegisterSchema("experimental.record", ReadFromResource(
390 IDR_EXTENSION_API_JSON_EXPERIMENTAL_RECORD));
391 RegisterSchema("experimental.rlz", ReadFromResource( 373 RegisterSchema("experimental.rlz", ReadFromResource(
392 IDR_EXTENSION_API_JSON_EXPERIMENTAL_RLZ)); 374 IDR_EXTENSION_API_JSON_EXPERIMENTAL_RLZ));
393 RegisterSchema("runtime", ReadFromResource( 375 RegisterSchema("runtime", ReadFromResource(
394 IDR_EXTENSION_API_JSON_RUNTIME)); 376 IDR_EXTENSION_API_JSON_RUNTIME));
395 RegisterSchema("experimental.speechInput", ReadFromResource( 377 RegisterSchema("experimental.speechInput", ReadFromResource(
396 IDR_EXTENSION_API_JSON_EXPERIMENTAL_SPEECHINPUT)); 378 IDR_EXTENSION_API_JSON_EXPERIMENTAL_SPEECHINPUT));
397 RegisterSchema("extension", ReadFromResource( 379 RegisterSchema("extension", ReadFromResource(
398 IDR_EXTENSION_API_JSON_EXTENSION)); 380 IDR_EXTENSION_API_JSON_EXTENSION));
399 RegisterSchema("fileBrowserHandler", ReadFromResource( 381 RegisterSchema("fileBrowserHandler", ReadFromResource(
400 IDR_EXTENSION_API_JSON_FILEBROWSERHANDLER)); 382 IDR_EXTENSION_API_JSON_FILEBROWSERHANDLER));
401 RegisterSchema("fileBrowserHandlerInternal", ReadFromResource(
402 IDR_EXTENSION_API_JSON_FILEBROWSERHANDLERINTERNAL));
403 RegisterSchema("fileBrowserPrivate", ReadFromResource( 383 RegisterSchema("fileBrowserPrivate", ReadFromResource(
404 IDR_EXTENSION_API_JSON_FILEBROWSERPRIVATE)); 384 IDR_EXTENSION_API_JSON_FILEBROWSERPRIVATE));
405 RegisterSchema("fontSettings", ReadFromResource(
406 IDR_EXTENSION_API_JSON_FONTSSETTINGS));
407 RegisterSchema("history", ReadFromResource(
408 IDR_EXTENSION_API_JSON_HISTORY));
409 RegisterSchema("i18n", ReadFromResource(
410 IDR_EXTENSION_API_JSON_I18N));
411 RegisterSchema("idle", ReadFromResource( 385 RegisterSchema("idle", ReadFromResource(
412 IDR_EXTENSION_API_JSON_IDLE)); 386 IDR_EXTENSION_API_JSON_IDLE));
413 RegisterSchema("input.ime", ReadFromResource( 387 RegisterSchema("input.ime", ReadFromResource(
414 IDR_EXTENSION_API_JSON_INPUT_IME)); 388 IDR_EXTENSION_API_JSON_INPUT_IME));
415 RegisterSchema("inputMethodPrivate", ReadFromResource( 389 RegisterSchema("inputMethodPrivate", ReadFromResource(
416 IDR_EXTENSION_API_JSON_INPUTMETHODPRIVATE)); 390 IDR_EXTENSION_API_JSON_INPUTMETHODPRIVATE));
417 RegisterSchema("managedModePrivate", ReadFromResource( 391 RegisterSchema("managedModePrivate", ReadFromResource(
418 IDR_EXTENSION_API_JSON_MANAGEDMODEPRIVATE)); 392 IDR_EXTENSION_API_JSON_MANAGEDMODEPRIVATE));
419 RegisterSchema("management", ReadFromResource(
420 IDR_EXTENSION_API_JSON_MANAGEMENT));
421 RegisterSchema("mediaPlayerPrivate", ReadFromResource( 393 RegisterSchema("mediaPlayerPrivate", ReadFromResource(
422 IDR_EXTENSION_API_JSON_MEDIAPLAYERPRIVATE)); 394 IDR_EXTENSION_API_JSON_MEDIAPLAYERPRIVATE));
423 RegisterSchema("metricsPrivate", ReadFromResource( 395 RegisterSchema("metricsPrivate", ReadFromResource(
424 IDR_EXTENSION_API_JSON_METRICSPRIVATE)); 396 IDR_EXTENSION_API_JSON_METRICSPRIVATE));
425 RegisterSchema("echoPrivate", ReadFromResource( 397 RegisterSchema("echoPrivate", ReadFromResource(
426 IDR_EXTENSION_API_JSON_ECHOPRIVATE)); 398 IDR_EXTENSION_API_JSON_ECHOPRIVATE));
427 RegisterSchema("omnibox", ReadFromResource( 399 RegisterSchema("omnibox", ReadFromResource(
428 IDR_EXTENSION_API_JSON_OMNIBOX)); 400 IDR_EXTENSION_API_JSON_OMNIBOX));
429 RegisterSchema("pageAction", ReadFromResource( 401 RegisterSchema("pageAction", ReadFromResource(
430 IDR_EXTENSION_API_JSON_PAGEACTION)); 402 IDR_EXTENSION_API_JSON_PAGEACTION));
431 RegisterSchema("pageActions", ReadFromResource( 403 RegisterSchema("pageActions", ReadFromResource(
432 IDR_EXTENSION_API_JSON_PAGEACTIONS)); 404 IDR_EXTENSION_API_JSON_PAGEACTIONS));
433 RegisterSchema("pageCapture", ReadFromResource(
434 IDR_EXTENSION_API_JSON_PAGECAPTURE));
435 RegisterSchema("permissions", ReadFromResource( 405 RegisterSchema("permissions", ReadFromResource(
436 IDR_EXTENSION_API_JSON_PERMISSIONS)); 406 IDR_EXTENSION_API_JSON_PERMISSIONS));
437 RegisterSchema("privacy", ReadFromResource( 407 RegisterSchema("privacy", ReadFromResource(
438 IDR_EXTENSION_API_JSON_PRIVACY)); 408 IDR_EXTENSION_API_JSON_PRIVACY));
439 RegisterSchema("proxy", ReadFromResource( 409 RegisterSchema("proxy", ReadFromResource(
440 IDR_EXTENSION_API_JSON_PROXY)); 410 IDR_EXTENSION_API_JSON_PROXY));
441 RegisterSchema("scriptBadge", ReadFromResource( 411 RegisterSchema("scriptBadge", ReadFromResource(
442 IDR_EXTENSION_API_JSON_SCRIPTBADGE)); 412 IDR_EXTENSION_API_JSON_SCRIPTBADGE));
443 RegisterSchema("storage", ReadFromResource(
444 IDR_EXTENSION_API_JSON_STORAGE));
445 RegisterSchema("systemPrivate", ReadFromResource( 413 RegisterSchema("systemPrivate", ReadFromResource(
446 IDR_EXTENSION_API_JSON_SYSTEMPRIVATE)); 414 IDR_EXTENSION_API_JSON_SYSTEMPRIVATE));
447 RegisterSchema("tabs", ReadFromResource(
448 IDR_EXTENSION_API_JSON_TABS));
449 RegisterSchema("terminalPrivate", ReadFromResource( 415 RegisterSchema("terminalPrivate", ReadFromResource(
450 IDR_EXTENSION_API_JSON_TERMINALPRIVATE)); 416 IDR_EXTENSION_API_JSON_TERMINALPRIVATE));
451 RegisterSchema("test", ReadFromResource( 417 RegisterSchema("test", ReadFromResource(
452 IDR_EXTENSION_API_JSON_TEST)); 418 IDR_EXTENSION_API_JSON_TEST));
453 RegisterSchema("topSites", ReadFromResource( 419 RegisterSchema("topSites", ReadFromResource(
454 IDR_EXTENSION_API_JSON_TOPSITES)); 420 IDR_EXTENSION_API_JSON_TOPSITES));
455 RegisterSchema("ttsEngine", ReadFromResource( 421 RegisterSchema("ttsEngine", ReadFromResource(
456 IDR_EXTENSION_API_JSON_TTSENGINE)); 422 IDR_EXTENSION_API_JSON_TTSENGINE));
457 RegisterSchema("tts", ReadFromResource( 423 RegisterSchema("tts", ReadFromResource(
458 IDR_EXTENSION_API_JSON_TTS)); 424 IDR_EXTENSION_API_JSON_TTS));
459 RegisterSchema("types", ReadFromResource( 425 RegisterSchema("types", ReadFromResource(
460 IDR_EXTENSION_API_JSON_TYPES)); 426 IDR_EXTENSION_API_JSON_TYPES));
461 RegisterSchema("wallpaperPrivate", ReadFromResource( 427 RegisterSchema("wallpaperPrivate", ReadFromResource(
462 IDR_EXTENSION_API_JSON_WALLPAPERPRIVATE)); 428 IDR_EXTENSION_API_JSON_WALLPAPERPRIVATE));
463 RegisterSchema("webNavigation", ReadFromResource(
464 IDR_EXTENSION_API_JSON_WEBNAVIGATION));
465 RegisterSchema("webRequest", ReadFromResource(
466 IDR_EXTENSION_API_JSON_WEBREQUEST));
467 RegisterSchema("webRequestInternal", ReadFromResource( 429 RegisterSchema("webRequestInternal", ReadFromResource(
468 IDR_EXTENSION_API_JSON_WEBREQUESTINTERNAL)); 430 IDR_EXTENSION_API_JSON_WEBREQUESTINTERNAL));
469 RegisterSchema("webSocketProxyPrivate", ReadFromResource( 431 RegisterSchema("webSocketProxyPrivate", ReadFromResource(
470 IDR_EXTENSION_API_JSON_WEBSOCKETPROXYPRIVATE)); 432 IDR_EXTENSION_API_JSON_WEBSOCKETPROXYPRIVATE));
471 RegisterSchema("webstore", ReadFromResource( 433 RegisterSchema("webstore", ReadFromResource(
472 IDR_EXTENSION_API_JSON_WEBSTORE)); 434 IDR_EXTENSION_API_JSON_WEBSTORE));
473 RegisterSchema("webstorePrivate", ReadFromResource( 435 RegisterSchema("webstorePrivate", ReadFromResource(
474 IDR_EXTENSION_API_JSON_WEBSTOREPRIVATE)); 436 IDR_EXTENSION_API_JSON_WEBSTOREPRIVATE));
475 RegisterSchema("windows", ReadFromResource(
476 IDR_EXTENSION_API_JSON_WINDOWS));
477 437
478 // Schemas to be loaded via JSON generated from IDL files. 438 // Schemas to be loaded via JSON generated from IDL files.
479 GeneratedSchemas::Get(&unloaded_schemas_); 439 GeneratedSchemas::Get(&unloaded_schemas_);
480 } 440 }
481 441
482 void ExtensionAPI::RegisterSchema(const std::string& name, 442 void ExtensionAPI::RegisterSchema(const std::string& name,
483 const base::StringPiece& source) { 443 const base::StringPiece& source) {
484 unloaded_schemas_[name] = source; 444 unloaded_schemas_[name] = source;
485 } 445 }
486 446
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
857 817
858 void ExtensionAPI::LoadAllSchemas() { 818 void ExtensionAPI::LoadAllSchemas() {
859 while (unloaded_schemas_.size()) { 819 while (unloaded_schemas_.size()) {
860 std::map<std::string, base::StringPiece>::iterator it = 820 std::map<std::string, base::StringPiece>::iterator it =
861 unloaded_schemas_.begin(); 821 unloaded_schemas_.begin();
862 LoadSchema(it->first, it->second); 822 LoadSchema(it->first, it->second);
863 } 823 }
864 } 824 }
865 825
866 } // namespace extensions 826 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/common/extensions/api/events.json ('k') | chrome/common/extensions/api/file_browser_handler_internal.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698