| 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 15 matching lines...) Expand all Loading... |
| 26 #include "chrome/browser/extensions/app_shortcut_manager.h" | 26 #include "chrome/browser/extensions/app_shortcut_manager.h" |
| 27 #include "chrome/browser/extensions/app_sync_bundle.h" | 27 #include "chrome/browser/extensions/app_sync_bundle.h" |
| 28 #include "chrome/browser/extensions/apps_promo.h" | 28 #include "chrome/browser/extensions/apps_promo.h" |
| 29 #include "chrome/browser/extensions/extension_icon_manager.h" | 29 #include "chrome/browser/extensions/extension_icon_manager.h" |
| 30 #include "chrome/browser/extensions/extension_prefs.h" | 30 #include "chrome/browser/extensions/extension_prefs.h" |
| 31 #include "chrome/browser/extensions/extension_process_manager.h" | 31 #include "chrome/browser/extensions/extension_process_manager.h" |
| 32 #include "chrome/browser/extensions/extension_sync_bundle.h" | 32 #include "chrome/browser/extensions/extension_sync_bundle.h" |
| 33 #include "chrome/browser/extensions/extension_toolbar_model.h" | 33 #include "chrome/browser/extensions/extension_toolbar_model.h" |
| 34 #include "chrome/browser/extensions/extension_warning_set.h" | 34 #include "chrome/browser/extensions/extension_warning_set.h" |
| 35 #include "chrome/browser/extensions/extensions_quota_service.h" | 35 #include "chrome/browser/extensions/extensions_quota_service.h" |
| 36 #include "chrome/browser/extensions/external_extension_provider_interface.h" | 36 #include "chrome/browser/extensions/external_provider_interface.h" |
| 37 #include "chrome/browser/extensions/menu_manager.h" | 37 #include "chrome/browser/extensions/menu_manager.h" |
| 38 #include "chrome/browser/extensions/pending_extension_manager.h" | 38 #include "chrome/browser/extensions/pending_extension_manager.h" |
| 39 #include "chrome/browser/extensions/process_map.h" | 39 #include "chrome/browser/extensions/process_map.h" |
| 40 #include "chrome/browser/prefs/pref_change_registrar.h" | 40 #include "chrome/browser/prefs/pref_change_registrar.h" |
| 41 #include "chrome/common/extensions/extension.h" | 41 #include "chrome/common/extensions/extension.h" |
| 42 #include "chrome/common/extensions/extension_constants.h" | 42 #include "chrome/common/extensions/extension_constants.h" |
| 43 #include "chrome/common/extensions/extension_set.h" | 43 #include "chrome/common/extensions/extension_set.h" |
| 44 #include "content/public/browser/browser_thread.h" | 44 #include "content/public/browser/browser_thread.h" |
| 45 #include "content/public/browser/notification_observer.h" | 45 #include "content/public/browser/notification_observer.h" |
| 46 #include "content/public/browser/notification_registrar.h" | 46 #include "content/public/browser/notification_registrar.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 | 138 |
| 139 virtual void SyncExtensionChangeIfNeeded( | 139 virtual void SyncExtensionChangeIfNeeded( |
| 140 const extensions::Extension& extension) = 0; | 140 const extensions::Extension& extension) = 0; |
| 141 | 141 |
| 142 virtual bool is_ready() = 0; | 142 virtual bool is_ready() = 0; |
| 143 }; | 143 }; |
| 144 | 144 |
| 145 // Manages installed and running Chromium extensions. | 145 // Manages installed and running Chromium extensions. |
| 146 class ExtensionService | 146 class ExtensionService |
| 147 : public ExtensionServiceInterface, | 147 : public ExtensionServiceInterface, |
| 148 public ExternalExtensionProviderInterface::VisitorInterface, | 148 public extensions::ExternalProviderInterface::VisitorInterface, |
| 149 public content::NotificationObserver { | 149 public content::NotificationObserver { |
| 150 public: | 150 public: |
| 151 // The name of the directory inside the profile where extensions are | 151 // The name of the directory inside the profile where extensions are |
| 152 // installed to. | 152 // installed to. |
| 153 static const char* kInstallDirectoryName; | 153 static const char* kInstallDirectoryName; |
| 154 | 154 |
| 155 // If auto-updates are turned on, default to running every 5 hours. | 155 // If auto-updates are turned on, default to running every 5 hours. |
| 156 static const int kDefaultUpdateFrequencySeconds = 60 * 60 * 5; | 156 static const int kDefaultUpdateFrequencySeconds = 60 * 60 * 5; |
| 157 | 157 |
| 158 // The name of the directory inside the profile where per-app local settings | 158 // The name of the directory inside the profile where per-app local settings |
| (...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 bool be_noisy); | 524 bool be_noisy); |
| 525 | 525 |
| 526 // ExtensionHost of background page calls this method right after its render | 526 // ExtensionHost of background page calls this method right after its render |
| 527 // view has been created. | 527 // view has been created. |
| 528 void DidCreateRenderViewForBackgroundPage(ExtensionHost* host); | 528 void DidCreateRenderViewForBackgroundPage(ExtensionHost* host); |
| 529 | 529 |
| 530 // For the extension in |version_path| with |id|, check to see if it's an | 530 // For the extension in |version_path| with |id|, check to see if it's an |
| 531 // externally managed extension. If so, uninstall it. | 531 // externally managed extension. If so, uninstall it. |
| 532 void CheckExternalUninstall(const std::string& id); | 532 void CheckExternalUninstall(const std::string& id); |
| 533 | 533 |
| 534 // Clear all ExternalExtensionProviders. | 534 // Clear all ExternalProviders. |
| 535 void ClearProvidersForTesting(); | 535 void ClearProvidersForTesting(); |
| 536 | 536 |
| 537 // Adds an ExternalExtensionProviderInterface for the service to use during | 537 // Adds an ExternalProviderInterface for the service to use during testing. |
| 538 // testing. Takes ownership of |test_provider|. | 538 // Takes ownership of |test_provider|. |
| 539 void AddProviderForTesting(ExternalExtensionProviderInterface* test_provider); | 539 void AddProviderForTesting( |
| 540 extensions::ExternalProviderInterface* test_provider); |
| 540 | 541 |
| 541 // ExternalExtensionProvider::Visitor implementation. | 542 // ExternalProvider::Visitor implementation. |
| 542 virtual bool OnExternalExtensionFileFound( | 543 virtual bool OnExternalExtensionFileFound( |
| 543 const std::string& id, | 544 const std::string& id, |
| 544 const Version* version, | 545 const Version* version, |
| 545 const FilePath& path, | 546 const FilePath& path, |
| 546 extensions::Extension::Location location, | 547 extensions::Extension::Location location, |
| 547 int creation_flags, | 548 int creation_flags, |
| 548 bool mark_acknowledged) OVERRIDE; | 549 bool mark_acknowledged) OVERRIDE; |
| 549 | 550 |
| 550 virtual bool OnExternalExtensionUpdateUrlFound( | 551 virtual bool OnExternalExtensionUpdateUrlFound( |
| 551 const std::string& id, | 552 const std::string& id, |
| 552 const GURL& update_url, | 553 const GURL& update_url, |
| 553 extensions::Extension::Location location) OVERRIDE; | 554 extensions::Extension::Location location) OVERRIDE; |
| 554 | 555 |
| 555 virtual void OnExternalProviderReady( | 556 virtual void OnExternalProviderReady( |
| 556 const ExternalExtensionProviderInterface* provider) OVERRIDE; | 557 const extensions::ExternalProviderInterface* provider) OVERRIDE; |
| 557 | 558 |
| 558 // Returns true when all the external extension providers are ready. | 559 // Returns true when all the external extension providers are ready. |
| 559 bool AreAllExternalProvidersReady() const; | 560 bool AreAllExternalProvidersReady() const; |
| 560 | 561 |
| 561 void OnAllExternalProvidersReady(); | 562 void OnAllExternalProvidersReady(); |
| 562 | 563 |
| 563 // Once all external providers are done, generates any needed alerts about | 564 // Once all external providers are done, generates any needed alerts about |
| 564 // extensions. | 565 // extensions. |
| 565 void IdentifyAlertableExtensions(); | 566 void IdentifyAlertableExtensions(); |
| 566 | 567 |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 822 | 823 |
| 823 #if defined(OS_CHROMEOS) | 824 #if defined(OS_CHROMEOS) |
| 824 scoped_ptr<chromeos::ExtensionBluetoothEventRouter> bluetooth_event_router_; | 825 scoped_ptr<chromeos::ExtensionBluetoothEventRouter> bluetooth_event_router_; |
| 825 scoped_ptr<chromeos::ExtensionInputMethodEventRouter> | 826 scoped_ptr<chromeos::ExtensionInputMethodEventRouter> |
| 826 input_method_event_router_; | 827 input_method_event_router_; |
| 827 #endif | 828 #endif |
| 828 | 829 |
| 829 // A collection of external extension providers. Each provider reads | 830 // A collection of external extension providers. Each provider reads |
| 830 // a source of external extension information. Examples include the | 831 // a source of external extension information. Examples include the |
| 831 // windows registry and external_extensions.json. | 832 // windows registry and external_extensions.json. |
| 832 ProviderCollection external_extension_providers_; | 833 extensions::ProviderCollection external_extension_providers_; |
| 833 | 834 |
| 834 // Set to true by OnExternalExtensionUpdateUrlFound() when an external | 835 // Set to true by OnExternalExtensionUpdateUrlFound() when an external |
| 835 // extension URL is found, and by CheckForUpdatesSoon() when an update check | 836 // extension URL is found, and by CheckForUpdatesSoon() when an update check |
| 836 // has to wait for the external providers. Used in | 837 // has to wait for the external providers. Used in |
| 837 // OnAllExternalProvidersReady() to determine if an update check is needed to | 838 // OnAllExternalProvidersReady() to determine if an update check is needed to |
| 838 // install pending extensions. | 839 // install pending extensions. |
| 839 bool update_once_all_providers_are_ready_; | 840 bool update_once_all_providers_are_ready_; |
| 840 | 841 |
| 841 NaClModuleInfoList nacl_module_list_; | 842 NaClModuleInfoList nacl_module_list_; |
| 842 | 843 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 855 scoped_ptr<ExtensionGlobalError> extension_global_error_; | 856 scoped_ptr<ExtensionGlobalError> extension_global_error_; |
| 856 | 857 |
| 857 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 858 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
| 858 InstallAppsWithUnlimtedStorage); | 859 InstallAppsWithUnlimtedStorage); |
| 859 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 860 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
| 860 InstallAppsAndCheckStorageProtection); | 861 InstallAppsAndCheckStorageProtection); |
| 861 DISALLOW_COPY_AND_ASSIGN(ExtensionService); | 862 DISALLOW_COPY_AND_ASSIGN(ExtensionService); |
| 862 }; | 863 }; |
| 863 | 864 |
| 864 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ | 865 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ |
| OLD | NEW |