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 |
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. If the import conditions can | |
416 // never be satisfied (e.g., the importer is not from the web store or the | |
417 // imported extension is not a shared module), |unrecoverable_error| is set | |
418 // true. | |
419 bool CheckImports(const extensions::Extension* extension, | |
420 bool* unrecoverable_error); | |
asargent_no_longer_on_chrome
2013/06/13 05:47:16
Huh, it's pretty unusual to see a function returni
elijahtaylor1
2013/06/13 23:32:09
Ok you caught me writing bad code for sure. I wou
| |
421 | |
422 // Returns a set of extensions that import a given extension. | |
423 scoped_ptr<const ExtensionSet> GetSharedModuleImporters( | |
asargent_no_longer_on_chrome
2013/06/13 05:47:16
optional naming suggestion: GetDependents / GetDep
elijahtaylor1
2013/06/13 23:32:09
Done.
| |
424 const extensions::Extension* extension); | |
425 | |
426 // Checks an extension's shared module imports to see if they would still be | |
427 // referenced by other extensions when a particular extension is uninstalled. | |
428 // Uninstalls shared modules that are no longer referenced. | |
asargent_no_longer_on_chrome
2013/06/13 05:47:16
nit: The first sentence in this comment is sort of
elijahtaylor1
2013/06/13 23:32:09
Done.
| |
429 void PruneSharedModulesOnUninstall(const extensions::Extension* extension); | |
430 | |
413 // Informs the service that an extension's files are in place for loading. | 431 // Informs the service that an extension's files are in place for loading. |
414 // | 432 // |
415 // Please make sure the Blacklist is checked some time before calling this | 433 // Please make sure the Blacklist is checked some time before calling this |
416 // method. | 434 // method. |
417 void OnExtensionInstalled( | 435 void OnExtensionInstalled( |
418 const extensions::Extension* extension, | 436 const extensions::Extension* extension, |
419 const syncer::StringOrdinal& page_ordinal, | 437 const syncer::StringOrdinal& page_ordinal, |
420 bool has_requirement_errors, | 438 bool has_requirement_errors, |
421 bool wait_for_idle); | 439 bool wait_for_idle); |
422 | 440 |
441 // Checks for delayed installation for all pending installs. | |
442 void MaybeFinishDelayedInstallations(); | |
443 | |
423 // Similar to FinishInstallation, but first checks if there still is an update | 444 // 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. | 445 // pending for the extension, and makes sure the extension is still idle. |
425 void MaybeFinishDelayedInstallation(const std::string& extension_id); | 446 void MaybeFinishDelayedInstallation(const std::string& extension_id); |
426 | 447 |
427 // Finishes installation of an update for an extension with the specified id, | 448 // Finishes installation of an update for an extension with the specified id, |
428 // when installation of that extension was previously delayed because the | 449 // when installation of that extension was previously delayed because the |
429 // extension was in use. | 450 // extension was in use. |
430 virtual void FinishDelayedInstallation( | 451 virtual void FinishDelayedInstallation( |
431 const std::string& extension_id) OVERRIDE; | 452 const std::string& extension_id) OVERRIDE; |
432 | 453 |
(...skipping 361 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
794 | 815 |
795 // The list of installed extensions that have been terminated. | 816 // The list of installed extensions that have been terminated. |
796 ExtensionSet terminated_extensions_; | 817 ExtensionSet terminated_extensions_; |
797 | 818 |
798 // The list of installed extensions that have been blacklisted. Generally | 819 // The list of installed extensions that have been blacklisted. Generally |
799 // these shouldn't be considered as installed by the extension platform: we | 820 // 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 | 821 // only keep them around so that if extensions are blacklisted by mistake |
801 // they can easily be un-blacklisted. | 822 // they can easily be un-blacklisted. |
802 ExtensionSet blacklisted_extensions_; | 823 ExtensionSet blacklisted_extensions_; |
803 | 824 |
804 // The list of extension updates that have had their installs delayed because | 825 // The list of extension installs delayed for various reasons. The reason |
805 // they are waiting for idle. | 826 // 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_; | 827 ExtensionSet delayed_installs_; |
812 | 828 |
813 // Hold the set of pending extensions. | 829 // Hold the set of pending extensions. |
814 extensions::PendingExtensionManager pending_extension_manager_; | 830 extensions::PendingExtensionManager pending_extension_manager_; |
815 | 831 |
816 // The map of extension IDs to their runtime data. | 832 // The map of extension IDs to their runtime data. |
817 ExtensionRuntimeDataMap extension_runtime_data_; | 833 ExtensionRuntimeDataMap extension_runtime_data_; |
818 | 834 |
819 // The full path to the directory where extensions are installed. | 835 // The full path to the directory where extensions are installed. |
820 base::FilePath install_directory_; | 836 base::FilePath install_directory_; |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
916 ObserverList<extensions::UpdateObserver, true> update_observers_; | 932 ObserverList<extensions::UpdateObserver, true> update_observers_; |
917 | 933 |
918 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 934 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
919 InstallAppsWithUnlimtedStorage); | 935 InstallAppsWithUnlimtedStorage); |
920 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 936 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
921 InstallAppsAndCheckStorageProtection); | 937 InstallAppsAndCheckStorageProtection); |
922 DISALLOW_COPY_AND_ASSIGN(ExtensionService); | 938 DISALLOW_COPY_AND_ASSIGN(ExtensionService); |
923 }; | 939 }; |
924 | 940 |
925 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ | 941 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ |
OLD | NEW |