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 <list> | 8 #include <list> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 443 // extension was in use. | 443 // extension was in use. |
| 444 virtual void FinishDelayedInstallation( | 444 virtual void FinishDelayedInstallation( |
| 445 const std::string& extension_id) OVERRIDE; | 445 const std::string& extension_id) OVERRIDE; |
| 446 | 446 |
| 447 // Returns an update for an extension with the specified id, if installation | 447 // Returns an update for an extension with the specified id, if installation |
| 448 // of that update was previously delayed because the extension was in use. If | 448 // of that update was previously delayed because the extension was in use. If |
| 449 // no updates are pending for the extension returns NULL. | 449 // no updates are pending for the extension returns NULL. |
| 450 virtual const extensions::Extension* GetPendingExtensionUpdate( | 450 virtual const extensions::Extension* GetPendingExtensionUpdate( |
| 451 const std::string& extension_id) const OVERRIDE; | 451 const std::string& extension_id) const OVERRIDE; |
| 452 | 452 |
| 453 // Initializes the |extension|'s active permission set and disables the | |
| 454 // extension if the privilege level has increased (e.g., due to an upgrade). | |
| 455 void InitializePermissions(const extensions::Extension* extension); | |
|
Jeffrey Yasskin
2013/04/25 01:53:37
Made private and renamed.
| |
| 456 | |
| 457 // Go through each extension and unload those that are not allowed to run by | 453 // Go through each extension and unload those that are not allowed to run by |
| 458 // management policy providers (ie. network admin and Google-managed | 454 // management policy providers (ie. network admin and Google-managed |
| 459 // blacklist). | 455 // blacklist). |
| 460 virtual void CheckManagementPolicy() OVERRIDE; | 456 virtual void CheckManagementPolicy() OVERRIDE; |
| 461 | 457 |
| 462 virtual void CheckForUpdatesSoon() OVERRIDE; | 458 virtual void CheckForUpdatesSoon() OVERRIDE; |
| 463 | 459 |
| 464 // syncer::SyncableService implementation. | 460 // syncer::SyncableService implementation. |
| 465 virtual syncer::SyncMergeResult MergeDataAndStartSyncing( | 461 virtual syncer::SyncMergeResult MergeDataAndStartSyncing( |
| 466 syncer::ModelType type, | 462 syncer::ModelType type, |
| (...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 756 extension_misc::UnloadedExtensionReason reason); | 752 extension_misc::UnloadedExtensionReason reason); |
| 757 | 753 |
| 758 // Common helper to finish installing the given extension. | 754 // Common helper to finish installing the given extension. |
| 759 void FinishInstallation(const extensions::Extension* extension); | 755 void FinishInstallation(const extensions::Extension* extension); |
| 760 | 756 |
| 761 // Reloads |extension_id| and then dispatches to it the PostReloadEvents | 757 // Reloads |extension_id| and then dispatches to it the PostReloadEvents |
| 762 // indicated by |events|. | 758 // indicated by |events|. |
| 763 void ReloadExtensionWithEvents(const std::string& extension_id, | 759 void ReloadExtensionWithEvents(const std::string& extension_id, |
| 764 int events); | 760 int events); |
| 765 | 761 |
| 762 // Updates the |extension|'s active permission set to include only permissions | |
| 763 // currently requested by the extension and all the permissions required by | |
| 764 // the extension. | |
| 765 void UpdateActivePermissions(const extensions::Extension* extension); | |
| 766 | |
| 767 // Disables the extension if the privilege level has increased | |
| 768 // (e.g., due to an upgrade). | |
| 769 void CheckPermissionsIncrease(const extensions::Extension* extension, | |
| 770 bool is_upgrade); | |
| 771 | |
| 766 // Returns true if the app with id |extension_id| has any shell windows open. | 772 // Returns true if the app with id |extension_id| has any shell windows open. |
| 767 bool HasShellWindows(const std::string& extension_id); | 773 bool HasShellWindows(const std::string& extension_id); |
| 768 | 774 |
| 769 // Helper that updates the active extension list used for crash reporting. | 775 // Helper that updates the active extension list used for crash reporting. |
| 770 void UpdateActiveExtensionsInCrashReporter(); | 776 void UpdateActiveExtensionsInCrashReporter(); |
| 771 | 777 |
| 772 // We implement some Pepper plug-ins using NaCl to take advantage of NaCl's | 778 // We implement some Pepper plug-ins using NaCl to take advantage of NaCl's |
| 773 // strong sandbox. Typically, these NaCl modules are stored in extensions | 779 // strong sandbox. Typically, these NaCl modules are stored in extensions |
| 774 // and registered here. Not all NaCl modules need to register for a MIME | 780 // and registered here. Not all NaCl modules need to register for a MIME |
| 775 // type, just the ones that are responsible for rendering a particular MIME | 781 // type, just the ones that are responsible for rendering a particular MIME |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 901 | 907 |
| 902 // The model that tracks extensions with BrowserAction buttons. | 908 // The model that tracks extensions with BrowserAction buttons. |
| 903 ExtensionToolbarModel toolbar_model_; | 909 ExtensionToolbarModel toolbar_model_; |
| 904 | 910 |
| 905 // Map unloaded extensions' ids to their paths. When a temporarily loaded | 911 // Map unloaded extensions' ids to their paths. When a temporarily loaded |
| 906 // extension is unloaded, we lose the information about it and don't have | 912 // extension is unloaded, we lose the information about it and don't have |
| 907 // any in the extension preferences file. | 913 // any in the extension preferences file. |
| 908 typedef std::map<std::string, base::FilePath> UnloadedExtensionPathMap; | 914 typedef std::map<std::string, base::FilePath> UnloadedExtensionPathMap; |
| 909 UnloadedExtensionPathMap unloaded_extension_paths_; | 915 UnloadedExtensionPathMap unloaded_extension_paths_; |
| 910 | 916 |
| 911 // Map disabled extensions' ids to their paths. When a temporarily loaded | 917 // Store the ids of reloading extensions. |
| 912 // extension is disabled before it is reloaded, keep track of the path so that | 918 std::set<std::string> reloading_extensions_; |
| 913 // it can be re-enabled upon a successful load. | |
| 914 typedef std::map<std::string, base::FilePath> DisabledExtensionPathMap; | |
| 915 DisabledExtensionPathMap disabled_extension_paths_; | |
| 916 | 919 |
| 917 // Map of inspector cookies that are detached, waiting for an extension to be | 920 // Map of inspector cookies that are detached, waiting for an extension to be |
| 918 // reloaded. | 921 // reloaded. |
| 919 typedef std::map<std::string, std::string> OrphanedDevTools; | 922 typedef std::map<std::string, std::string> OrphanedDevTools; |
| 920 OrphanedDevTools orphaned_dev_tools_; | 923 OrphanedDevTools orphaned_dev_tools_; |
| 921 | 924 |
| 922 // Maps extension ids to a bitmask that indicates which events should be | 925 // Maps extension ids to a bitmask that indicates which events should be |
| 923 // dispatched to the extension when it is loaded. | 926 // dispatched to the extension when it is loaded. |
| 924 std::map<std::string, int> on_load_events_; | 927 std::map<std::string, int> on_load_events_; |
| 925 | 928 |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 993 ObserverList<extensions::UpdateObserver, true> update_observers_; | 996 ObserverList<extensions::UpdateObserver, true> update_observers_; |
| 994 | 997 |
| 995 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 998 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
| 996 InstallAppsWithUnlimtedStorage); | 999 InstallAppsWithUnlimtedStorage); |
| 997 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 1000 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
| 998 InstallAppsAndCheckStorageProtection); | 1001 InstallAppsAndCheckStorageProtection); |
| 999 DISALLOW_COPY_AND_ASSIGN(ExtensionService); | 1002 DISALLOW_COPY_AND_ASSIGN(ExtensionService); |
| 1000 }; | 1003 }; |
| 1001 | 1004 |
| 1002 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ | 1005 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ |
| OLD | NEW |