| 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> | |
| 9 #include <map> | 8 #include <map> |
| 10 #include <set> | 9 #include <set> |
| 11 #include <string> | 10 #include <string> |
| 12 #include <vector> | 11 #include <vector> |
| 13 | 12 |
| 14 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 15 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
| 16 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
| 17 #include "base/memory/ref_counted.h" | 16 #include "base/memory/ref_counted.h" |
| 18 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 29 #include "chrome/browser/extensions/extensions_quota_service.h" | 28 #include "chrome/browser/extensions/extensions_quota_service.h" |
| 30 #include "chrome/browser/extensions/external_provider_interface.h" | 29 #include "chrome/browser/extensions/external_provider_interface.h" |
| 31 #include "chrome/browser/extensions/menu_manager.h" | 30 #include "chrome/browser/extensions/menu_manager.h" |
| 32 #include "chrome/browser/extensions/pending_extension_manager.h" | 31 #include "chrome/browser/extensions/pending_extension_manager.h" |
| 33 #include "chrome/browser/extensions/process_map.h" | 32 #include "chrome/browser/extensions/process_map.h" |
| 34 #include "chrome/browser/extensions/update_observer.h" | 33 #include "chrome/browser/extensions/update_observer.h" |
| 35 #include "chrome/common/extensions/extension.h" | 34 #include "chrome/common/extensions/extension.h" |
| 36 #include "chrome/common/extensions/extension_constants.h" | 35 #include "chrome/common/extensions/extension_constants.h" |
| 37 #include "chrome/common/extensions/extension_set.h" | 36 #include "chrome/common/extensions/extension_set.h" |
| 38 #include "chrome/common/extensions/manifest.h" | 37 #include "chrome/common/extensions/manifest.h" |
| 38 #include "chrome/common/extensions/manifest_handlers/nacl_modules_handler.h" |
| 39 #include "content/public/browser/notification_observer.h" | 39 #include "content/public/browser/notification_observer.h" |
| 40 #include "content/public/browser/notification_registrar.h" | 40 #include "content/public/browser/notification_registrar.h" |
| 41 #include "extensions/common/one_shot_event.h" | 41 #include "extensions/common/one_shot_event.h" |
| 42 #include "sync/api/string_ordinal.h" | 42 #include "sync/api/string_ordinal.h" |
| 43 #include "sync/api/sync_change.h" | 43 #include "sync/api/sync_change.h" |
| 44 #include "sync/api/syncable_service.h" | 44 #include "sync/api/syncable_service.h" |
| 45 | 45 |
| 46 class CommandLine; | 46 class CommandLine; |
| 47 class ExtensionErrorUI; | 47 class ExtensionErrorUI; |
| 48 class ExtensionSyncData; | 48 class ExtensionSyncData; |
| (...skipping 636 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 bool being_upgraded; | 685 bool being_upgraded; |
| 686 | 686 |
| 687 // True if the extension has used the webRequest API. | 687 // True if the extension has used the webRequest API. |
| 688 bool has_used_webrequest; | 688 bool has_used_webrequest; |
| 689 | 689 |
| 690 ExtensionRuntimeData(); | 690 ExtensionRuntimeData(); |
| 691 ~ExtensionRuntimeData(); | 691 ~ExtensionRuntimeData(); |
| 692 }; | 692 }; |
| 693 typedef std::map<std::string, ExtensionRuntimeData> ExtensionRuntimeDataMap; | 693 typedef std::map<std::string, ExtensionRuntimeData> ExtensionRuntimeDataMap; |
| 694 | 694 |
| 695 struct NaClModuleInfo { | |
| 696 NaClModuleInfo(); | |
| 697 ~NaClModuleInfo(); | |
| 698 | |
| 699 GURL url; | |
| 700 std::string mime_type; | |
| 701 }; | |
| 702 typedef std::list<NaClModuleInfo> NaClModuleInfoList; | |
| 703 | |
| 704 // Signals *ready_ and sends a notification to the listeners. | 695 // Signals *ready_ and sends a notification to the listeners. |
| 705 void SetReadyAndNotifyListeners(); | 696 void SetReadyAndNotifyListeners(); |
| 706 | 697 |
| 707 // Return true if the sync type of |extension| matches |type|. | 698 // Return true if the sync type of |extension| matches |type|. |
| 708 bool IsCorrectSyncType(const extensions::Extension& extension, | 699 bool IsCorrectSyncType(const extensions::Extension& extension, |
| 709 syncer::ModelType type) | 700 syncer::ModelType type) |
| 710 const; | 701 const; |
| 711 | 702 |
| 712 void OnExtensionInstallPrefChanged(); | 703 void OnExtensionInstallPrefChanged(); |
| 713 | 704 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 772 | 763 |
| 773 // Helper that updates the active extension list used for crash reporting. | 764 // Helper that updates the active extension list used for crash reporting. |
| 774 void UpdateActiveExtensionsInCrashReporter(); | 765 void UpdateActiveExtensionsInCrashReporter(); |
| 775 | 766 |
| 776 // We implement some Pepper plug-ins using NaCl to take advantage of NaCl's | 767 // We implement some Pepper plug-ins using NaCl to take advantage of NaCl's |
| 777 // strong sandbox. Typically, these NaCl modules are stored in extensions | 768 // strong sandbox. Typically, these NaCl modules are stored in extensions |
| 778 // and registered here. Not all NaCl modules need to register for a MIME | 769 // and registered here. Not all NaCl modules need to register for a MIME |
| 779 // type, just the ones that are responsible for rendering a particular MIME | 770 // type, just the ones that are responsible for rendering a particular MIME |
| 780 // type, like application/pdf. Note: We only register NaCl modules in the | 771 // type, like application/pdf. Note: We only register NaCl modules in the |
| 781 // browser process. | 772 // browser process. |
| 782 void RegisterNaClModule(const GURL& url, const std::string& mime_type); | 773 void RegisterNaClModule(const extensions::NaClModuleInfo& info); |
| 783 void UnregisterNaClModule(const GURL& url); | 774 void UnregisterNaClModule(const extensions::NaClModuleInfo& info); |
| 784 | 775 |
| 785 // Call UpdatePluginListWithNaClModules() after registering or unregistering | 776 // Call UpdatePluginListWithNaClModules() after registering or unregistering |
| 786 // a NaCl module to see those changes reflected in the PluginList. | 777 // a NaCl module to see those changes reflected in the PluginList. |
| 787 void UpdatePluginListWithNaClModules(); | 778 void UpdatePluginListWithNaClModules(); |
| 788 | 779 |
| 789 NaClModuleInfoList::iterator FindNaClModule(const GURL& url); | 780 extensions::NaClModuleInfo::List::iterator FindNaClModule(const GURL& url); |
| 790 | 781 |
| 791 // Performs tasks requested to occur after |extension| loads. | 782 // Performs tasks requested to occur after |extension| loads. |
| 792 void DoPostLoadTasks(const extensions::Extension* extension); | 783 void DoPostLoadTasks(const extensions::Extension* extension); |
| 793 | 784 |
| 794 // Launches the platform app associated with |extension_host|. | 785 // Launches the platform app associated with |extension_host|. |
| 795 static void LaunchApplication(extensions::ExtensionHost* extension_host); | 786 static void LaunchApplication(extensions::ExtensionHost* extension_host); |
| 796 | 787 |
| 797 // Dispatches a restart event to the platform app associated with | 788 // Dispatches a restart event to the platform app associated with |
| 798 // |extension_host|. | 789 // |extension_host|. |
| 799 static void RestartApplication(extensions::ExtensionHost* extension_host); | 790 static void RestartApplication(extensions::ExtensionHost* extension_host); |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 957 // to allow background processing of tasks such as garbage collection of | 948 // to allow background processing of tasks such as garbage collection of |
| 958 // on-disk state without needing to worry about race conditions caused | 949 // on-disk state without needing to worry about race conditions caused |
| 959 // by extension installation and reinstallation. | 950 // by extension installation and reinstallation. |
| 960 bool installs_delayed_; | 951 bool installs_delayed_; |
| 961 | 952 |
| 962 // Set to true if this is the first time this ExtensionService has run. | 953 // Set to true if this is the first time this ExtensionService has run. |
| 963 // Used for specially handling external extensions that are installed the | 954 // Used for specially handling external extensions that are installed the |
| 964 // first time. | 955 // first time. |
| 965 bool is_first_run_; | 956 bool is_first_run_; |
| 966 | 957 |
| 967 NaClModuleInfoList nacl_module_list_; | 958 extensions::NaClModuleInfo::List nacl_module_list_; |
| 968 | 959 |
| 969 extensions::AppSyncBundle app_sync_bundle_; | 960 extensions::AppSyncBundle app_sync_bundle_; |
| 970 extensions::ExtensionSyncBundle extension_sync_bundle_; | 961 extensions::ExtensionSyncBundle extension_sync_bundle_; |
| 971 | 962 |
| 972 extensions::ProcessMap process_map_; | 963 extensions::ProcessMap process_map_; |
| 973 | 964 |
| 974 scoped_ptr<ExtensionErrorUI> extension_error_ui_; | 965 scoped_ptr<ExtensionErrorUI> extension_error_ui_; |
| 975 // Sequenced task runner for extension related file operations. | 966 // Sequenced task runner for extension related file operations. |
| 976 scoped_refptr<base::SequencedTaskRunner> file_task_runner_; | 967 scoped_refptr<base::SequencedTaskRunner> file_task_runner_; |
| 977 | 968 |
| 978 #if defined(ENABLE_EXTENSIONS) | 969 #if defined(ENABLE_EXTENSIONS) |
| 979 scoped_ptr<extensions::ExtensionActionStorageManager> | 970 scoped_ptr<extensions::ExtensionActionStorageManager> |
| 980 extension_action_storage_manager_; | 971 extension_action_storage_manager_; |
| 981 #endif | 972 #endif |
| 982 | 973 |
| 983 ObserverList<extensions::UpdateObserver, true> update_observers_; | 974 ObserverList<extensions::UpdateObserver, true> update_observers_; |
| 984 | 975 |
| 985 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 976 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
| 986 InstallAppsWithUnlimtedStorage); | 977 InstallAppsWithUnlimtedStorage); |
| 987 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 978 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
| 988 InstallAppsAndCheckStorageProtection); | 979 InstallAppsAndCheckStorageProtection); |
| 989 DISALLOW_COPY_AND_ASSIGN(ExtensionService); | 980 DISALLOW_COPY_AND_ASSIGN(ExtensionService); |
| 990 }; | 981 }; |
| 991 | 982 |
| 992 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ | 983 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ |
| OLD | NEW |