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 20 matching lines...) Expand all Loading... |
31 #include "chrome/browser/extensions/menu_manager.h" | 31 #include "chrome/browser/extensions/menu_manager.h" |
32 #include "chrome/browser/extensions/pending_extension_manager.h" | 32 #include "chrome/browser/extensions/pending_extension_manager.h" |
33 #include "chrome/browser/extensions/process_map.h" | 33 #include "chrome/browser/extensions/process_map.h" |
34 #include "chrome/browser/extensions/update_observer.h" | 34 #include "chrome/browser/extensions/update_observer.h" |
35 #include "chrome/common/extensions/extension.h" | 35 #include "chrome/common/extensions/extension.h" |
36 #include "chrome/common/extensions/extension_constants.h" | 36 #include "chrome/common/extensions/extension_constants.h" |
37 #include "chrome/common/extensions/extension_set.h" | 37 #include "chrome/common/extensions/extension_set.h" |
38 #include "chrome/common/extensions/manifest.h" | 38 #include "chrome/common/extensions/manifest.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 "sync/api/string_ordinal.h" | 42 #include "sync/api/string_ordinal.h" |
42 #include "sync/api/sync_change.h" | 43 #include "sync/api/sync_change.h" |
43 #include "sync/api/syncable_service.h" | 44 #include "sync/api/syncable_service.h" |
44 | 45 |
45 class CommandLine; | 46 class CommandLine; |
46 class ExtensionErrorUI; | 47 class ExtensionErrorUI; |
47 class ExtensionSyncData; | 48 class ExtensionSyncData; |
48 class ExtensionToolbarModel; | 49 class ExtensionToolbarModel; |
49 class GURL; | 50 class GURL; |
50 class Profile; | 51 class Profile; |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 const std::string& extension_id); | 193 const std::string& extension_id); |
193 | 194 |
194 // Constructor stores pointers to |profile| and |extension_prefs| but | 195 // Constructor stores pointers to |profile| and |extension_prefs| but |
195 // ownership remains at caller. | 196 // ownership remains at caller. |
196 ExtensionService(Profile* profile, | 197 ExtensionService(Profile* profile, |
197 const CommandLine* command_line, | 198 const CommandLine* command_line, |
198 const base::FilePath& install_directory, | 199 const base::FilePath& install_directory, |
199 extensions::ExtensionPrefs* extension_prefs, | 200 extensions::ExtensionPrefs* extension_prefs, |
200 extensions::Blacklist* blacklist, | 201 extensions::Blacklist* blacklist, |
201 bool autoupdate_enabled, | 202 bool autoupdate_enabled, |
202 bool extensions_enabled); | 203 bool extensions_enabled, |
| 204 extensions::OneShotEvent* ready); |
203 | 205 |
204 virtual ~ExtensionService(); | 206 virtual ~ExtensionService(); |
205 | 207 |
206 // Gets the list of currently installed extensions. | 208 // Gets the list of currently installed extensions. |
207 virtual const ExtensionSet* extensions() const OVERRIDE; | 209 virtual const ExtensionSet* extensions() const OVERRIDE; |
208 virtual const ExtensionSet* disabled_extensions() const OVERRIDE; | 210 virtual const ExtensionSet* disabled_extensions() const OVERRIDE; |
209 const ExtensionSet* terminated_extensions() const; | 211 const ExtensionSet* terminated_extensions() const; |
210 const ExtensionSet* blacklisted_extensions() const; | 212 const ExtensionSet* blacklisted_extensions() const; |
211 | 213 |
212 // Returns a set of all installed, disabled, blacklisted, and terminated | 214 // Returns a set of all installed, disabled, blacklisted, and terminated |
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
697 | 699 |
698 struct NaClModuleInfo { | 700 struct NaClModuleInfo { |
699 NaClModuleInfo(); | 701 NaClModuleInfo(); |
700 ~NaClModuleInfo(); | 702 ~NaClModuleInfo(); |
701 | 703 |
702 GURL url; | 704 GURL url; |
703 std::string mime_type; | 705 std::string mime_type; |
704 }; | 706 }; |
705 typedef std::list<NaClModuleInfo> NaClModuleInfoList; | 707 typedef std::list<NaClModuleInfo> NaClModuleInfoList; |
706 | 708 |
707 // Sets the ready_ flag and sends a notification to the listeners. | 709 // Signals *ready_ and sends a notification to the listeners. |
708 void SetReadyAndNotifyListeners(); | 710 void SetReadyAndNotifyListeners(); |
709 | 711 |
710 // Return true if the sync type of |extension| matches |type|. | 712 // Return true if the sync type of |extension| matches |type|. |
711 bool IsCorrectSyncType(const extensions::Extension& extension, | 713 bool IsCorrectSyncType(const extensions::Extension& extension, |
712 syncer::ModelType type) | 714 syncer::ModelType type) |
713 const; | 715 const; |
714 | 716 |
715 void OnExtensionInstallPrefChanged(); | 717 void OnExtensionInstallPrefChanged(); |
716 | 718 |
717 // Handles setting the extension specific values in |extension_sync_data| to | 719 // Handles setting the extension specific values in |extension_sync_data| to |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
892 // Whether to notify users when they attempt to install an extension. | 894 // Whether to notify users when they attempt to install an extension. |
893 bool show_extensions_prompts_; | 895 bool show_extensions_prompts_; |
894 | 896 |
895 // Whether to delay installing of extension updates until the extension is | 897 // Whether to delay installing of extension updates until the extension is |
896 // idle. | 898 // idle. |
897 bool install_updates_when_idle_; | 899 bool install_updates_when_idle_; |
898 | 900 |
899 // Used by dispatchers to limit API quota for individual extensions. | 901 // Used by dispatchers to limit API quota for individual extensions. |
900 ExtensionsQuotaService quota_service_; | 902 ExtensionsQuotaService quota_service_; |
901 | 903 |
902 // Record that Init() has been called, and chrome::EXTENSIONS_READY | 904 // Signaled when all extensions are loaded. |
903 // has fired. | 905 extensions::OneShotEvent* const ready_; |
904 bool ready_; | |
905 | 906 |
906 // Our extension updater, if updates are turned on. | 907 // Our extension updater, if updates are turned on. |
907 scoped_ptr<extensions::ExtensionUpdater> updater_; | 908 scoped_ptr<extensions::ExtensionUpdater> updater_; |
908 | 909 |
909 // The model that tracks extensions with BrowserAction buttons. | 910 // The model that tracks extensions with BrowserAction buttons. |
910 ExtensionToolbarModel toolbar_model_; | 911 ExtensionToolbarModel toolbar_model_; |
911 | 912 |
912 // Map unloaded extensions' ids to their paths. When a temporarily loaded | 913 // Map unloaded extensions' ids to their paths. When a temporarily loaded |
913 // extension is unloaded, we lose the information about it and don't have | 914 // extension is unloaded, we lose the information about it and don't have |
914 // any in the extension preferences file. | 915 // any in the extension preferences file. |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
997 ObserverList<extensions::UpdateObserver, true> update_observers_; | 998 ObserverList<extensions::UpdateObserver, true> update_observers_; |
998 | 999 |
999 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 1000 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
1000 InstallAppsWithUnlimtedStorage); | 1001 InstallAppsWithUnlimtedStorage); |
1001 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 1002 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
1002 InstallAppsAndCheckStorageProtection); | 1003 InstallAppsAndCheckStorageProtection); |
1003 DISALLOW_COPY_AND_ASSIGN(ExtensionService); | 1004 DISALLOW_COPY_AND_ASSIGN(ExtensionService); |
1004 }; | 1005 }; |
1005 | 1006 |
1006 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ | 1007 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ |
OLD | NEW |