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/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 Loading... |
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)); |
347 RegisterSchema("bookmarkManagerPrivate", ReadFromResource( | 349 RegisterSchema("bookmarkManagerPrivate", ReadFromResource( |
348 IDR_EXTENSION_API_JSON_BOOKMARKMANAGERPRIVATE)); | 350 IDR_EXTENSION_API_JSON_BOOKMARKMANAGERPRIVATE)); |
349 RegisterSchema("browserAction", ReadFromResource( | 351 RegisterSchema("browserAction", ReadFromResource( |
350 IDR_EXTENSION_API_JSON_BROWSERACTION)); | 352 IDR_EXTENSION_API_JSON_BROWSERACTION)); |
351 RegisterSchema("browsingData", ReadFromResource( | 353 RegisterSchema("browsingData", ReadFromResource( |
352 IDR_EXTENSION_API_JSON_BROWSINGDATA)); | 354 IDR_EXTENSION_API_JSON_BROWSINGDATA)); |
353 RegisterSchema("chromeosInfoPrivate", ReadFromResource( | 355 RegisterSchema("chromeosInfoPrivate", ReadFromResource( |
354 IDR_EXTENSION_API_JSON_CHROMEOSINFOPRIVATE)); | 356 IDR_EXTENSION_API_JSON_CHROMEOSINFOPRIVATE)); |
| 357 RegisterSchema("cloudPrintPrivate", ReadFromResource( |
| 358 IDR_EXTENSION_API_JSON_CLOUDPRINTPRIVATE)); |
355 RegisterSchema("commands", ReadFromResource( | 359 RegisterSchema("commands", ReadFromResource( |
356 IDR_EXTENSION_API_JSON_COMMANDS)); | 360 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)); |
357 RegisterSchema("declarativeWebRequest", ReadFromResource( | 369 RegisterSchema("declarativeWebRequest", ReadFromResource( |
358 IDR_EXTENSION_API_JSON_DECLARATIVE_WEBREQUEST)); | 370 IDR_EXTENSION_API_JSON_DECLARATIVE_WEBREQUEST)); |
359 RegisterSchema("devtools", ReadFromResource( | 371 RegisterSchema("devtools", ReadFromResource( |
360 IDR_EXTENSION_API_JSON_DEVTOOLS)); | 372 IDR_EXTENSION_API_JSON_DEVTOOLS)); |
| 373 RegisterSchema("events", ReadFromResource( |
| 374 IDR_EXTENSION_API_JSON_EVENTS)); |
361 RegisterSchema("experimental.accessibility", ReadFromResource( | 375 RegisterSchema("experimental.accessibility", ReadFromResource( |
362 IDR_EXTENSION_API_JSON_EXPERIMENTAL_ACCESSIBILITY)); | 376 IDR_EXTENSION_API_JSON_EXPERIMENTAL_ACCESSIBILITY)); |
363 RegisterSchema("experimental.app", ReadFromResource( | 377 RegisterSchema("experimental.app", ReadFromResource( |
364 IDR_EXTENSION_API_JSON_EXPERIMENTAL_APP)); | 378 IDR_EXTENSION_API_JSON_EXPERIMENTAL_APP)); |
| 379 RegisterSchema("experimental.history", ReadFromResource( |
| 380 IDR_EXTENSION_API_JSON_EXPERIMENTAL_HISTORY)); |
365 RegisterSchema("experimental.infobars", ReadFromResource( | 381 RegisterSchema("experimental.infobars", ReadFromResource( |
366 IDR_EXTENSION_API_JSON_EXPERIMENTAL_INFOBARS)); | 382 IDR_EXTENSION_API_JSON_EXPERIMENTAL_INFOBARS)); |
367 RegisterSchema("experimental.input.virtualKeyboard", ReadFromResource( | 383 RegisterSchema("experimental.input.virtualKeyboard", ReadFromResource( |
368 IDR_EXTENSION_API_JSON_EXPERIMENTAL_INPUT_VIRTUALKEYBOARD)); | 384 IDR_EXTENSION_API_JSON_EXPERIMENTAL_INPUT_VIRTUALKEYBOARD)); |
369 RegisterSchema("experimental.power", ReadFromResource( | 385 RegisterSchema("experimental.power", ReadFromResource( |
370 IDR_EXTENSION_API_JSON_EXPERIMENTAL_POWER)); | 386 IDR_EXTENSION_API_JSON_EXPERIMENTAL_POWER)); |
371 RegisterSchema("experimental.processes", ReadFromResource( | 387 RegisterSchema("experimental.processes", ReadFromResource( |
372 IDR_EXTENSION_API_JSON_EXPERIMENTAL_PROCESSES)); | 388 IDR_EXTENSION_API_JSON_EXPERIMENTAL_PROCESSES)); |
| 389 RegisterSchema("experimental.record", ReadFromResource( |
| 390 IDR_EXTENSION_API_JSON_EXPERIMENTAL_RECORD)); |
373 RegisterSchema("experimental.rlz", ReadFromResource( | 391 RegisterSchema("experimental.rlz", ReadFromResource( |
374 IDR_EXTENSION_API_JSON_EXPERIMENTAL_RLZ)); | 392 IDR_EXTENSION_API_JSON_EXPERIMENTAL_RLZ)); |
375 RegisterSchema("runtime", ReadFromResource( | 393 RegisterSchema("runtime", ReadFromResource( |
376 IDR_EXTENSION_API_JSON_RUNTIME)); | 394 IDR_EXTENSION_API_JSON_RUNTIME)); |
377 RegisterSchema("experimental.speechInput", ReadFromResource( | 395 RegisterSchema("experimental.speechInput", ReadFromResource( |
378 IDR_EXTENSION_API_JSON_EXPERIMENTAL_SPEECHINPUT)); | 396 IDR_EXTENSION_API_JSON_EXPERIMENTAL_SPEECHINPUT)); |
379 RegisterSchema("extension", ReadFromResource( | 397 RegisterSchema("extension", ReadFromResource( |
380 IDR_EXTENSION_API_JSON_EXTENSION)); | 398 IDR_EXTENSION_API_JSON_EXTENSION)); |
381 RegisterSchema("fileBrowserHandler", ReadFromResource( | 399 RegisterSchema("fileBrowserHandler", ReadFromResource( |
382 IDR_EXTENSION_API_JSON_FILEBROWSERHANDLER)); | 400 IDR_EXTENSION_API_JSON_FILEBROWSERHANDLER)); |
| 401 RegisterSchema("fileBrowserHandlerInternal", ReadFromResource( |
| 402 IDR_EXTENSION_API_JSON_FILEBROWSERHANDLERINTERNAL)); |
383 RegisterSchema("fileBrowserPrivate", ReadFromResource( | 403 RegisterSchema("fileBrowserPrivate", ReadFromResource( |
384 IDR_EXTENSION_API_JSON_FILEBROWSERPRIVATE)); | 404 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)); |
385 RegisterSchema("idle", ReadFromResource( | 411 RegisterSchema("idle", ReadFromResource( |
386 IDR_EXTENSION_API_JSON_IDLE)); | 412 IDR_EXTENSION_API_JSON_IDLE)); |
387 RegisterSchema("input.ime", ReadFromResource( | 413 RegisterSchema("input.ime", ReadFromResource( |
388 IDR_EXTENSION_API_JSON_INPUT_IME)); | 414 IDR_EXTENSION_API_JSON_INPUT_IME)); |
389 RegisterSchema("inputMethodPrivate", ReadFromResource( | 415 RegisterSchema("inputMethodPrivate", ReadFromResource( |
390 IDR_EXTENSION_API_JSON_INPUTMETHODPRIVATE)); | 416 IDR_EXTENSION_API_JSON_INPUTMETHODPRIVATE)); |
391 RegisterSchema("managedModePrivate", ReadFromResource( | 417 RegisterSchema("managedModePrivate", ReadFromResource( |
392 IDR_EXTENSION_API_JSON_MANAGEDMODEPRIVATE)); | 418 IDR_EXTENSION_API_JSON_MANAGEDMODEPRIVATE)); |
| 419 RegisterSchema("management", ReadFromResource( |
| 420 IDR_EXTENSION_API_JSON_MANAGEMENT)); |
393 RegisterSchema("mediaPlayerPrivate", ReadFromResource( | 421 RegisterSchema("mediaPlayerPrivate", ReadFromResource( |
394 IDR_EXTENSION_API_JSON_MEDIAPLAYERPRIVATE)); | 422 IDR_EXTENSION_API_JSON_MEDIAPLAYERPRIVATE)); |
395 RegisterSchema("metricsPrivate", ReadFromResource( | 423 RegisterSchema("metricsPrivate", ReadFromResource( |
396 IDR_EXTENSION_API_JSON_METRICSPRIVATE)); | 424 IDR_EXTENSION_API_JSON_METRICSPRIVATE)); |
397 RegisterSchema("echoPrivate", ReadFromResource( | 425 RegisterSchema("echoPrivate", ReadFromResource( |
398 IDR_EXTENSION_API_JSON_ECHOPRIVATE)); | 426 IDR_EXTENSION_API_JSON_ECHOPRIVATE)); |
399 RegisterSchema("omnibox", ReadFromResource( | 427 RegisterSchema("omnibox", ReadFromResource( |
400 IDR_EXTENSION_API_JSON_OMNIBOX)); | 428 IDR_EXTENSION_API_JSON_OMNIBOX)); |
401 RegisterSchema("pageAction", ReadFromResource( | 429 RegisterSchema("pageAction", ReadFromResource( |
402 IDR_EXTENSION_API_JSON_PAGEACTION)); | 430 IDR_EXTENSION_API_JSON_PAGEACTION)); |
403 RegisterSchema("pageActions", ReadFromResource( | 431 RegisterSchema("pageActions", ReadFromResource( |
404 IDR_EXTENSION_API_JSON_PAGEACTIONS)); | 432 IDR_EXTENSION_API_JSON_PAGEACTIONS)); |
| 433 RegisterSchema("pageCapture", ReadFromResource( |
| 434 IDR_EXTENSION_API_JSON_PAGECAPTURE)); |
405 RegisterSchema("permissions", ReadFromResource( | 435 RegisterSchema("permissions", ReadFromResource( |
406 IDR_EXTENSION_API_JSON_PERMISSIONS)); | 436 IDR_EXTENSION_API_JSON_PERMISSIONS)); |
407 RegisterSchema("privacy", ReadFromResource( | 437 RegisterSchema("privacy", ReadFromResource( |
408 IDR_EXTENSION_API_JSON_PRIVACY)); | 438 IDR_EXTENSION_API_JSON_PRIVACY)); |
409 RegisterSchema("proxy", ReadFromResource( | 439 RegisterSchema("proxy", ReadFromResource( |
410 IDR_EXTENSION_API_JSON_PROXY)); | 440 IDR_EXTENSION_API_JSON_PROXY)); |
411 RegisterSchema("scriptBadge", ReadFromResource( | 441 RegisterSchema("scriptBadge", ReadFromResource( |
412 IDR_EXTENSION_API_JSON_SCRIPTBADGE)); | 442 IDR_EXTENSION_API_JSON_SCRIPTBADGE)); |
| 443 RegisterSchema("storage", ReadFromResource( |
| 444 IDR_EXTENSION_API_JSON_STORAGE)); |
413 RegisterSchema("systemPrivate", ReadFromResource( | 445 RegisterSchema("systemPrivate", ReadFromResource( |
414 IDR_EXTENSION_API_JSON_SYSTEMPRIVATE)); | 446 IDR_EXTENSION_API_JSON_SYSTEMPRIVATE)); |
| 447 RegisterSchema("tabs", ReadFromResource( |
| 448 IDR_EXTENSION_API_JSON_TABS)); |
415 RegisterSchema("terminalPrivate", ReadFromResource( | 449 RegisterSchema("terminalPrivate", ReadFromResource( |
416 IDR_EXTENSION_API_JSON_TERMINALPRIVATE)); | 450 IDR_EXTENSION_API_JSON_TERMINALPRIVATE)); |
417 RegisterSchema("test", ReadFromResource( | 451 RegisterSchema("test", ReadFromResource( |
418 IDR_EXTENSION_API_JSON_TEST)); | 452 IDR_EXTENSION_API_JSON_TEST)); |
419 RegisterSchema("topSites", ReadFromResource( | 453 RegisterSchema("topSites", ReadFromResource( |
420 IDR_EXTENSION_API_JSON_TOPSITES)); | 454 IDR_EXTENSION_API_JSON_TOPSITES)); |
421 RegisterSchema("ttsEngine", ReadFromResource( | 455 RegisterSchema("ttsEngine", ReadFromResource( |
422 IDR_EXTENSION_API_JSON_TTSENGINE)); | 456 IDR_EXTENSION_API_JSON_TTSENGINE)); |
423 RegisterSchema("tts", ReadFromResource( | 457 RegisterSchema("tts", ReadFromResource( |
424 IDR_EXTENSION_API_JSON_TTS)); | 458 IDR_EXTENSION_API_JSON_TTS)); |
425 RegisterSchema("types", ReadFromResource( | 459 RegisterSchema("types", ReadFromResource( |
426 IDR_EXTENSION_API_JSON_TYPES)); | 460 IDR_EXTENSION_API_JSON_TYPES)); |
427 RegisterSchema("wallpaperPrivate", ReadFromResource( | 461 RegisterSchema("wallpaperPrivate", ReadFromResource( |
428 IDR_EXTENSION_API_JSON_WALLPAPERPRIVATE)); | 462 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)); |
429 RegisterSchema("webRequestInternal", ReadFromResource( | 467 RegisterSchema("webRequestInternal", ReadFromResource( |
430 IDR_EXTENSION_API_JSON_WEBREQUESTINTERNAL)); | 468 IDR_EXTENSION_API_JSON_WEBREQUESTINTERNAL)); |
431 RegisterSchema("webSocketProxyPrivate", ReadFromResource( | 469 RegisterSchema("webSocketProxyPrivate", ReadFromResource( |
432 IDR_EXTENSION_API_JSON_WEBSOCKETPROXYPRIVATE)); | 470 IDR_EXTENSION_API_JSON_WEBSOCKETPROXYPRIVATE)); |
433 RegisterSchema("webstore", ReadFromResource( | 471 RegisterSchema("webstore", ReadFromResource( |
434 IDR_EXTENSION_API_JSON_WEBSTORE)); | 472 IDR_EXTENSION_API_JSON_WEBSTORE)); |
435 RegisterSchema("webstorePrivate", ReadFromResource( | 473 RegisterSchema("webstorePrivate", ReadFromResource( |
436 IDR_EXTENSION_API_JSON_WEBSTOREPRIVATE)); | 474 IDR_EXTENSION_API_JSON_WEBSTOREPRIVATE)); |
| 475 RegisterSchema("windows", ReadFromResource( |
| 476 IDR_EXTENSION_API_JSON_WINDOWS)); |
437 | 477 |
438 // Schemas to be loaded via JSON generated from IDL files. | 478 // Schemas to be loaded via JSON generated from IDL files. |
439 GeneratedSchemas::Get(&unloaded_schemas_); | 479 GeneratedSchemas::Get(&unloaded_schemas_); |
440 } | 480 } |
441 | 481 |
442 void ExtensionAPI::RegisterSchema(const std::string& name, | 482 void ExtensionAPI::RegisterSchema(const std::string& name, |
443 const base::StringPiece& source) { | 483 const base::StringPiece& source) { |
444 unloaded_schemas_[name] = source; | 484 unloaded_schemas_[name] = source; |
445 } | 485 } |
446 | 486 |
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
817 | 857 |
818 void ExtensionAPI::LoadAllSchemas() { | 858 void ExtensionAPI::LoadAllSchemas() { |
819 while (unloaded_schemas_.size()) { | 859 while (unloaded_schemas_.size()) { |
820 std::map<std::string, base::StringPiece>::iterator it = | 860 std::map<std::string, base::StringPiece>::iterator it = |
821 unloaded_schemas_.begin(); | 861 unloaded_schemas_.begin(); |
822 LoadSchema(it->first, it->second); | 862 LoadSchema(it->first, it->second); |
823 } | 863 } |
824 } | 864 } |
825 | 865 |
826 } // namespace extensions | 866 } // namespace extensions |
OLD | NEW |