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