| 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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 class SettingsFrontend; | 82 class SettingsFrontend; |
| 83 class WebNavigationEventRouter; | 83 class WebNavigationEventRouter; |
| 84 class WindowEventRouter; | 84 class WindowEventRouter; |
| 85 } | 85 } |
| 86 | 86 |
| 87 namespace syncer { | 87 namespace syncer { |
| 88 class SyncData; | 88 class SyncData; |
| 89 class SyncErrorFactory; | 89 class SyncErrorFactory; |
| 90 } | 90 } |
| 91 | 91 |
| 92 typedef std::map<std::string, FilePath> UnloadedExtensionPathMap; |
| 93 |
| 92 // This is an interface class to encapsulate the dependencies that | 94 // This is an interface class to encapsulate the dependencies that |
| 93 // various classes have on ExtensionService. This allows easy mocking. | 95 // various classes have on ExtensionService. This allows easy mocking. |
| 94 class ExtensionServiceInterface : public syncer::SyncableService { | 96 class ExtensionServiceInterface : public syncer::SyncableService { |
| 95 public: | 97 public: |
| 96 // A function that returns true if the given extension should be | 98 // A function that returns true if the given extension should be |
| 97 // included and false if it should be filtered out. Identical to | 99 // included and false if it should be filtered out. Identical to |
| 98 // PendingExtensionInfo::ShouldAllowInstallPredicate. | 100 // PendingExtensionInfo::ShouldAllowInstallPredicate. |
| 99 typedef bool (*ExtensionFilter)(const extensions::Extension&); | 101 typedef bool (*ExtensionFilter)(const extensions::Extension&); |
| 100 | 102 |
| 101 virtual ~ExtensionServiceInterface() {} | 103 virtual ~ExtensionServiceInterface() {} |
| (...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 std::vector<extensions::AppSyncData> GetAppSyncDataList() const; | 452 std::vector<extensions::AppSyncData> GetAppSyncDataList() const; |
| 451 | 453 |
| 452 // Applies the change specified passed in by either ExtensionSyncData or | 454 // Applies the change specified passed in by either ExtensionSyncData or |
| 453 // AppSyncData to the current system. | 455 // AppSyncData to the current system. |
| 454 // Returns false if the changes were not completely applied and were added | 456 // Returns false if the changes were not completely applied and were added |
| 455 // to the pending list to be tried again. | 457 // to the pending list to be tried again. |
| 456 bool ProcessExtensionSyncData( | 458 bool ProcessExtensionSyncData( |
| 457 const extensions::ExtensionSyncData& extension_sync_data); | 459 const extensions::ExtensionSyncData& extension_sync_data); |
| 458 bool ProcessAppSyncData(const extensions::AppSyncData& app_sync_data); | 460 bool ProcessAppSyncData(const extensions::AppSyncData& app_sync_data); |
| 459 | 461 |
| 460 | |
| 461 void set_extensions_enabled(bool enabled) { extensions_enabled_ = enabled; } | 462 void set_extensions_enabled(bool enabled) { extensions_enabled_ = enabled; } |
| 462 bool extensions_enabled() { return extensions_enabled_; } | 463 bool extensions_enabled() { return extensions_enabled_; } |
| 463 | 464 |
| 464 void set_show_extensions_prompts(bool enabled) { | 465 void set_show_extensions_prompts(bool enabled) { |
| 465 show_extensions_prompts_ = enabled; | 466 show_extensions_prompts_ = enabled; |
| 466 } | 467 } |
| 467 | 468 |
| 468 bool show_extensions_prompts() { | 469 bool show_extensions_prompts() { |
| 469 return show_extensions_prompts_; | 470 return show_extensions_prompts_; |
| 470 } | 471 } |
| 471 | 472 |
| 473 const UnloadedExtensionPathMap& unloaded_extension_paths() const { |
| 474 return unloaded_extension_paths_; |
| 475 } |
| 476 |
| 472 Profile* profile(); | 477 Profile* profile(); |
| 473 | 478 |
| 474 // TODO(skerner): Change to const ExtensionPrefs& extension_prefs() const, | 479 // TODO(skerner): Change to const ExtensionPrefs& extension_prefs() const, |
| 475 // ExtensionPrefs* mutable_extension_prefs(). | 480 // ExtensionPrefs* mutable_extension_prefs(). |
| 476 extensions::ExtensionPrefs* extension_prefs(); | 481 extensions::ExtensionPrefs* extension_prefs(); |
| 477 | 482 |
| 478 extensions::SettingsFrontend* settings_frontend(); | 483 extensions::SettingsFrontend* settings_frontend(); |
| 479 | 484 |
| 480 extensions::ContentSettingsStore* GetContentSettingsStore(); | 485 extensions::ContentSettingsStore* GetContentSettingsStore(); |
| 481 | 486 |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 761 | 766 |
| 762 // Our extension updater, if updates are turned on. | 767 // Our extension updater, if updates are turned on. |
| 763 scoped_ptr<extensions::ExtensionUpdater> updater_; | 768 scoped_ptr<extensions::ExtensionUpdater> updater_; |
| 764 | 769 |
| 765 // The model that tracks extensions with BrowserAction buttons. | 770 // The model that tracks extensions with BrowserAction buttons. |
| 766 ExtensionToolbarModel toolbar_model_; | 771 ExtensionToolbarModel toolbar_model_; |
| 767 | 772 |
| 768 // Map unloaded extensions' ids to their paths. When a temporarily loaded | 773 // Map unloaded extensions' ids to their paths. When a temporarily loaded |
| 769 // extension is unloaded, we lose the information about it and don't have | 774 // extension is unloaded, we lose the information about it and don't have |
| 770 // any in the extension preferences file. | 775 // any in the extension preferences file. |
| 771 typedef std::map<std::string, FilePath> UnloadedExtensionPathMap; | |
| 772 UnloadedExtensionPathMap unloaded_extension_paths_; | 776 UnloadedExtensionPathMap unloaded_extension_paths_; |
| 773 | 777 |
| 774 // Map disabled extensions' ids to their paths. When a temporarily loaded | 778 // Map disabled extensions' ids to their paths. When a temporarily loaded |
| 775 // extension is disabled before it is reloaded, keep track of the path so that | 779 // extension is disabled before it is reloaded, keep track of the path so that |
| 776 // it can be re-enabled upon a successful load. | 780 // it can be re-enabled upon a successful load. |
| 777 typedef std::map<std::string, FilePath> DisabledExtensionPathMap; | 781 typedef std::map<std::string, FilePath> DisabledExtensionPathMap; |
| 778 DisabledExtensionPathMap disabled_extension_paths_; | 782 DisabledExtensionPathMap disabled_extension_paths_; |
| 779 | 783 |
| 780 // Map of inspector cookies that are detached, waiting for an extension to be | 784 // Map of inspector cookies that are detached, waiting for an extension to be |
| 781 // reloaded. | 785 // reloaded. |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 863 #endif | 867 #endif |
| 864 | 868 |
| 865 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 869 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
| 866 InstallAppsWithUnlimtedStorage); | 870 InstallAppsWithUnlimtedStorage); |
| 867 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 871 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
| 868 InstallAppsAndCheckStorageProtection); | 872 InstallAppsAndCheckStorageProtection); |
| 869 DISALLOW_COPY_AND_ASSIGN(ExtensionService); | 873 DISALLOW_COPY_AND_ASSIGN(ExtensionService); |
| 870 }; | 874 }; |
| 871 | 875 |
| 872 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ | 876 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ |
| OLD | NEW |