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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 | 123 |
124 virtual void CheckManagementPolicy() = 0; | 124 virtual void CheckManagementPolicy() = 0; |
125 | 125 |
126 // Safe to call multiple times in a row. | 126 // Safe to call multiple times in a row. |
127 // | 127 // |
128 // TODO(akalin): Remove this method (and others) once we refactor | 128 // TODO(akalin): Remove this method (and others) once we refactor |
129 // themes sync to not use it directly. | 129 // themes sync to not use it directly. |
130 virtual void CheckForUpdatesSoon() = 0; | 130 virtual void CheckForUpdatesSoon() = 0; |
131 | 131 |
132 virtual void AddExtension(const extensions::Extension* extension) = 0; | 132 virtual void AddExtension(const extensions::Extension* extension) = 0; |
| 133 virtual void AddComponentExtension( |
| 134 const extensions::Extension* extension) = 0; |
133 | 135 |
134 virtual void UnloadExtension( | 136 virtual void UnloadExtension( |
135 const std::string& extension_id, | 137 const std::string& extension_id, |
136 extension_misc::UnloadedExtensionReason reason) = 0; | 138 extension_misc::UnloadedExtensionReason reason) = 0; |
137 | 139 |
138 virtual void SyncExtensionChangeIfNeeded( | 140 virtual void SyncExtensionChangeIfNeeded( |
139 const extensions::Extension& extension) = 0; | 141 const extensions::Extension& extension) = 0; |
140 | 142 |
141 virtual bool is_ready() = 0; | 143 virtual bool is_ready() = 0; |
142 | 144 |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
416 gfx::Image GetOmniboxPopupIcon(const std::string& extension_id); | 418 gfx::Image GetOmniboxPopupIcon(const std::string& extension_id); |
417 | 419 |
418 // Called when the initial extensions load has completed. | 420 // Called when the initial extensions load has completed. |
419 virtual void OnLoadedInstalledExtensions(); | 421 virtual void OnLoadedInstalledExtensions(); |
420 | 422 |
421 // Adds |extension| to this ExtensionService and notifies observers than an | 423 // Adds |extension| to this ExtensionService and notifies observers than an |
422 // extension has been loaded. Called by the backend after an extension has | 424 // extension has been loaded. Called by the backend after an extension has |
423 // been loaded from a file and installed. | 425 // been loaded from a file and installed. |
424 virtual void AddExtension(const extensions::Extension* extension) OVERRIDE; | 426 virtual void AddExtension(const extensions::Extension* extension) OVERRIDE; |
425 | 427 |
| 428 // Check if we have preferences for the component extension and, if not or if |
| 429 // the stored version differs, install the extension (without requirements |
| 430 // checking) before calling AddExtension. |
| 431 virtual void AddComponentExtension(const extensions::Extension* extension) |
| 432 OVERRIDE; |
| 433 |
426 // Called by the backend when an extension has been installed. | 434 // Called by the backend when an extension has been installed. |
427 void OnExtensionInstalled( | 435 void OnExtensionInstalled( |
428 const extensions::Extension* extension, | 436 const extensions::Extension* extension, |
429 const syncer::StringOrdinal& page_ordinal, | 437 const syncer::StringOrdinal& page_ordinal, |
430 bool has_requirement_errors, | 438 bool has_requirement_errors, |
431 bool wait_for_idle); | 439 bool wait_for_idle); |
432 | 440 |
433 // Finishes installation of an update for an extension with the specified id, | 441 // Finishes installation of an update for an extension with the specified id, |
434 // when installation of that extension was previously delayed because the | 442 // when installation of that extension was previously delayed because the |
435 // extension was in use. | 443 // extension was in use. |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 int include_mask) const; | 763 int include_mask) const; |
756 | 764 |
757 // Adds the given extension to the list of terminated extensions if | 765 // Adds the given extension to the list of terminated extensions if |
758 // it is not already there and unloads it. | 766 // it is not already there and unloads it. |
759 void TrackTerminatedExtension(const extensions::Extension* extension); | 767 void TrackTerminatedExtension(const extensions::Extension* extension); |
760 | 768 |
761 // Removes the extension with the given id from the list of | 769 // Removes the extension with the given id from the list of |
762 // terminated extensions if it is there. | 770 // terminated extensions if it is there. |
763 void UntrackTerminatedExtension(const std::string& id); | 771 void UntrackTerminatedExtension(const std::string& id); |
764 | 772 |
| 773 // Update preferences for a new or updated extension; notify observers that |
| 774 // the extension is installed, e.g., to update event handlers on background |
| 775 // pages; and perform other extension install tasks before calling |
| 776 // AddExtension. |
| 777 void AddNewOrUpdatedExtension( |
| 778 const extensions::Extension* extension, |
| 779 const syncer::StringOrdinal& page_ordinal, |
| 780 extensions::Extension::State initial_state); |
| 781 |
765 // Handles sending notification that |extension| was loaded. | 782 // Handles sending notification that |extension| was loaded. |
766 void NotifyExtensionLoaded(const extensions::Extension* extension); | 783 void NotifyExtensionLoaded(const extensions::Extension* extension); |
767 | 784 |
768 // Handles sending notification that |extension| was unloaded. | 785 // Handles sending notification that |extension| was unloaded. |
769 void NotifyExtensionUnloaded(const extensions::Extension* extension, | 786 void NotifyExtensionUnloaded(const extensions::Extension* extension, |
770 extension_misc::UnloadedExtensionReason reason); | 787 extension_misc::UnloadedExtensionReason reason); |
771 | 788 |
772 // Reloads |extension_id| and then dispatches to it the PostReloadEvents | 789 // Reloads |extension_id| and then dispatches to it the PostReloadEvents |
773 // indicated by |events|. | 790 // indicated by |events|. |
774 void ReloadExtensionWithEvents(const std::string& extension_id, | 791 void ReloadExtensionWithEvents(const std::string& extension_id, |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
985 #endif | 1002 #endif |
986 | 1003 |
987 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 1004 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
988 InstallAppsWithUnlimtedStorage); | 1005 InstallAppsWithUnlimtedStorage); |
989 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 1006 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
990 InstallAppsAndCheckStorageProtection); | 1007 InstallAppsAndCheckStorageProtection); |
991 DISALLOW_COPY_AND_ASSIGN(ExtensionService); | 1008 DISALLOW_COPY_AND_ASSIGN(ExtensionService); |
992 }; | 1009 }; |
993 | 1010 |
994 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ | 1011 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ |
OLD | NEW |