Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <map> | 9 #include <map> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 32 #include "chrome/browser/prefs/pref_change_registrar.h" | 32 #include "chrome/browser/prefs/pref_change_registrar.h" |
| 33 #include "chrome/common/extensions/extension.h" | 33 #include "chrome/common/extensions/extension.h" |
| 34 #include "content/browser/browser_thread.h" | 34 #include "content/browser/browser_thread.h" |
| 35 #include "content/common/notification_observer.h" | 35 #include "content/common/notification_observer.h" |
| 36 #include "content/common/notification_registrar.h" | 36 #include "content/common/notification_registrar.h" |
| 37 #include "content/common/property_bag.h" | 37 #include "content/common/property_bag.h" |
| 38 | 38 |
| 39 class ExtensionBrowserEventRouter; | 39 class ExtensionBrowserEventRouter; |
| 40 class ExtensionPreferenceEventRouter; | 40 class ExtensionPreferenceEventRouter; |
| 41 class ExtensionServiceBackend; | 41 class ExtensionServiceBackend; |
| 42 class ExtensionSyncData; | |
| 42 class ExtensionToolbarModel; | 43 class ExtensionToolbarModel; |
| 43 class ExtensionUpdater; | 44 class ExtensionUpdater; |
| 44 class GURL; | 45 class GURL; |
| 45 class PendingExtensionManager; | 46 class PendingExtensionManager; |
| 46 class Profile; | 47 class Profile; |
| 47 class Version; | 48 class Version; |
| 48 | 49 |
| 49 // This is an interface class to encapsulate the dependencies that | 50 // This is an interface class to encapsulate the dependencies that |
| 50 // various classes have on ExtensionService. This allows easy mocking. | 51 // various classes have on ExtensionService. This allows easy mocking. |
| 51 class ExtensionServiceInterface { | 52 class ExtensionServiceInterface { |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 74 const std::vector<std::string>& blacklist) = 0; | 75 const std::vector<std::string>& blacklist) = 0; |
| 75 virtual void CheckAdminBlacklist() = 0; | 76 virtual void CheckAdminBlacklist() = 0; |
| 76 virtual bool HasInstalledExtensions() = 0; | 77 virtual bool HasInstalledExtensions() = 0; |
| 77 | 78 |
| 78 virtual bool IsIncognitoEnabled(const std::string& extension_id) const = 0; | 79 virtual bool IsIncognitoEnabled(const std::string& extension_id) const = 0; |
| 79 virtual void SetIsIncognitoEnabled(const std::string& extension_id, | 80 virtual void SetIsIncognitoEnabled(const std::string& extension_id, |
| 80 bool enabled) = 0; | 81 bool enabled) = 0; |
| 81 | 82 |
| 82 // Safe to call multiple times in a row. | 83 // Safe to call multiple times in a row. |
| 83 // | 84 // |
| 84 // TODO(akalin): Remove this method (and others) once we add | 85 // TODO(akalin): Remove this method (and others) once we refactor |
| 85 // ProcessSyncData(). | 86 // themes sync to not use it directly. |
| 86 virtual void CheckForUpdatesSoon() = 0; | 87 virtual void CheckForUpdatesSoon() = 0; |
| 88 | |
| 89 // TODO(akalin): We'll eventually need a separate method for app | |
| 90 // sync. | |
|
asargent_no_longer_on_chrome
2011/04/14 23:32:14
Can you a bug for this and link to it here? The bu
akalin
2011/04/15 01:17:11
There are already a couple of bugs filed: added th
| |
| 91 virtual void ProcessSyncData( | |
| 92 const ExtensionSyncData& extension_sync_data) = 0; | |
| 93 | |
| 94 // TODO(akalin): Add a method like: | |
| 95 // virtual void | |
| 96 // GetInitialSyncData(bool (*filter)(Extension), | |
|
asargent_no_longer_on_chrome
2011/04/14 23:32:14
It's not immediately obvious to me what this would
akalin
2011/04/15 01:17:11
Done.
| |
| 97 // map<string, ExtensionSyncData>* out) const; | |
| 87 }; | 98 }; |
| 88 | 99 |
| 89 // Manages installed and running Chromium extensions. | 100 // Manages installed and running Chromium extensions. |
| 90 class ExtensionService | 101 class ExtensionService |
| 91 : public base::RefCountedThreadSafe<ExtensionService, | 102 : public base::RefCountedThreadSafe<ExtensionService, |
| 92 BrowserThread::DeleteOnUIThread>, | 103 BrowserThread::DeleteOnUIThread>, |
| 93 public ExtensionServiceInterface, | 104 public ExtensionServiceInterface, |
| 94 public ExternalExtensionProviderInterface::VisitorInterface, | 105 public ExternalExtensionProviderInterface::VisitorInterface, |
| 95 public NotificationObserver { | 106 public NotificationObserver { |
| 96 public: | 107 public: |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 338 virtual void UpdateExtensionBlacklist( | 349 virtual void UpdateExtensionBlacklist( |
| 339 const std::vector<std::string>& blacklist); | 350 const std::vector<std::string>& blacklist); |
| 340 | 351 |
| 341 // Go through each extension and unload those that the network admin has | 352 // Go through each extension and unload those that the network admin has |
| 342 // put on the blacklist (not to be confused with the Google managed blacklist | 353 // put on the blacklist (not to be confused with the Google managed blacklist |
| 343 // set of extensions. | 354 // set of extensions. |
| 344 virtual void CheckAdminBlacklist(); | 355 virtual void CheckAdminBlacklist(); |
| 345 | 356 |
| 346 virtual void CheckForUpdatesSoon(); | 357 virtual void CheckForUpdatesSoon(); |
| 347 | 358 |
| 359 virtual void ProcessSyncData( | |
| 360 const ExtensionSyncData& extension_sync_data); | |
|
asargent_no_longer_on_chrome
2011/04/14 23:32:14
Please include a comment describing what the metho
akalin
2011/04/15 01:17:11
Done, but added it to the interface method (might
| |
| 361 | |
| 348 void set_extensions_enabled(bool enabled) { extensions_enabled_ = enabled; } | 362 void set_extensions_enabled(bool enabled) { extensions_enabled_ = enabled; } |
| 349 bool extensions_enabled() { return extensions_enabled_; } | 363 bool extensions_enabled() { return extensions_enabled_; } |
| 350 | 364 |
| 351 void set_show_extensions_prompts(bool enabled) { | 365 void set_show_extensions_prompts(bool enabled) { |
| 352 show_extensions_prompts_ = enabled; | 366 show_extensions_prompts_ = enabled; |
| 353 } | 367 } |
| 354 | 368 |
| 355 bool show_extensions_prompts() { | 369 bool show_extensions_prompts() { |
| 356 return show_extensions_prompts_; | 370 return show_extensions_prompts_; |
| 357 } | 371 } |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 581 bool external_extension_url_added_; | 595 bool external_extension_url_added_; |
| 582 | 596 |
| 583 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 597 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
| 584 InstallAppsWithUnlimtedStorage); | 598 InstallAppsWithUnlimtedStorage); |
| 585 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 599 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
| 586 InstallAppsAndCheckStorageProtection); | 600 InstallAppsAndCheckStorageProtection); |
| 587 DISALLOW_COPY_AND_ASSIGN(ExtensionService); | 601 DISALLOW_COPY_AND_ASSIGN(ExtensionService); |
| 588 }; | 602 }; |
| 589 | 603 |
| 590 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ | 604 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ |
| OLD | NEW |