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