| 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 // ownership remains at caller. | 193 // ownership remains at caller. |
| 194 ExtensionService(Profile* profile, | 194 ExtensionService(Profile* profile, |
| 195 const base::CommandLine* command_line, | 195 const base::CommandLine* command_line, |
| 196 const base::FilePath& install_directory, | 196 const base::FilePath& install_directory, |
| 197 extensions::ExtensionPrefs* extension_prefs, | 197 extensions::ExtensionPrefs* extension_prefs, |
| 198 extensions::Blacklist* blacklist, | 198 extensions::Blacklist* blacklist, |
| 199 bool autoupdate_enabled, | 199 bool autoupdate_enabled, |
| 200 bool extensions_enabled, | 200 bool extensions_enabled, |
| 201 extensions::OneShotEvent* ready); | 201 extensions::OneShotEvent* ready); |
| 202 | 202 |
| 203 virtual ~ExtensionService(); | 203 ~ExtensionService() override; |
| 204 | 204 |
| 205 // ExtensionServiceInterface implementation. | 205 // ExtensionServiceInterface implementation. |
| 206 // | 206 // |
| 207 // NOTE: Many of these methods are DEPRECATED. See the interface for details. | 207 // NOTE: Many of these methods are DEPRECATED. See the interface for details. |
| 208 virtual const extensions::ExtensionSet* extensions() const override; | 208 const extensions::ExtensionSet* extensions() const override; |
| 209 virtual extensions::PendingExtensionManager* | 209 extensions::PendingExtensionManager* pending_extension_manager() override; |
| 210 pending_extension_manager() override; | 210 const extensions::Extension* GetExtensionById( |
| 211 virtual const extensions::Extension* GetExtensionById( | 211 const std::string& id, |
| 212 const std::string& id, bool include_disabled) const override; | 212 bool include_disabled) const override; |
| 213 virtual const extensions::Extension* GetInstalledExtension( | 213 const extensions::Extension* GetInstalledExtension( |
| 214 const std::string& id) const override; | 214 const std::string& id) const override; |
| 215 virtual bool UpdateExtension( | 215 bool UpdateExtension(const std::string& id, |
| 216 const std::string& id, | 216 const base::FilePath& extension_path, |
| 217 const base::FilePath& extension_path, | 217 bool file_ownership_passed, |
| 218 bool file_ownership_passed, | 218 extensions::CrxInstaller** out_crx_installer) override; |
| 219 extensions::CrxInstaller** out_crx_installer) override; | 219 bool IsExtensionEnabled(const std::string& extension_id) const override; |
| 220 virtual bool IsExtensionEnabled( | 220 void UnloadExtension( |
| 221 const std::string& extension_id) const override; | |
| 222 virtual void UnloadExtension( | |
| 223 const std::string& extension_id, | 221 const std::string& extension_id, |
| 224 extensions::UnloadedExtensionInfo::Reason reason) override; | 222 extensions::UnloadedExtensionInfo::Reason reason) override; |
| 225 virtual void RemoveComponentExtension(const std::string& extension_id) | 223 void RemoveComponentExtension(const std::string& extension_id) override; |
| 226 override; | 224 void AddExtension(const extensions::Extension* extension) override; |
| 227 virtual void AddExtension(const extensions::Extension* extension) override; | 225 void AddComponentExtension(const extensions::Extension* extension) override; |
| 228 virtual void AddComponentExtension(const extensions::Extension* extension) | 226 const extensions::Extension* GetPendingExtensionUpdate( |
| 229 override; | |
| 230 virtual const extensions::Extension* GetPendingExtensionUpdate( | |
| 231 const std::string& extension_id) const override; | 227 const std::string& extension_id) const override; |
| 232 virtual void FinishDelayedInstallation( | 228 void FinishDelayedInstallation(const std::string& extension_id) override; |
| 233 const std::string& extension_id) override; | 229 void CheckManagementPolicy() override; |
| 234 virtual void CheckManagementPolicy() override; | 230 void CheckForUpdatesSoon() override; |
| 235 virtual void CheckForUpdatesSoon() override; | 231 bool is_ready() override; |
| 236 virtual bool is_ready() override; | 232 base::SequencedTaskRunner* GetFileTaskRunner() override; |
| 237 virtual base::SequencedTaskRunner* GetFileTaskRunner() override; | |
| 238 | 233 |
| 239 // ExternalProvider::Visitor implementation. | 234 // ExternalProvider::Visitor implementation. |
| 240 // Exposed for testing. | 235 // Exposed for testing. |
| 241 virtual bool OnExternalExtensionFileFound( | 236 bool OnExternalExtensionFileFound(const std::string& id, |
| 242 const std::string& id, | 237 const base::Version* version, |
| 243 const base::Version* version, | 238 const base::FilePath& path, |
| 244 const base::FilePath& path, | 239 extensions::Manifest::Location location, |
| 245 extensions::Manifest::Location location, | 240 int creation_flags, |
| 246 int creation_flags, | 241 bool mark_acknowledged) override; |
| 247 bool mark_acknowledged) override; | 242 bool OnExternalExtensionUpdateUrlFound( |
| 248 virtual bool OnExternalExtensionUpdateUrlFound( | |
| 249 const std::string& id, | 243 const std::string& id, |
| 250 const std::string& install_parameter, | 244 const std::string& install_parameter, |
| 251 const GURL& update_url, | 245 const GURL& update_url, |
| 252 extensions::Manifest::Location location, | 246 extensions::Manifest::Location location, |
| 253 int creation_flags, | 247 int creation_flags, |
| 254 bool mark_acknowledged) override; | 248 bool mark_acknowledged) override; |
| 255 virtual void OnExternalProviderReady( | 249 void OnExternalProviderReady( |
| 256 const extensions::ExternalProviderInterface* provider) override; | 250 const extensions::ExternalProviderInterface* provider) override; |
| 257 | 251 |
| 258 // ExtensionManagement::Observer implementation: | 252 // ExtensionManagement::Observer implementation: |
| 259 virtual void OnExtensionManagementSettingsChanged() override; | 253 void OnExtensionManagementSettingsChanged() override; |
| 260 | 254 |
| 261 // Initialize and start all installed extensions. | 255 // Initialize and start all installed extensions. |
| 262 void Init(); | 256 void Init(); |
| 263 | 257 |
| 264 // Called when the associated Profile is going to be destroyed. | 258 // Called when the associated Profile is going to be destroyed. |
| 265 void Shutdown(); | 259 void Shutdown(); |
| 266 | 260 |
| 267 // Reloads the specified extension, sending the onLaunched() event to it if it | 261 // Reloads the specified extension, sending the onLaunched() event to it if it |
| 268 // currently has any window showing. | 262 // currently has any window showing. |
| 269 // Allows noisy failures. | 263 // Allows noisy failures. |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 478 // Creates an ExtensionDownloader for use by the updater. | 472 // Creates an ExtensionDownloader for use by the updater. |
| 479 scoped_ptr<extensions::ExtensionDownloader> CreateExtensionDownloader( | 473 scoped_ptr<extensions::ExtensionDownloader> CreateExtensionDownloader( |
| 480 extensions::ExtensionDownloaderDelegate* delegate); | 474 extensions::ExtensionDownloaderDelegate* delegate); |
| 481 | 475 |
| 482 // Reloads the specified extension, sending the onLaunched() event to it if it | 476 // Reloads the specified extension, sending the onLaunched() event to it if it |
| 483 // currently has any window showing. |be_noisy| determines whether noisy | 477 // currently has any window showing. |be_noisy| determines whether noisy |
| 484 // failures are allowed for unpacked extension installs. | 478 // failures are allowed for unpacked extension installs. |
| 485 void ReloadExtensionImpl(const std::string& extension_id, bool be_noisy); | 479 void ReloadExtensionImpl(const std::string& extension_id, bool be_noisy); |
| 486 | 480 |
| 487 // content::NotificationObserver implementation: | 481 // content::NotificationObserver implementation: |
| 488 virtual void Observe(int type, | 482 void Observe(int type, |
| 489 const content::NotificationSource& source, | 483 const content::NotificationSource& source, |
| 490 const content::NotificationDetails& details) override; | 484 const content::NotificationDetails& details) override; |
| 491 | 485 |
| 492 // extensions::Blacklist::Observer implementation. | 486 // extensions::Blacklist::Observer implementation. |
| 493 virtual void OnBlacklistUpdated() override; | 487 void OnBlacklistUpdated() override; |
| 494 | 488 |
| 495 // Similar to FinishInstallation, but first checks if there still is an update | 489 // Similar to FinishInstallation, but first checks if there still is an update |
| 496 // pending for the extension, and makes sure the extension is still idle. | 490 // pending for the extension, and makes sure the extension is still idle. |
| 497 void MaybeFinishDelayedInstallation(const std::string& extension_id); | 491 void MaybeFinishDelayedInstallation(const std::string& extension_id); |
| 498 | 492 |
| 499 // For the extension in |version_path| with |id|, check to see if it's an | 493 // For the extension in |version_path| with |id|, check to see if it's an |
| 500 // externally managed extension. If so, uninstall it. | 494 // externally managed extension. If so, uninstall it. |
| 501 void CheckExternalUninstall(const std::string& id); | 495 void CheckExternalUninstall(const std::string& id); |
| 502 | 496 |
| 503 // Populates greylist_. | 497 // Populates greylist_. |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 739 GreylistedExtensionDisabled); | 733 GreylistedExtensionDisabled); |
| 740 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 734 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
| 741 GreylistDontEnableManuallyDisabled); | 735 GreylistDontEnableManuallyDisabled); |
| 742 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 736 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
| 743 GreylistUnknownDontChange); | 737 GreylistUnknownDontChange); |
| 744 | 738 |
| 745 DISALLOW_COPY_AND_ASSIGN(ExtensionService); | 739 DISALLOW_COPY_AND_ASSIGN(ExtensionService); |
| 746 }; | 740 }; |
| 747 | 741 |
| 748 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ | 742 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ |
| OLD | NEW |