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 // Similar to FinishInstallation, but first checks if there still is an update | 441 // Similar to FinishInstallation, but first checks if there still is an update |
434 // pending for the extension, and makes sure the extension is still idle. | 442 // pending for the extension, and makes sure the extension is still idle. |
435 void MaybeFinishDelayedInstallation(const std::string& extension_id); | 443 void MaybeFinishDelayedInstallation(const std::string& extension_id); |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
756 int include_mask) const; | 764 int include_mask) const; |
757 | 765 |
758 // Adds the given extension to the list of terminated extensions if | 766 // Adds the given extension to the list of terminated extensions if |
759 // it is not already there and unloads it. | 767 // it is not already there and unloads it. |
760 void TrackTerminatedExtension(const extensions::Extension* extension); | 768 void TrackTerminatedExtension(const extensions::Extension* extension); |
761 | 769 |
762 // Removes the extension with the given id from the list of | 770 // Removes the extension with the given id from the list of |
763 // terminated extensions if it is there. | 771 // terminated extensions if it is there. |
764 void UntrackTerminatedExtension(const std::string& id); | 772 void UntrackTerminatedExtension(const std::string& id); |
765 | 773 |
| 774 // Update preferences for a new or updated extension; notify observers that |
| 775 // the extension is installed, e.g., to update event handlers on background |
| 776 // pages; and perform other extension install tasks before calling |
| 777 // AddExtension. |
| 778 void AddNewOrUpdatedExtension( |
| 779 const extensions::Extension* extension, |
| 780 const syncer::StringOrdinal& page_ordinal, |
| 781 extensions::Extension::State initial_state); |
| 782 |
766 // Handles sending notification that |extension| was loaded. | 783 // Handles sending notification that |extension| was loaded. |
767 void NotifyExtensionLoaded(const extensions::Extension* extension); | 784 void NotifyExtensionLoaded(const extensions::Extension* extension); |
768 | 785 |
769 // Handles sending notification that |extension| was unloaded. | 786 // Handles sending notification that |extension| was unloaded. |
770 void NotifyExtensionUnloaded(const extensions::Extension* extension, | 787 void NotifyExtensionUnloaded(const extensions::Extension* extension, |
771 extension_misc::UnloadedExtensionReason reason); | 788 extension_misc::UnloadedExtensionReason reason); |
772 | 789 |
773 // Common helper to finish installing the given extension. | 790 // Common helper to finish installing the given extension. |
774 void FinishInstallation(const extensions::Extension* extension); | 791 void FinishInstallation(const extensions::Extension* extension); |
775 | 792 |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
994 #endif | 1011 #endif |
995 | 1012 |
996 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 1013 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
997 InstallAppsWithUnlimtedStorage); | 1014 InstallAppsWithUnlimtedStorage); |
998 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 1015 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
999 InstallAppsAndCheckStorageProtection); | 1016 InstallAppsAndCheckStorageProtection); |
1000 DISALLOW_COPY_AND_ASSIGN(ExtensionService); | 1017 DISALLOW_COPY_AND_ASSIGN(ExtensionService); |
1001 }; | 1018 }; |
1002 | 1019 |
1003 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ | 1020 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ |
OLD | NEW |