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