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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <list> | 9 #include <list> |
10 #include <map> | 10 #include <map> |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
58 class ExtensionManagedModeEventRouter; | 58 class ExtensionManagedModeEventRouter; |
59 class ExtensionManagementEventRouter; | 59 class ExtensionManagementEventRouter; |
60 class ExtensionPreferenceEventRouter; | 60 class ExtensionPreferenceEventRouter; |
61 class ExtensionSyncData; | 61 class ExtensionSyncData; |
62 class ExtensionSystem; | 62 class ExtensionSystem; |
63 class ExtensionToolbarModel; | 63 class ExtensionToolbarModel; |
64 class HistoryExtensionEventRouter; | 64 class HistoryExtensionEventRouter; |
65 class GURL; | 65 class GURL; |
66 class PendingExtensionManager; | 66 class PendingExtensionManager; |
67 class Profile; | 67 class Profile; |
68 class SyncData; | |
69 class SyncErrorFactory; | |
70 class Version; | 68 class Version; |
71 | 69 |
72 namespace chromeos { | 70 namespace chromeos { |
73 class ExtensionBluetoothEventRouter; | 71 class ExtensionBluetoothEventRouter; |
74 class ExtensionInputMethodEventRouter; | 72 class ExtensionInputMethodEventRouter; |
75 } | 73 } |
76 | 74 |
75 namespace csync { | |
76 class SyncData; | |
77 class SyncErrorFactory; | |
78 } | |
79 | |
77 namespace extensions { | 80 namespace extensions { |
78 class AppSyncData; | 81 class AppSyncData; |
79 class ComponentLoader; | 82 class ComponentLoader; |
80 class ContentSettingsStore; | 83 class ContentSettingsStore; |
81 class Extension; | 84 class Extension; |
82 class ExtensionCookiesEventRouter; | 85 class ExtensionCookiesEventRouter; |
83 class ExtensionSyncData; | 86 class ExtensionSyncData; |
84 class ExtensionUpdater; | 87 class ExtensionUpdater; |
85 class SettingsFrontend; | 88 class SettingsFrontend; |
86 class WebNavigationEventRouter; | 89 class WebNavigationEventRouter; |
87 } | 90 } |
88 | 91 |
89 // This is an interface class to encapsulate the dependencies that | 92 // This is an interface class to encapsulate the dependencies that |
90 // various classes have on ExtensionService. This allows easy mocking. | 93 // various classes have on ExtensionService. This allows easy mocking. |
91 class ExtensionServiceInterface : public SyncableService { | 94 class ExtensionServiceInterface : public csync::SyncableService { |
92 public: | 95 public: |
93 // A function that returns true if the given extension should be | 96 // A function that returns true if the given extension should be |
94 // included and false if it should be filtered out. Identical to | 97 // included and false if it should be filtered out. Identical to |
95 // PendingExtensionInfo::ShouldAllowInstallPredicate. | 98 // PendingExtensionInfo::ShouldAllowInstallPredicate. |
96 typedef bool (*ExtensionFilter)(const extensions::Extension&); | 99 typedef bool (*ExtensionFilter)(const extensions::Extension&); |
97 | 100 |
98 virtual ~ExtensionServiceInterface() {} | 101 virtual ~ExtensionServiceInterface() {} |
99 virtual const ExtensionSet* extensions() const = 0; | 102 virtual const ExtensionSet* extensions() const = 0; |
100 virtual const ExtensionSet* disabled_extensions() const = 0; | 103 virtual const ExtensionSet* disabled_extensions() const = 0; |
101 virtual PendingExtensionManager* pending_extension_manager() = 0; | 104 virtual PendingExtensionManager* pending_extension_manager() = 0; |
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
410 virtual void UpdateExtensionBlacklist( | 413 virtual void UpdateExtensionBlacklist( |
411 const std::vector<std::string>& blacklist) OVERRIDE; | 414 const std::vector<std::string>& blacklist) OVERRIDE; |
412 | 415 |
413 // Go through each extension and unload those that the network admin has | 416 // Go through each extension and unload those that the network admin has |
414 // put on the blacklist (not to be confused with the Google-managed blacklist) | 417 // put on the blacklist (not to be confused with the Google-managed blacklist) |
415 // set of extensions. | 418 // set of extensions. |
416 virtual void CheckAdminBlacklist() OVERRIDE; | 419 virtual void CheckAdminBlacklist() OVERRIDE; |
417 | 420 |
418 virtual void CheckForUpdatesSoon() OVERRIDE; | 421 virtual void CheckForUpdatesSoon() OVERRIDE; |
419 | 422 |
420 // SyncableService implementation. | 423 // csync::SyncableService implementation. |
421 virtual SyncError MergeDataAndStartSyncing( | 424 virtual csync::SyncError MergeDataAndStartSyncing( |
422 syncable::ModelType type, | 425 syncable::ModelType type, |
423 const SyncDataList& initial_sync_data, | 426 const csync::SyncDataList& initial_sync_data, |
424 scoped_ptr<SyncChangeProcessor> sync_processor, | 427 scoped_ptr<csync::SyncChangeProcessor> sync_processor, |
425 scoped_ptr<SyncErrorFactory> sync_error_factory) OVERRIDE; | 428 scoped_ptr<csync::SyncErrorFactory> sync_error_factory) OVERRIDE; |
426 virtual void StopSyncing(syncable::ModelType type) OVERRIDE; | 429 virtual void StopSyncing(syncable::ModelType type) OVERRIDE; |
427 virtual SyncDataList GetAllSyncData(syncable::ModelType type) const OVERRIDE; | 430 virtual csync::SyncDataList GetAllSyncData( |
428 virtual SyncError ProcessSyncChanges( | 431 syncable::ModelType type) const OVERRIDE; |
432 virtual csync::SyncError ProcessSyncChanges( | |
429 const tracked_objects::Location& from_here, | 433 const tracked_objects::Location& from_here, |
430 const SyncChangeList& change_list) OVERRIDE; | 434 const csync::SyncChangeList& change_list) OVERRIDE; |
431 | 435 |
432 // Gets the sync data for the given extension, assuming that the extension is | 436 // Gets the sync data for the given extension, assuming that the extension is |
433 // syncable. | 437 // syncable. |
434 extensions::ExtensionSyncData GetExtensionSyncData( | 438 extensions::ExtensionSyncData GetExtensionSyncData( |
asargent_no_longer_on_chrome
2012/06/26 18:08:17
nit: double space before GetExtensionSyncData
akalin
2012/06/26 20:28:28
Done.
| |
435 const extensions::Extension& extension) const; | 439 const extensions::Extension& extension) const; |
436 | 440 |
437 // Gets the sync data for the given app, assuming that the app is | 441 // Gets the sync data for the given app, assuming that the app is |
438 // syncable. | 442 // syncable. |
439 extensions::AppSyncData GetAppSyncData( | 443 extensions::AppSyncData GetAppSyncData( |
440 const extensions::Extension& extension) const; | 444 const extensions::Extension& extension) const; |
441 | 445 |
442 // Gets the ExtensionSyncData for all extensions. | 446 // Gets the ExtensionSyncData for all extensions. |
asargent_no_longer_on_chrome
2012/06/26 18:08:17
nit: double space
akalin
2012/06/26 20:28:28
Done.
| |
443 std::vector<extensions::ExtensionSyncData> GetExtensionSyncDataList() const; | 447 std::vector<extensions::ExtensionSyncData> GetExtensionSyncDataList() const; |
444 | 448 |
445 // Gets the AppSyncData for all extensions. | 449 // Gets the AppSyncData for all extensions. |
446 std::vector<extensions::AppSyncData> GetAppSyncDataList() const; | 450 std::vector<extensions::AppSyncData> GetAppSyncDataList() const; |
447 | 451 |
448 // Applies the change specified passed in by either ExtensionSyncData or | 452 // Applies the change specified passed in by either ExtensionSyncData or |
asargent_no_longer_on_chrome
2012/06/26 18:08:17
nit: double space before "or" at end of line
akalin
2012/06/26 20:28:28
Done.
| |
449 // AppSyncData to the current system. | 453 // AppSyncData to the current system. |
450 // Returns false if the changes were not completely applied and were added | 454 // Returns false if the changes were not completely applied and were added |
451 // to the pending list to be tried again. | 455 // to the pending list to be tried again. |
452 bool ProcessExtensionSyncData( | 456 bool ProcessExtensionSyncData( |
453 const extensions::ExtensionSyncData& extension_sync_data); | 457 const extensions::ExtensionSyncData& extension_sync_data); |
454 bool ProcessAppSyncData(const extensions::AppSyncData& app_sync_data); | 458 bool ProcessAppSyncData(const extensions::AppSyncData& app_sync_data); |
455 | 459 |
456 | 460 |
457 void set_extensions_enabled(bool enabled) { extensions_enabled_ = enabled; } | 461 void set_extensions_enabled(bool enabled) { extensions_enabled_ = enabled; } |
458 bool extensions_enabled() { return extensions_enabled_; } | 462 bool extensions_enabled() { return extensions_enabled_; } |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
607 | 611 |
608 ExtensionWarningSet* extension_warnings() { | 612 ExtensionWarningSet* extension_warnings() { |
609 return &extension_warnings_; | 613 return &extension_warnings_; |
610 } | 614 } |
611 | 615 |
612 // Call only from IO thread. | 616 // Call only from IO thread. |
613 extensions::APIResourceController* api_resource_controller(); | 617 extensions::APIResourceController* api_resource_controller(); |
614 | 618 |
615 AppShortcutManager* app_shortcut_manager() { return &app_shortcut_manager_; } | 619 AppShortcutManager* app_shortcut_manager() { return &app_shortcut_manager_; } |
616 | 620 |
617 // Specialization of SyncableService::AsWeakPtr. | 621 // Specialization of csync::SyncableService::AsWeakPtr. |
618 base::WeakPtr<ExtensionService> AsWeakPtr() { return base::AsWeakPtr(this); } | 622 base::WeakPtr<ExtensionService> AsWeakPtr() { return base::AsWeakPtr(this); } |
619 | 623 |
620 private: | 624 private: |
621 // Contains Extension data that can change during the life of the process, | 625 // Contains Extension data that can change during the life of the process, |
622 // but does not persist across restarts. | 626 // but does not persist across restarts. |
623 struct ExtensionRuntimeData { | 627 struct ExtensionRuntimeData { |
624 // True if the background page is ready. | 628 // True if the background page is ready. |
625 bool background_page_ready; | 629 bool background_page_ready; |
626 | 630 |
627 // True while the extension is being upgraded. | 631 // True while the extension is being upgraded. |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
848 scoped_ptr<ExtensionGlobalError> extension_global_error_; | 852 scoped_ptr<ExtensionGlobalError> extension_global_error_; |
849 | 853 |
850 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 854 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
851 InstallAppsWithUnlimtedStorage); | 855 InstallAppsWithUnlimtedStorage); |
852 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, | 856 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, |
853 InstallAppsAndCheckStorageProtection); | 857 InstallAppsAndCheckStorageProtection); |
854 DISALLOW_COPY_AND_ASSIGN(ExtensionService); | 858 DISALLOW_COPY_AND_ASSIGN(ExtensionService); |
855 }; | 859 }; |
856 | 860 |
857 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ | 861 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ |
OLD | NEW |