| 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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 | 135 |
| 136 virtual void SyncExtensionChangeIfNeeded( | 136 virtual void SyncExtensionChangeIfNeeded( |
| 137 const extensions::Extension& extension) = 0; | 137 const extensions::Extension& extension) = 0; |
| 138 | 138 |
| 139 virtual bool is_ready() = 0; | 139 virtual bool is_ready() = 0; |
| 140 }; | 140 }; |
| 141 | 141 |
| 142 // Manages installed and running Chromium extensions. | 142 // Manages installed and running Chromium extensions. |
| 143 class ExtensionService | 143 class ExtensionService |
| 144 : public ExtensionServiceInterface, | 144 : public ExtensionServiceInterface, |
| 145 public ExternalExtensionProviderInterface::VisitorInterface, | 145 public extensions::ExternalProviderInterface::VisitorInterface, |
| 146 public content::NotificationObserver { | 146 public content::NotificationObserver { |
| 147 public: | 147 public: |
| 148 // The name of the directory inside the profile where extensions are | 148 // The name of the directory inside the profile where extensions are |
| 149 // installed to. | 149 // installed to. |
| 150 static const char* kInstallDirectoryName; | 150 static const char* kInstallDirectoryName; |
| 151 | 151 |
| 152 // If auto-updates are turned on, default to running every 5 hours. | 152 // If auto-updates are turned on, default to running every 5 hours. |
| 153 static const int kDefaultUpdateFrequencySeconds = 60 * 60 * 5; | 153 static const int kDefaultUpdateFrequencySeconds = 60 * 60 * 5; |
| 154 | 154 |
| 155 // The name of the directory inside the profile where per-app local settings | 155 // 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... |
| 521 bool be_noisy); | 521 bool be_noisy); |
| 522 | 522 |
| 523 // ExtensionHost of background page calls this method right after its render | 523 // ExtensionHost of background page calls this method right after its render |
| 524 // view has been created. | 524 // view has been created. |
| 525 void DidCreateRenderViewForBackgroundPage(ExtensionHost* host); | 525 void DidCreateRenderViewForBackgroundPage(ExtensionHost* host); |
| 526 | 526 |
| 527 // For the extension in |version_path| with |id|, check to see if it's an | 527 // For the extension in |version_path| with |id|, check to see if it's an |
| 528 // externally managed extension. If so, uninstall it. | 528 // externally managed extension. If so, uninstall it. |
| 529 void CheckExternalUninstall(const std::string& id); | 529 void CheckExternalUninstall(const std::string& id); |
| 530 | 530 |
| 531 // Clear all ExternalExtensionProviders. | 531 // Clear all ExternalProviders. |
| 532 void ClearProvidersForTesting(); | 532 void ClearProvidersForTesting(); |
| 533 | 533 |
| 534 // Adds an ExternalExtensionProviderInterface for the service to use during | 534 // Adds an ExternalProviderInterface for the service to use during testing. |
| 535 // testing. Takes ownership of |test_provider|. | 535 // Takes ownership of |test_provider|. |
| 536 void AddProviderForTesting(ExternalExtensionProviderInterface* test_provider); | 536 void AddProviderForTesting( |
| 537 extensions::ExternalProviderInterface* test_provider); |
| 537 | 538 |
| 538 // ExternalExtensionProvider::Visitor implementation. | 539 // ExternalProvider::Visitor implementation. |
| 539 virtual bool OnExternalExtensionFileFound( | 540 virtual bool OnExternalExtensionFileFound( |
| 540 const std::string& id, | 541 const std::string& id, |
| 541 const Version* version, | 542 const Version* version, |
| 542 const FilePath& path, | 543 const FilePath& path, |
| 543 extensions::Extension::Location location, | 544 extensions::Extension::Location location, |
| 544 int creation_flags, | 545 int creation_flags, |
| 545 bool mark_acknowledged) OVERRIDE; | 546 bool mark_acknowledged) OVERRIDE; |
| 546 | 547 |
| 547 virtual bool OnExternalExtensionUpdateUrlFound( | 548 virtual bool OnExternalExtensionUpdateUrlFound( |
| 548 const std::string& id, | 549 const std::string& id, |
| 549 const GURL& update_url, | 550 const GURL& update_url, |
| 550 extensions::Extension::Location location) OVERRIDE; | 551 extensions::Extension::Location location) OVERRIDE; |
| 551 | 552 |
| 552 virtual void OnExternalProviderReady( | 553 virtual void OnExternalProviderReady( |
| 553 const ExternalExtensionProviderInterface* provider) OVERRIDE; | 554 const extensions::ExternalProviderInterface* provider) OVERRIDE; |
| 554 | 555 |
| 555 // Returns true when all the external extension providers are ready. | 556 // Returns true when all the external extension providers are ready. |
| 556 bool AreAllExternalProvidersReady() const; | 557 bool AreAllExternalProvidersReady() const; |
| 557 | 558 |
| 558 void OnAllExternalProvidersReady(); | 559 void OnAllExternalProvidersReady(); |
| 559 | 560 |
| 560 // Once all external providers are done, generates any needed alerts about | 561 // Once all external providers are done, generates any needed alerts about |
| 561 // extensions. | 562 // extensions. |
| 562 void IdentifyAlertableExtensions(); | 563 void IdentifyAlertableExtensions(); |
| 563 | 564 |
| (...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 | 819 |
| 819 #if defined(OS_CHROMEOS) | 820 #if defined(OS_CHROMEOS) |
| 820 scoped_ptr<chromeos::ExtensionBluetoothEventRouter> bluetooth_event_router_; | 821 scoped_ptr<chromeos::ExtensionBluetoothEventRouter> bluetooth_event_router_; |
| 821 scoped_ptr<chromeos::ExtensionInputMethodEventRouter> | 822 scoped_ptr<chromeos::ExtensionInputMethodEventRouter> |
| 822 input_method_event_router_; | 823 input_method_event_router_; |
| 823 #endif | 824 #endif |
| 824 | 825 |
| 825 // A collection of external extension providers. Each provider reads | 826 // A collection of external extension providers. Each provider reads |
| 826 // a source of external extension information. Examples include the | 827 // a source of external extension information. Examples include the |
| 827 // windows registry and external_extensions.json. | 828 // windows registry and external_extensions.json. |
| 828 ProviderCollection external_extension_providers_; | 829 extensions::ProviderCollection external_extension_providers_; |
| 829 | 830 |
| 830 // Set to true by OnExternalExtensionUpdateUrlFound() when an external | 831 // Set to true by OnExternalExtensionUpdateUrlFound() when an external |
| 831 // extension URL is found, and by CheckForUpdatesSoon() when an update check | 832 // extension URL is found, and by CheckForUpdatesSoon() when an update check |
| 832 // has to wait for the external providers. Used in | 833 // has to wait for the external providers. Used in |
| 833 // OnAllExternalProvidersReady() to determine if an update check is needed to | 834 // OnAllExternalProvidersReady() to determine if an update check is needed to |
| 834 // install pending extensions. | 835 // install pending extensions. |
| 835 bool update_once_all_providers_are_ready_; | 836 bool update_once_all_providers_are_ready_; |
| 836 | 837 |
| 837 NaClModuleInfoList nacl_module_list_; | 838 NaClModuleInfoList nacl_module_list_; |
| 838 | 839 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 851 scoped_ptr<ExtensionGlobalError> extension_global_error_; | 852 scoped_ptr<ExtensionGlobalError> extension_global_error_; |
| 852 | 853 |
| 853 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 854 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
| 854 InstallAppsWithUnlimtedStorage); | 855 InstallAppsWithUnlimtedStorage); |
| 855 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 856 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
| 856 InstallAppsAndCheckStorageProtection); | 857 InstallAppsAndCheckStorageProtection); |
| 857 DISALLOW_COPY_AND_ASSIGN(ExtensionService); | 858 DISALLOW_COPY_AND_ASSIGN(ExtensionService); |
| 858 }; | 859 }; |
| 859 | 860 |
| 860 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ | 861 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ |
| OLD | NEW |