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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 public: | 81 public: |
82 virtual ~ExtensionUpdateService() {} | 82 virtual ~ExtensionUpdateService() {} |
83 virtual const ExtensionList* extensions() const = 0; | 83 virtual const ExtensionList* extensions() const = 0; |
84 virtual const PendingExtensionMap& pending_extensions() const = 0; | 84 virtual const PendingExtensionMap& pending_extensions() const = 0; |
85 virtual void UpdateExtension(const std::string& id, const FilePath& path, | 85 virtual void UpdateExtension(const std::string& id, const FilePath& path, |
86 const GURL& download_url) = 0; | 86 const GURL& download_url) = 0; |
87 virtual Extension* GetExtensionById(const std::string& id, | 87 virtual Extension* GetExtensionById(const std::string& id, |
88 bool include_disabled) = 0; | 88 bool include_disabled) = 0; |
89 virtual void UpdateExtensionBlacklist( | 89 virtual void UpdateExtensionBlacklist( |
90 const std::vector<std::string>& blacklist) = 0; | 90 const std::vector<std::string>& blacklist) = 0; |
| 91 virtual void CheckAdminBlacklist() = 0; |
91 virtual bool HasInstalledExtensions() = 0; | 92 virtual bool HasInstalledExtensions() = 0; |
92 | 93 |
93 virtual ExtensionPrefs* extension_prefs() = 0; | 94 virtual ExtensionPrefs* extension_prefs() = 0; |
94 }; | 95 }; |
95 | 96 |
96 // Manages installed and running Chromium extensions. | 97 // Manages installed and running Chromium extensions. |
97 class ExtensionsService | 98 class ExtensionsService |
98 : public base::RefCountedThreadSafe<ExtensionsService, | 99 : public base::RefCountedThreadSafe<ExtensionsService, |
99 ChromeThread::DeleteOnUIThread>, | 100 ChromeThread::DeleteOnUIThread>, |
100 public ExtensionUpdateService, | 101 public ExtensionUpdateService, |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 void OnExternalExtensionFileFound(const std::string& id, | 314 void OnExternalExtensionFileFound(const std::string& id, |
314 const std::string& version, | 315 const std::string& version, |
315 const FilePath& path, | 316 const FilePath& path, |
316 Extension::Location location); | 317 Extension::Location location); |
317 | 318 |
318 // Go through each extensions in pref, unload blacklisted extensions | 319 // Go through each extensions in pref, unload blacklisted extensions |
319 // and update the blacklist state in pref. | 320 // and update the blacklist state in pref. |
320 virtual void UpdateExtensionBlacklist( | 321 virtual void UpdateExtensionBlacklist( |
321 const std::vector<std::string>& blacklist); | 322 const std::vector<std::string>& blacklist); |
322 | 323 |
| 324 // Go through each extension and unload those that the network admin has |
| 325 // put on the blacklist (not to be confused with the Google managed blacklist |
| 326 // set of extensions. |
| 327 virtual void CheckAdminBlacklist(); |
| 328 |
323 void set_extensions_enabled(bool enabled) { extensions_enabled_ = enabled; } | 329 void set_extensions_enabled(bool enabled) { extensions_enabled_ = enabled; } |
324 bool extensions_enabled() { return extensions_enabled_; } | 330 bool extensions_enabled() { return extensions_enabled_; } |
325 | 331 |
326 void set_show_extensions_prompts(bool enabled) { | 332 void set_show_extensions_prompts(bool enabled) { |
327 show_extensions_prompts_ = enabled; | 333 show_extensions_prompts_ = enabled; |
328 } | 334 } |
329 | 335 |
330 bool show_extensions_prompts() { | 336 bool show_extensions_prompts() { |
331 return show_extensions_prompts_; | 337 return show_extensions_prompts_; |
332 } | 338 } |
333 | 339 |
334 Profile* profile() { return profile_; } | 340 Profile* profile() { return profile_; } |
335 | 341 |
336 // Profile calls this when it is destroyed so that we know not to call it. | 342 // Profile calls this when it is being destroyed so that we know not to call |
337 void ProfileDestroyed() { profile_ = NULL; } | 343 // it. |
| 344 void DestroyingProfile(); |
338 | 345 |
339 ExtensionPrefs* extension_prefs() { return extension_prefs_.get(); } | 346 ExtensionPrefs* extension_prefs() { return extension_prefs_.get(); } |
340 | 347 |
341 // Whether the extension service is ready. | 348 // Whether the extension service is ready. |
342 bool is_ready() { return ready_; } | 349 bool is_ready() { return ready_; } |
343 | 350 |
344 // Note that this may return NULL if autoupdate is not turned on. | 351 // Note that this may return NULL if autoupdate is not turned on. |
345 ExtensionUpdater* updater() { return updater_.get(); } | 352 ExtensionUpdater* updater() { return updater_.get(); } |
346 | 353 |
347 ExtensionToolbarModel* toolbar_model() { return &toolbar_model_; } | 354 ExtensionToolbarModel* toolbar_model() { return &toolbar_model_; } |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
589 | 596 |
590 // Set to true by OnExternalExtensionUpdateUrlFound() when an external | 597 // Set to true by OnExternalExtensionUpdateUrlFound() when an external |
591 // extension URL is found. Used in CheckForExternalUpdates() to see | 598 // extension URL is found. Used in CheckForExternalUpdates() to see |
592 // if an update check is needed to install pending extensions. | 599 // if an update check is needed to install pending extensions. |
593 bool external_extension_added_; | 600 bool external_extension_added_; |
594 | 601 |
595 DISALLOW_COPY_AND_ASSIGN(ExtensionsServiceBackend); | 602 DISALLOW_COPY_AND_ASSIGN(ExtensionsServiceBackend); |
596 }; | 603 }; |
597 | 604 |
598 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_ | 605 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSIONS_SERVICE_H_ |
OLD | NEW |