| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_EXTENSIONS_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_ |
| 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <set> | 9 #include <set> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 virtual const ExtensionList* extensions() const = 0; | 72 virtual const ExtensionList* extensions() const = 0; |
| 73 virtual const PendingExtensionMap& pending_extensions() const = 0; | 73 virtual const PendingExtensionMap& pending_extensions() const = 0; |
| 74 virtual void UpdateExtension(const std::string& id, const FilePath& path, | 74 virtual void UpdateExtension(const std::string& id, const FilePath& path, |
| 75 const GURL& download_url) = 0; | 75 const GURL& download_url) = 0; |
| 76 virtual Extension* GetExtensionById(const std::string& id, | 76 virtual Extension* GetExtensionById(const std::string& id, |
| 77 bool include_disabled) = 0; | 77 bool include_disabled) = 0; |
| 78 virtual void UpdateExtensionBlacklist( | 78 virtual void UpdateExtensionBlacklist( |
| 79 const std::vector<std::string>& blacklist) = 0; | 79 const std::vector<std::string>& blacklist) = 0; |
| 80 virtual bool HasInstalledExtensions() = 0; | 80 virtual bool HasInstalledExtensions() = 0; |
| 81 | 81 |
| 82 // These set/get a server-provided time representing the start of the last day | 82 virtual ExtensionPrefs* extension_prefs() = 0; |
| 83 // that we sent the 'ping' parameter during an update check. | |
| 84 virtual void SetLastPingDay(const std::string& extension_id, | |
| 85 const base::Time& time) = 0; | |
| 86 virtual base::Time LastPingDay(const std::string& extension_id) const = 0; | |
| 87 | |
| 88 // Similar to the 2 above, but for the extensions blacklist. | |
| 89 virtual void SetBlacklistLastPingDay(const base::Time& time) = 0; | |
| 90 virtual base::Time BlacklistLastPingDay() const = 0; | |
| 91 }; | 83 }; |
| 92 | 84 |
| 93 // Manages installed and running Chromium extensions. | 85 // Manages installed and running Chromium extensions. |
| 94 class ExtensionsService | 86 class ExtensionsService |
| 95 : public base::RefCountedThreadSafe<ExtensionsService, | 87 : public base::RefCountedThreadSafe<ExtensionsService, |
| 96 ChromeThread::DeleteOnUIThread>, | 88 ChromeThread::DeleteOnUIThread>, |
| 97 public ExtensionUpdateService, | 89 public ExtensionUpdateService, |
| 98 public NotificationObserver { | 90 public NotificationObserver { |
| 99 public: | 91 public: |
| 100 // Information about a registered component extension. | 92 // Information about a registered component extension. |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 // Registers an extension to be loaded as a component extension. | 144 // Registers an extension to be loaded as a component extension. |
| 153 void register_component_extension(const ComponentExtensionInfo& info) { | 145 void register_component_extension(const ComponentExtensionInfo& info) { |
| 154 component_extension_manifests_.push_back(info); | 146 component_extension_manifests_.push_back(info); |
| 155 } | 147 } |
| 156 | 148 |
| 157 // Returns true if any extensions are installed. | 149 // Returns true if any extensions are installed. |
| 158 virtual bool HasInstalledExtensions() { | 150 virtual bool HasInstalledExtensions() { |
| 159 return !(extensions_.empty() && disabled_extensions_.empty()); | 151 return !(extensions_.empty() && disabled_extensions_.empty()); |
| 160 } | 152 } |
| 161 | 153 |
| 162 virtual void SetLastPingDay(const std::string& extension_id, | |
| 163 const base::Time& time); | |
| 164 virtual base::Time LastPingDay(const std::string& extension_id) const; | |
| 165 virtual void SetBlacklistLastPingDay(const base::Time& time); | |
| 166 virtual base::Time BlacklistLastPingDay() const; | |
| 167 | |
| 168 // Whether this extension can run in an incognito window. | 154 // Whether this extension can run in an incognito window. |
| 169 bool IsIncognitoEnabled(const Extension* extension); | 155 bool IsIncognitoEnabled(const Extension* extension); |
| 170 void SetIsIncognitoEnabled(Extension* extension, bool enabled); | 156 void SetIsIncognitoEnabled(Extension* extension, bool enabled); |
| 171 | 157 |
| 172 const FilePath& install_directory() const { return install_directory_; } | 158 const FilePath& install_directory() const { return install_directory_; } |
| 173 | 159 |
| 174 // Initialize and start all installed extensions. | 160 // Initialize and start all installed extensions. |
| 175 void Init(); | 161 void Init(); |
| 176 | 162 |
| 177 // Start up the extension event routers. | 163 // Start up the extension event routers. |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 536 | 522 |
| 537 // A map of all external extension providers. | 523 // A map of all external extension providers. |
| 538 typedef std::map<Extension::Location, | 524 typedef std::map<Extension::Location, |
| 539 linked_ptr<ExternalExtensionProvider> > ProviderMap; | 525 linked_ptr<ExternalExtensionProvider> > ProviderMap; |
| 540 ProviderMap external_extension_providers_; | 526 ProviderMap external_extension_providers_; |
| 541 | 527 |
| 542 DISALLOW_COPY_AND_ASSIGN(ExtensionsServiceBackend); | 528 DISALLOW_COPY_AND_ASSIGN(ExtensionsServiceBackend); |
| 543 }; | 529 }; |
| 544 | 530 |
| 545 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_ | 531 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_ |
| OLD | NEW |