OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 bool being_upgraded; | 466 bool being_upgraded; |
467 | 467 |
468 // Generic bag of runtime data that users can associate with extensions. | 468 // Generic bag of runtime data that users can associate with extensions. |
469 PropertyBag property_bag; | 469 PropertyBag property_bag; |
470 | 470 |
471 ExtensionRuntimeData(); | 471 ExtensionRuntimeData(); |
472 ~ExtensionRuntimeData(); | 472 ~ExtensionRuntimeData(); |
473 }; | 473 }; |
474 typedef std::map<std::string, ExtensionRuntimeData> ExtensionRuntimeDataMap; | 474 typedef std::map<std::string, ExtensionRuntimeData> ExtensionRuntimeDataMap; |
475 | 475 |
| 476 struct NaClModuleInfo { |
| 477 NaClModuleInfo(); |
| 478 ~NaClModuleInfo(); |
| 479 |
| 480 GURL url; |
| 481 std::string mime_type; |
| 482 }; |
| 483 typedef std::list<NaClModuleInfo> NaClModuleInfoList; |
| 484 |
476 virtual ~ExtensionService(); | 485 virtual ~ExtensionService(); |
477 | 486 |
478 // Clear all persistent data that may have been stored by the extension. | 487 // Clear all persistent data that may have been stored by the extension. |
479 void ClearExtensionData(const GURL& extension_url); | 488 void ClearExtensionData(const GURL& extension_url); |
480 | 489 |
481 // Look up an extension by ID, optionally including either or both of enabled | 490 // Look up an extension by ID, optionally including either or both of enabled |
482 // and disabled extensions. | 491 // and disabled extensions. |
483 const Extension* GetExtensionByIdInternal(const std::string& id, | 492 const Extension* GetExtensionByIdInternal(const std::string& id, |
484 bool include_enabled, | 493 bool include_enabled, |
485 bool include_disabled) const; | 494 bool include_disabled) const; |
486 | 495 |
487 | 496 |
488 // Keep track of terminated extensions. | 497 // Keep track of terminated extensions. |
489 void TrackTerminatedExtension(const Extension* extension); | 498 void TrackTerminatedExtension(const Extension* extension); |
490 void UntrackTerminatedExtension(const std::string& id); | 499 void UntrackTerminatedExtension(const std::string& id); |
491 | 500 |
492 // Handles sending notification that |extension| was loaded. | 501 // Handles sending notification that |extension| was loaded. |
493 void NotifyExtensionLoaded(const Extension* extension); | 502 void NotifyExtensionLoaded(const Extension* extension); |
494 | 503 |
495 // Handles sending notification that |extension| was unloaded. | 504 // Handles sending notification that |extension| was unloaded. |
496 void NotifyExtensionUnloaded(const Extension* extension, | 505 void NotifyExtensionUnloaded(const Extension* extension, |
497 UnloadedExtensionInfo::Reason reason); | 506 UnloadedExtensionInfo::Reason reason); |
498 | 507 |
499 // Helper that updates the active extension list used for crash reporting. | 508 // Helper that updates the active extension list used for crash reporting. |
500 void UpdateActiveExtensionsInCrashReporter(); | 509 void UpdateActiveExtensionsInCrashReporter(); |
501 | 510 |
502 // Helper method. Loads extension from prefs. | 511 // Helper method. Loads extension from prefs. |
503 void LoadInstalledExtension(const ExtensionInfo& info, bool write_to_prefs); | 512 void LoadInstalledExtension(const ExtensionInfo& info, bool write_to_prefs); |
504 | 513 |
| 514 // We implement some Pepper plug-ins using NaCl to take advantage of NaCl's |
| 515 // strong sandbox. Typically, these NaCl modules are stored in extensions |
| 516 // and registered here. Not all NaCl modules need to register for a MIME |
| 517 // type, just the ones that are responsible for rendering a particular MIME |
| 518 // type, like application/pdf. Note: We only register NaCl modules in the |
| 519 // browser process. |
| 520 void RegisterNaClModule(const GURL& url, const std::string& mime_type); |
| 521 void UnregisterNaClModule(const GURL& url); |
| 522 |
| 523 // Call UpdatePluginListWithNaClModules() after registering or unregistering |
| 524 // a NaCl module to see those changes reflected in the PluginList. |
| 525 void UpdatePluginListWithNaClModules(); |
| 526 |
| 527 NaClModuleInfoList::iterator FindNaClModule(const GURL& url); |
| 528 |
505 // The profile this ExtensionService is part of. | 529 // The profile this ExtensionService is part of. |
506 Profile* profile_; | 530 Profile* profile_; |
507 | 531 |
508 // Preferences for the owning profile (weak reference). | 532 // Preferences for the owning profile (weak reference). |
509 ExtensionPrefs* extension_prefs_; | 533 ExtensionPrefs* extension_prefs_; |
510 | 534 |
511 // The current list of installed extensions. | 535 // The current list of installed extensions. |
512 // TODO(aa): This should use chrome/common/extensions/extension_set.h. | 536 // TODO(aa): This should use chrome/common/extensions/extension_set.h. |
513 ExtensionList extensions_; | 537 ExtensionList extensions_; |
514 | 538 |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
596 // A collection of external extension providers. Each provider reads | 620 // A collection of external extension providers. Each provider reads |
597 // a source of external extension information. Examples include the | 621 // a source of external extension information. Examples include the |
598 // windows registry and external_extensions.json. | 622 // windows registry and external_extensions.json. |
599 ProviderCollection external_extension_providers_; | 623 ProviderCollection external_extension_providers_; |
600 | 624 |
601 // Set to true by OnExternalExtensionUpdateUrlFound() when an external | 625 // Set to true by OnExternalExtensionUpdateUrlFound() when an external |
602 // extension URL is found. Used in CheckForExternalUpdates() to see | 626 // extension URL is found. Used in CheckForExternalUpdates() to see |
603 // if an update check is needed to install pending extensions. | 627 // if an update check is needed to install pending extensions. |
604 bool external_extension_url_added_; | 628 bool external_extension_url_added_; |
605 | 629 |
| 630 NaClModuleInfoList nacl_module_list_; |
| 631 |
606 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 632 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
607 InstallAppsWithUnlimtedStorage); | 633 InstallAppsWithUnlimtedStorage); |
608 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 634 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
609 InstallAppsAndCheckStorageProtection); | 635 InstallAppsAndCheckStorageProtection); |
610 DISALLOW_COPY_AND_ASSIGN(ExtensionService); | 636 DISALLOW_COPY_AND_ASSIGN(ExtensionService); |
611 }; | 637 }; |
612 | 638 |
613 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ | 639 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ |
OLD | NEW |