| 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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 virtual base::SequencedTaskRunner* GetFileTaskRunner() = 0; | 120 virtual base::SequencedTaskRunner* GetFileTaskRunner() = 0; |
| 121 }; | 121 }; |
| 122 | 122 |
| 123 // Manages installed and running Chromium extensions. | 123 // Manages installed and running Chromium extensions. |
| 124 class ExtensionService | 124 class ExtensionService |
| 125 : public ExtensionServiceInterface, | 125 : public ExtensionServiceInterface, |
| 126 public extensions::ExternalProviderInterface::VisitorInterface, | 126 public extensions::ExternalProviderInterface::VisitorInterface, |
| 127 public content::NotificationObserver, | 127 public content::NotificationObserver, |
| 128 public extensions::Blacklist::Observer { | 128 public extensions::Blacklist::Observer { |
| 129 public: | 129 public: |
| 130 // Returns the Extension of an extension from a given url or NULL if the url | 130 // Returns the Extension for a given url or NULL if the url doesn't belong to |
| 131 // doesn't belong to an installed extension. This may be a hosted app extent | 131 // an installed extension. This may be a hosted app extent or a |
| 132 // or a chrome-extension:// url. | 132 // chrome-extension:// url. |
| 133 const extensions::Extension* GetInstalledExtensionByUrl( | 133 const extensions::Extension* GetInstalledExtensionByUrl( |
| 134 const GURL& url) const; | 134 const GURL& url) const; |
| 135 | 135 |
| 136 // Returns the Extension of hosted or packaged apps, NULL otherwise. | 136 // Returns the Extension of hosted or packaged apps, NULL otherwise. |
| 137 const extensions::Extension* GetInstalledApp(const GURL& url) const; | 137 const extensions::Extension* GetInstalledApp(const GURL& url) const; |
| 138 | 138 |
| 139 // Returns whether the URL is from either a hosted or packaged app. | 139 // Returns whether the URL is from either a hosted or packaged app. |
| 140 bool IsInstalledApp(const GURL& url) const; | 140 bool IsInstalledApp(const GURL& url) const; |
| 141 | 141 |
| 142 // Attempts to uninstall an extension from a given ExtensionService. Returns | 142 // Attempts to uninstall an extension from a given ExtensionService. Returns |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 202 | 202 |
| 203 // Getter and setter for the flag that specifies if the extension has used | 203 // Getter and setter for the flag that specifies if the extension has used |
| 204 // the webrequest API. | 204 // the webrequest API. |
| 205 // TODO(mpcomplete): remove. http://crbug.com/100411 | 205 // TODO(mpcomplete): remove. http://crbug.com/100411 |
| 206 bool HasUsedWebRequest(const extensions::Extension* extension) const; | 206 bool HasUsedWebRequest(const extensions::Extension* extension) const; |
| 207 void SetHasUsedWebRequest(const extensions::Extension* extension, bool value); | 207 void SetHasUsedWebRequest(const extensions::Extension* extension, bool value); |
| 208 | 208 |
| 209 // Initialize and start all installed extensions. | 209 // Initialize and start all installed extensions. |
| 210 void Init(); | 210 void Init(); |
| 211 | 211 |
| 212 // Attempts to verify all extensions using the InstallVerifier. |
| 213 void VerifyAllExtensions(); |
| 214 |
| 215 // Once the verifier work is finished, we may want to re-check management |
| 216 // policy if |success| indicates the verifier got a new signature back. |
| 217 void FinishVerifyAllExtensions(bool success); |
| 218 |
| 212 // Called when the associated Profile is going to be destroyed. | 219 // Called when the associated Profile is going to be destroyed. |
| 213 void Shutdown(); | 220 void Shutdown(); |
| 214 | 221 |
| 215 // Look up an extension by ID. Does not include terminated | 222 // Look up an extension by ID. Does not include terminated |
| 216 // extensions. | 223 // extensions. |
| 217 virtual const extensions::Extension* GetExtensionById( | 224 virtual const extensions::Extension* GetExtensionById( |
| 218 const std::string& id, bool include_disabled) const OVERRIDE; | 225 const std::string& id, bool include_disabled) const OVERRIDE; |
| 219 | 226 |
| 220 enum IncludeFlag { | 227 enum IncludeFlag { |
| 221 INCLUDE_NONE = 0, | 228 INCLUDE_NONE = 0, |
| (...skipping 628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 850 #endif | 857 #endif |
| 851 | 858 |
| 852 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 859 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
| 853 InstallAppsWithUnlimtedStorage); | 860 InstallAppsWithUnlimtedStorage); |
| 854 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 861 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
| 855 InstallAppsAndCheckStorageProtection); | 862 InstallAppsAndCheckStorageProtection); |
| 856 DISALLOW_COPY_AND_ASSIGN(ExtensionService); | 863 DISALLOW_COPY_AND_ASSIGN(ExtensionService); |
| 857 }; | 864 }; |
| 858 | 865 |
| 859 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ | 866 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ |
| OLD | NEW |