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 30 matching lines...) Expand all Loading... |
41 #include "chrome/common/extensions/extension_constants.h" | 41 #include "chrome/common/extensions/extension_constants.h" |
42 #include "chrome/common/extensions/extension_set.h" | 42 #include "chrome/common/extensions/extension_set.h" |
43 #include "content/public/browser/browser_thread.h" | 43 #include "content/public/browser/browser_thread.h" |
44 #include "content/public/browser/notification_observer.h" | 44 #include "content/public/browser/notification_observer.h" |
45 #include "content/public/browser/notification_registrar.h" | 45 #include "content/public/browser/notification_registrar.h" |
46 #include "sync/api/sync_change.h" | 46 #include "sync/api/sync_change.h" |
47 #include "sync/api/syncable_service.h" | 47 #include "sync/api/syncable_service.h" |
48 | 48 |
49 class AppNotificationManager; | 49 class AppNotificationManager; |
50 class BookmarkExtensionEventRouter; | 50 class BookmarkExtensionEventRouter; |
51 class CrxInstaller; | |
52 class ExtensionErrorUI; | 51 class ExtensionErrorUI; |
53 class ExtensionFontSettingsEventRouter; | 52 class ExtensionFontSettingsEventRouter; |
54 class ExtensionManagementEventRouter; | 53 class ExtensionManagementEventRouter; |
55 class ExtensionPreferenceEventRouter; | 54 class ExtensionPreferenceEventRouter; |
56 class ExtensionSyncData; | 55 class ExtensionSyncData; |
57 class ExtensionToolbarModel; | 56 class ExtensionToolbarModel; |
58 class HistoryExtensionEventRouter; | 57 class HistoryExtensionEventRouter; |
59 class GURL; | 58 class GURL; |
60 class PendingExtensionManager; | 59 class PendingExtensionManager; |
61 class Profile; | 60 class Profile; |
62 class Version; | 61 class Version; |
63 | 62 |
64 namespace chromeos { | 63 namespace chromeos { |
65 class ExtensionBluetoothEventRouter; | 64 class ExtensionBluetoothEventRouter; |
66 class ExtensionInputMethodEventRouter; | 65 class ExtensionInputMethodEventRouter; |
67 } | 66 } |
68 | 67 |
69 namespace extensions { | 68 namespace extensions { |
70 class AppSyncData; | 69 class AppSyncData; |
71 class BrowserEventRouter; | 70 class BrowserEventRouter; |
72 class ComponentLoader; | 71 class ComponentLoader; |
73 class ContentSettingsStore; | 72 class ContentSettingsStore; |
| 73 class CrxInstaller; |
74 class Extension; | 74 class Extension; |
75 class ExtensionCookiesEventRouter; | 75 class ExtensionCookiesEventRouter; |
76 class ExtensionManagedModeEventRouter; | 76 class ExtensionManagedModeEventRouter; |
77 class ExtensionSyncData; | 77 class ExtensionSyncData; |
78 class ExtensionSystem; | 78 class ExtensionSystem; |
79 class ExtensionUpdater; | 79 class ExtensionUpdater; |
80 class SettingsFrontend; | 80 class SettingsFrontend; |
81 class WebNavigationEventRouter; | 81 class WebNavigationEventRouter; |
82 class WindowEventRouter; | 82 class WindowEventRouter; |
83 } | 83 } |
84 | 84 |
85 namespace syncer { | 85 namespace syncer { |
86 class SyncData; | 86 class SyncData; |
87 class SyncErrorFactory; | 87 class SyncErrorFactory; |
88 } | 88 } |
89 | 89 |
| 90 namespace syncer { |
| 91 class SyncData; |
| 92 class SyncErrorFactory; |
| 93 } |
| 94 |
90 // This is an interface class to encapsulate the dependencies that | 95 // This is an interface class to encapsulate the dependencies that |
91 // various classes have on ExtensionService. This allows easy mocking. | 96 // various classes have on ExtensionService. This allows easy mocking. |
92 class ExtensionServiceInterface : public syncer::SyncableService { | 97 class ExtensionServiceInterface : public syncer::SyncableService { |
93 public: | 98 public: |
94 // A function that returns true if the given extension should be | 99 // A function that returns true if the given extension should be |
95 // included and false if it should be filtered out. Identical to | 100 // included and false if it should be filtered out. Identical to |
96 // PendingExtensionInfo::ShouldAllowInstallPredicate. | 101 // PendingExtensionInfo::ShouldAllowInstallPredicate. |
97 typedef bool (*ExtensionFilter)(const extensions::Extension&); | 102 typedef bool (*ExtensionFilter)(const extensions::Extension&); |
98 | 103 |
99 virtual ~ExtensionServiceInterface() {} | 104 virtual ~ExtensionServiceInterface() {} |
100 virtual const ExtensionSet* extensions() const = 0; | 105 virtual const ExtensionSet* extensions() const = 0; |
101 virtual const ExtensionSet* disabled_extensions() const = 0; | 106 virtual const ExtensionSet* disabled_extensions() const = 0; |
102 virtual PendingExtensionManager* pending_extension_manager() = 0; | 107 virtual PendingExtensionManager* pending_extension_manager() = 0; |
103 | 108 |
104 // Install an update. Return true if the install can be started. | 109 // Install an update. Return true if the install can be started. |
105 // Set out_crx_installer to the installer if one was started. | 110 // Set out_crx_installer to the installer if one was started. |
106 virtual bool UpdateExtension( | 111 virtual bool UpdateExtension( |
107 const std::string& id, | 112 const std::string& id, |
108 const FilePath& path, | 113 const FilePath& path, |
109 const GURL& download_url, | 114 const GURL& download_url, |
110 CrxInstaller** out_crx_installer) = 0; | 115 extensions::CrxInstaller** out_crx_installer) = 0; |
111 virtual const extensions::Extension* GetExtensionById(const std::string& id, | 116 virtual const extensions::Extension* GetExtensionById(const std::string& id, |
112 bool include_disabled) const = 0; | 117 bool include_disabled) const = 0; |
113 virtual const extensions::Extension* GetInstalledExtension( | 118 virtual const extensions::Extension* GetInstalledExtension( |
114 const std::string& id) const = 0; | 119 const std::string& id) const = 0; |
115 | 120 |
116 virtual bool IsExtensionEnabled(const std::string& extension_id) const = 0; | 121 virtual bool IsExtensionEnabled(const std::string& extension_id) const = 0; |
117 virtual bool IsExternalExtensionUninstalled( | 122 virtual bool IsExternalExtensionUninstalled( |
118 const std::string& extension_id) const = 0; | 123 const std::string& extension_id) const = 0; |
119 | 124 |
120 virtual void UpdateExtensionBlacklist( | 125 virtual void UpdateExtensionBlacklist( |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 const std::string& id) const OVERRIDE; | 311 const std::string& id) const OVERRIDE; |
307 | 312 |
308 // Updates a currently-installed extension with the contents from | 313 // Updates a currently-installed extension with the contents from |
309 // |extension_path|. | 314 // |extension_path|. |
310 // TODO(aa): This method can be removed. ExtensionUpdater could use | 315 // TODO(aa): This method can be removed. ExtensionUpdater could use |
311 // CrxInstaller directly instead. | 316 // CrxInstaller directly instead. |
312 virtual bool UpdateExtension( | 317 virtual bool UpdateExtension( |
313 const std::string& id, | 318 const std::string& id, |
314 const FilePath& extension_path, | 319 const FilePath& extension_path, |
315 const GURL& download_url, | 320 const GURL& download_url, |
316 CrxInstaller** out_crx_installer) OVERRIDE; | 321 extensions::CrxInstaller** out_crx_installer) OVERRIDE; |
317 | 322 |
318 // Reloads the specified extension. | 323 // Reloads the specified extension. |
319 void ReloadExtension(const std::string& extension_id); | 324 void ReloadExtension(const std::string& extension_id); |
320 | 325 |
321 // Uninstalls the specified extension. Callers should only call this method | 326 // Uninstalls the specified extension. Callers should only call this method |
322 // with extensions that exist. |external_uninstall| is a magical parameter | 327 // with extensions that exist. |external_uninstall| is a magical parameter |
323 // that is only used to send information to ExtensionPrefs, which external | 328 // that is only used to send information to ExtensionPrefs, which external |
324 // callers should never set to true. | 329 // callers should never set to true. |
325 // | 330 // |
326 // We pass the |extension_id| by value to avoid having it deleted from under | 331 // We pass the |extension_id| by value to avoid having it deleted from under |
(...skipping 526 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
853 scoped_ptr<ExtensionErrorUI> extension_error_ui_; | 858 scoped_ptr<ExtensionErrorUI> extension_error_ui_; |
854 | 859 |
855 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 860 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
856 InstallAppsWithUnlimtedStorage); | 861 InstallAppsWithUnlimtedStorage); |
857 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 862 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
858 InstallAppsAndCheckStorageProtection); | 863 InstallAppsAndCheckStorageProtection); |
859 DISALLOW_COPY_AND_ASSIGN(ExtensionService); | 864 DISALLOW_COPY_AND_ASSIGN(ExtensionService); |
860 }; | 865 }; |
861 | 866 |
862 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ | 867 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ |
OLD | NEW |