Chromium Code Reviews| 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 #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 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 59 class BrowserEventRouter; | 59 class BrowserEventRouter; |
| 60 class ComponentLoader; | 60 class ComponentLoader; |
| 61 class ContentSettingsStore; | 61 class ContentSettingsStore; |
| 62 class CrxInstaller; | 62 class CrxInstaller; |
| 63 class ExtensionActionStorageManager; | 63 class ExtensionActionStorageManager; |
| 64 class ExtensionSyncData; | 64 class ExtensionSyncData; |
| 65 class ExtensionSystem; | 65 class ExtensionSystem; |
| 66 class ExtensionUpdater; | 66 class ExtensionUpdater; |
| 67 class PendingExtensionManager; | 67 class PendingExtensionManager; |
| 68 class SettingsFrontend; | 68 class SettingsFrontend; |
| 69 } | 69 } // namespace extensions |
|
Matt Perry
2013/06/12 00:58:29
nit: 2 spaces before //. But the comment is unnece
elijahtaylor1
2013/06/12 23:53:23
I did this in response to a presubmit check. It o
| |
| 70 | 70 |
| 71 namespace syncer { | 71 namespace syncer { |
| 72 class SyncErrorFactory; | 72 class SyncErrorFactory; |
| 73 } | 73 } |
| 74 | 74 |
| 75 // This is an interface class to encapsulate the dependencies that | 75 // This is an interface class to encapsulate the dependencies that |
| 76 // various classes have on ExtensionService. This allows easy mocking. | 76 // various classes have on ExtensionService. This allows easy mocking. |
| 77 class ExtensionServiceInterface : public syncer::SyncableService { | 77 class ExtensionServiceInterface : public syncer::SyncableService { |
| 78 public: | 78 public: |
| 79 virtual ~ExtensionServiceInterface() {} | 79 virtual ~ExtensionServiceInterface() {} |
| (...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 403 // Adds |extension| to this ExtensionService and notifies observers that the | 403 // Adds |extension| to this ExtensionService and notifies observers that the |
| 404 // extensions have been loaded. | 404 // extensions have been loaded. |
| 405 virtual void AddExtension(const extensions::Extension* extension) OVERRIDE; | 405 virtual void AddExtension(const extensions::Extension* extension) OVERRIDE; |
| 406 | 406 |
| 407 // Check if we have preferences for the component extension and, if not or if | 407 // Check if we have preferences for the component extension and, if not or if |
| 408 // the stored version differs, install the extension (without requirements | 408 // the stored version differs, install the extension (without requirements |
| 409 // checking) before calling AddExtension. | 409 // checking) before calling AddExtension. |
| 410 virtual void AddComponentExtension(const extensions::Extension* extension) | 410 virtual void AddComponentExtension(const extensions::Extension* extension) |
| 411 OVERRIDE; | 411 OVERRIDE; |
| 412 | 412 |
| 413 // Checks an extension's shared module imports to see if they are satisfied. | |
| 414 // If they are not, this function adds the dependencies to the pending install | |
| 415 // list if |extension| came from the webstore. | |
| 416 bool CheckImports(const extensions::Extension* extension); | |
| 417 | |
| 418 // Returns a set of extensions that import a given extension. | |
| 419 scoped_ptr<const ExtensionSet> GetSharedModuleImporters( | |
| 420 const extensions::Extension* extension); | |
| 421 | |
| 422 // Checks an extension's shared module imports to see if they would still be | |
| 423 // referenced by other extensions when a particular extension is uninstalled. | |
| 424 // Uninstalls shared modules that are no longer referenced. | |
| 425 void PruneSharedModulesOnUninstall(const extensions::Extension* extension); | |
| 426 | |
| 413 // Informs the service that an extension's files are in place for loading. | 427 // Informs the service that an extension's files are in place for loading. |
| 414 // | 428 // |
| 415 // Please make sure the Blacklist is checked some time before calling this | 429 // Please make sure the Blacklist is checked some time before calling this |
| 416 // method. | 430 // method. |
| 417 void OnExtensionInstalled( | 431 void OnExtensionInstalled( |
| 418 const extensions::Extension* extension, | 432 const extensions::Extension* extension, |
| 419 const syncer::StringOrdinal& page_ordinal, | 433 const syncer::StringOrdinal& page_ordinal, |
| 420 bool has_requirement_errors, | 434 bool has_requirement_errors, |
| 421 bool wait_for_idle); | 435 bool wait_for_idle); |
| 422 | 436 |
| 437 // Checks for delayed installation for all pending installs. | |
| 438 void MaybeFinishDelayedInstallations(); | |
| 439 | |
| 423 // Similar to FinishInstallation, but first checks if there still is an update | 440 // Similar to FinishInstallation, but first checks if there still is an update |
| 424 // pending for the extension, and makes sure the extension is still idle. | 441 // pending for the extension, and makes sure the extension is still idle. |
| 425 void MaybeFinishDelayedInstallation(const std::string& extension_id); | 442 void MaybeFinishDelayedInstallation(const std::string& extension_id); |
| 426 | 443 |
| 427 // Finishes installation of an update for an extension with the specified id, | 444 // Finishes installation of an update for an extension with the specified id, |
| 428 // when installation of that extension was previously delayed because the | 445 // when installation of that extension was previously delayed because the |
| 429 // extension was in use. | 446 // extension was in use. |
| 430 virtual void FinishDelayedInstallation( | 447 virtual void FinishDelayedInstallation( |
| 431 const std::string& extension_id) OVERRIDE; | 448 const std::string& extension_id) OVERRIDE; |
| 432 | 449 |
| (...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 794 | 811 |
| 795 // The list of installed extensions that have been terminated. | 812 // The list of installed extensions that have been terminated. |
| 796 ExtensionSet terminated_extensions_; | 813 ExtensionSet terminated_extensions_; |
| 797 | 814 |
| 798 // The list of installed extensions that have been blacklisted. Generally | 815 // The list of installed extensions that have been blacklisted. Generally |
| 799 // these shouldn't be considered as installed by the extension platform: we | 816 // these shouldn't be considered as installed by the extension platform: we |
| 800 // only keep them around so that if extensions are blacklisted by mistake | 817 // only keep them around so that if extensions are blacklisted by mistake |
| 801 // they can easily be un-blacklisted. | 818 // they can easily be un-blacklisted. |
| 802 ExtensionSet blacklisted_extensions_; | 819 ExtensionSet blacklisted_extensions_; |
| 803 | 820 |
| 804 // The list of extension updates that have had their installs delayed because | 821 // The list of extension installs delayed for various reasons. The reason |
| 805 // they are waiting for idle. | 822 // for delayed install is stored in ExtensionPrefs. |
| 806 ExtensionSet delayed_updates_for_idle_; | |
| 807 | |
| 808 // The list of extension installs delayed by |installs_delayed_|. | |
| 809 // This is a disjoint set from |delayed_updates_for_idle_|. Extensions in | |
| 810 // the |delayed_installs_| do not need to wait for idle. | |
| 811 ExtensionSet delayed_installs_; | 823 ExtensionSet delayed_installs_; |
| 812 | 824 |
| 813 // Hold the set of pending extensions. | 825 // Hold the set of pending extensions. |
| 814 extensions::PendingExtensionManager pending_extension_manager_; | 826 extensions::PendingExtensionManager pending_extension_manager_; |
| 815 | 827 |
| 816 // The map of extension IDs to their runtime data. | 828 // The map of extension IDs to their runtime data. |
| 817 ExtensionRuntimeDataMap extension_runtime_data_; | 829 ExtensionRuntimeDataMap extension_runtime_data_; |
| 818 | 830 |
| 819 // The full path to the directory where extensions are installed. | 831 // The full path to the directory where extensions are installed. |
| 820 base::FilePath install_directory_; | 832 base::FilePath install_directory_; |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 916 ObserverList<extensions::UpdateObserver, true> update_observers_; | 928 ObserverList<extensions::UpdateObserver, true> update_observers_; |
| 917 | 929 |
| 918 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 930 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
| 919 InstallAppsWithUnlimtedStorage); | 931 InstallAppsWithUnlimtedStorage); |
| 920 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 932 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
| 921 InstallAppsAndCheckStorageProtection); | 933 InstallAppsAndCheckStorageProtection); |
| 922 DISALLOW_COPY_AND_ASSIGN(ExtensionService); | 934 DISALLOW_COPY_AND_ASSIGN(ExtensionService); |
| 923 }; | 935 }; |
| 924 | 936 |
| 925 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ | 937 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ |
| OLD | NEW |