| 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 666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 bool being_upgraded; | 684 bool being_upgraded; |
| 686 | 685 |
| 687 // True if the extension has used the webRequest API. | 686 // True if the extension has used the webRequest API. |
| 688 bool has_used_webrequest; | 687 bool has_used_webrequest; |
| 689 | 688 |
| 690 ExtensionRuntimeData(); | 689 ExtensionRuntimeData(); |
| 691 ~ExtensionRuntimeData(); | 690 ~ExtensionRuntimeData(); |
| 692 }; | 691 }; |
| 693 typedef std::map<std::string, ExtensionRuntimeData> ExtensionRuntimeDataMap; | 692 typedef std::map<std::string, ExtensionRuntimeData> ExtensionRuntimeDataMap; |
| 694 | 693 |
| 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. | 694 // Signals *ready_ and sends a notification to the listeners. |
| 705 void SetReadyAndNotifyListeners(); | 695 void SetReadyAndNotifyListeners(); |
| 706 | 696 |
| 707 // Return true if the sync type of |extension| matches |type|. | 697 // Return true if the sync type of |extension| matches |type|. |
| 708 bool IsCorrectSyncType(const extensions::Extension& extension, | 698 bool IsCorrectSyncType(const extensions::Extension& extension, |
| 709 syncer::ModelType type) | 699 syncer::ModelType type) |
| 710 const; | 700 const; |
| 711 | 701 |
| 712 void OnExtensionInstallPrefChanged(); | 702 void OnExtensionInstallPrefChanged(); |
| 713 | 703 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 766 // (e.g., due to an upgrade). | 756 // (e.g., due to an upgrade). |
| 767 void CheckPermissionsIncrease(const extensions::Extension* extension, | 757 void CheckPermissionsIncrease(const extensions::Extension* extension, |
| 768 bool is_upgrade); | 758 bool is_upgrade); |
| 769 | 759 |
| 770 // Returns true if the app with id |extension_id| has any shell windows open. | 760 // Returns true if the app with id |extension_id| has any shell windows open. |
| 771 bool HasShellWindows(const std::string& extension_id); | 761 bool HasShellWindows(const std::string& extension_id); |
| 772 | 762 |
| 773 // Helper that updates the active extension list used for crash reporting. | 763 // Helper that updates the active extension list used for crash reporting. |
| 774 void UpdateActiveExtensionsInCrashReporter(); | 764 void UpdateActiveExtensionsInCrashReporter(); |
| 775 | 765 |
| 776 // 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 | |
| 778 // 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 | |
| 780 // type, like application/pdf. Note: We only register NaCl modules in the | |
| 781 // browser process. | |
| 782 void RegisterNaClModule(const GURL& url, const std::string& mime_type); | |
| 783 void UnregisterNaClModule(const GURL& url); | |
| 784 | |
| 785 // Call UpdatePluginListWithNaClModules() after registering or unregistering | |
| 786 // a NaCl module to see those changes reflected in the PluginList. | |
| 787 void UpdatePluginListWithNaClModules(); | |
| 788 | |
| 789 NaClModuleInfoList::iterator FindNaClModule(const GURL& url); | |
| 790 | |
| 791 // Performs tasks requested to occur after |extension| loads. | 766 // Performs tasks requested to occur after |extension| loads. |
| 792 void DoPostLoadTasks(const extensions::Extension* extension); | 767 void DoPostLoadTasks(const extensions::Extension* extension); |
| 793 | 768 |
| 794 // Launches the platform app associated with |extension_host|. | 769 // Launches the platform app associated with |extension_host|. |
| 795 static void LaunchApplication(extensions::ExtensionHost* extension_host); | 770 static void LaunchApplication(extensions::ExtensionHost* extension_host); |
| 796 | 771 |
| 797 // Dispatches a restart event to the platform app associated with | 772 // Dispatches a restart event to the platform app associated with |
| 798 // |extension_host|. | 773 // |extension_host|. |
| 799 static void RestartApplication(extensions::ExtensionHost* extension_host); | 774 static void RestartApplication(extensions::ExtensionHost* extension_host); |
| 800 | 775 |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 957 // to allow background processing of tasks such as garbage collection of | 932 // to allow background processing of tasks such as garbage collection of |
| 958 // on-disk state without needing to worry about race conditions caused | 933 // on-disk state without needing to worry about race conditions caused |
| 959 // by extension installation and reinstallation. | 934 // by extension installation and reinstallation. |
| 960 bool installs_delayed_; | 935 bool installs_delayed_; |
| 961 | 936 |
| 962 // Set to true if this is the first time this ExtensionService has run. | 937 // Set to true if this is the first time this ExtensionService has run. |
| 963 // Used for specially handling external extensions that are installed the | 938 // Used for specially handling external extensions that are installed the |
| 964 // first time. | 939 // first time. |
| 965 bool is_first_run_; | 940 bool is_first_run_; |
| 966 | 941 |
| 967 NaClModuleInfoList nacl_module_list_; | |
| 968 | |
| 969 extensions::AppSyncBundle app_sync_bundle_; | 942 extensions::AppSyncBundle app_sync_bundle_; |
| 970 extensions::ExtensionSyncBundle extension_sync_bundle_; | 943 extensions::ExtensionSyncBundle extension_sync_bundle_; |
| 971 | 944 |
| 972 extensions::ProcessMap process_map_; | 945 extensions::ProcessMap process_map_; |
| 973 | 946 |
| 974 scoped_ptr<ExtensionErrorUI> extension_error_ui_; | 947 scoped_ptr<ExtensionErrorUI> extension_error_ui_; |
| 975 // Sequenced task runner for extension related file operations. | 948 // Sequenced task runner for extension related file operations. |
| 976 scoped_refptr<base::SequencedTaskRunner> file_task_runner_; | 949 scoped_refptr<base::SequencedTaskRunner> file_task_runner_; |
| 977 | 950 |
| 978 #if defined(ENABLE_EXTENSIONS) | 951 #if defined(ENABLE_EXTENSIONS) |
| 979 scoped_ptr<extensions::ExtensionActionStorageManager> | 952 scoped_ptr<extensions::ExtensionActionStorageManager> |
| 980 extension_action_storage_manager_; | 953 extension_action_storage_manager_; |
| 981 #endif | 954 #endif |
| 982 | 955 |
| 983 ObserverList<extensions::UpdateObserver, true> update_observers_; | 956 ObserverList<extensions::UpdateObserver, true> update_observers_; |
| 984 | 957 |
| 985 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 958 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
| 986 InstallAppsWithUnlimtedStorage); | 959 InstallAppsWithUnlimtedStorage); |
| 987 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 960 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
| 988 InstallAppsAndCheckStorageProtection); | 961 InstallAppsAndCheckStorageProtection); |
| 989 DISALLOW_COPY_AND_ASSIGN(ExtensionService); | 962 DISALLOW_COPY_AND_ASSIGN(ExtensionService); |
| 990 }; | 963 }; |
| 991 | 964 |
| 992 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ | 965 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ |
| OLD | NEW |