Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(645)

Side by Side Diff: chrome/browser/extensions/extension_service.h

Issue 8733004: Make ExtensionService use ExtensionSet. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: + Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <list> 9 #include <list>
10 #include <map> 10 #include <map>
(...skipping 23 matching lines...) Expand all
34 #include "chrome/browser/extensions/extensions_quota_service.h" 34 #include "chrome/browser/extensions/extensions_quota_service.h"
35 #include "chrome/browser/extensions/external_extension_provider_interface.h" 35 #include "chrome/browser/extensions/external_extension_provider_interface.h"
36 #include "chrome/browser/extensions/pending_extension_manager.h" 36 #include "chrome/browser/extensions/pending_extension_manager.h"
37 #include "chrome/browser/extensions/process_map.h" 37 #include "chrome/browser/extensions/process_map.h"
38 #include "chrome/browser/extensions/sandboxed_extension_unpacker.h" 38 #include "chrome/browser/extensions/sandboxed_extension_unpacker.h"
39 #include "chrome/browser/prefs/pref_change_registrar.h" 39 #include "chrome/browser/prefs/pref_change_registrar.h"
40 #include "chrome/browser/sync/api/sync_change.h" 40 #include "chrome/browser/sync/api/sync_change.h"
41 #include "chrome/browser/sync/api/syncable_service.h" 41 #include "chrome/browser/sync/api/syncable_service.h"
42 #include "chrome/common/extensions/extension.h" 42 #include "chrome/common/extensions/extension.h"
43 #include "chrome/common/extensions/extension_constants.h" 43 #include "chrome/common/extensions/extension_constants.h"
44 #include "chrome/common/extensions/extension_set.h"
44 #include "content/public/browser/browser_thread.h" 45 #include "content/public/browser/browser_thread.h"
45 #include "content/public/browser/notification_observer.h" 46 #include "content/public/browser/notification_observer.h"
46 #include "content/public/browser/notification_registrar.h" 47 #include "content/public/browser/notification_registrar.h"
47 48
48 class AppNotificationManager; 49 class AppNotificationManager;
49 class BookmarkExtensionEventRouter; 50 class BookmarkExtensionEventRouter;
50 class CrxInstaller; 51 class CrxInstaller;
51 class ExtensionBrowserEventRouter; 52 class ExtensionBrowserEventRouter;
52 class ExtensionContentSettingsStore; 53 class ExtensionContentSettingsStore;
53 class ExtensionCookiesEventRouter; 54 class ExtensionCookiesEventRouter;
(...skipping 25 matching lines...) Expand all
79 // This is an interface class to encapsulate the dependencies that 80 // This is an interface class to encapsulate the dependencies that
80 // various classes have on ExtensionService. This allows easy mocking. 81 // various classes have on ExtensionService. This allows easy mocking.
81 class ExtensionServiceInterface : public SyncableService { 82 class ExtensionServiceInterface : public SyncableService {
82 public: 83 public:
83 // A function that returns true if the given extension should be 84 // A function that returns true if the given extension should be
84 // included and false if it should be filtered out. Identical to 85 // included and false if it should be filtered out. Identical to
85 // PendingExtensionInfo::ShouldAllowInstallPredicate. 86 // PendingExtensionInfo::ShouldAllowInstallPredicate.
86 typedef bool (*ExtensionFilter)(const Extension&); 87 typedef bool (*ExtensionFilter)(const Extension&);
87 88
88 virtual ~ExtensionServiceInterface() {} 89 virtual ~ExtensionServiceInterface() {}
89 virtual const ExtensionList* extensions() const = 0; 90 virtual const ExtensionSet* extensions() const = 0;
90 virtual PendingExtensionManager* pending_extension_manager() = 0; 91 virtual PendingExtensionManager* pending_extension_manager() = 0;
91 92
92 // Install an update. Return true if the install can be started. 93 // Install an update. Return true if the install can be started.
93 // Set out_crx_installer to the installer if one was started. 94 // Set out_crx_installer to the installer if one was started.
94 virtual bool UpdateExtension( 95 virtual bool UpdateExtension(
95 const std::string& id, 96 const std::string& id,
96 const FilePath& path, 97 const FilePath& path,
97 const GURL& download_url, 98 const GURL& download_url,
98 CrxInstaller** out_crx_installer) = 0; 99 CrxInstaller** out_crx_installer) = 0;
99 virtual const Extension* GetExtensionById(const std::string& id, 100 virtual const Extension* GetExtensionById(const std::string& id,
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 ExtensionService(Profile* profile, 186 ExtensionService(Profile* profile,
186 const CommandLine* command_line, 187 const CommandLine* command_line,
187 const FilePath& install_directory, 188 const FilePath& install_directory,
188 ExtensionPrefs* extension_prefs, 189 ExtensionPrefs* extension_prefs,
189 bool autoupdate_enabled, 190 bool autoupdate_enabled,
190 bool extensions_enabled); 191 bool extensions_enabled);
191 192
192 virtual ~ExtensionService(); 193 virtual ~ExtensionService();
193 194
194 // Gets the list of currently installed extensions. 195 // Gets the list of currently installed extensions.
195 virtual const ExtensionList* extensions() const OVERRIDE; 196 virtual const ExtensionSet* extensions() const OVERRIDE;
196 const ExtensionList* disabled_extensions() const; 197 const ExtensionSet* disabled_extensions() const;
197 const ExtensionList* terminated_extensions() const; 198 const ExtensionSet* terminated_extensions() const;
198 199
199 // Gets the object managing the set of pending extensions. 200 // Gets the object managing the set of pending extensions.
200 virtual PendingExtensionManager* pending_extension_manager() OVERRIDE; 201 virtual PendingExtensionManager* pending_extension_manager() OVERRIDE;
201 202
202 const FilePath& install_directory() const { return install_directory_; } 203 const FilePath& install_directory() const { return install_directory_; }
203 204
204 AppsPromo* apps_promo() { return &apps_promo_; } 205 AppsPromo* apps_promo() { return &apps_promo_; }
205 206
206 extensions::ProcessMap* process_map() { return &process_map_; } 207 extensions::ProcessMap* process_map() { return &process_map_; }
207 208
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 std::vector<ExtensionSyncData> GetSyncDataList( 624 std::vector<ExtensionSyncData> GetSyncDataList(
624 const SyncBundle& bundle) const; 625 const SyncBundle& bundle) const;
625 626
626 // Gets the sync data for the given extension, assuming that the extension is 627 // Gets the sync data for the given extension, assuming that the extension is
627 // syncable. 628 // syncable.
628 ExtensionSyncData GetSyncData(const Extension& extension) const; 629 ExtensionSyncData GetSyncData(const Extension& extension) const;
629 630
630 // Appends sync data objects for every extension in |extensions| 631 // Appends sync data objects for every extension in |extensions|
631 // that passes |filter|. 632 // that passes |filter|.
632 void GetSyncDataListHelper( 633 void GetSyncDataListHelper(
633 const ExtensionList& extensions, 634 const ExtensionSet& extensions,
634 const SyncBundle& bundle, 635 const SyncBundle& bundle,
635 std::vector<ExtensionSyncData>* sync_data_list) const; 636 std::vector<ExtensionSyncData>* sync_data_list) const;
636 637
637 // Applies the change specified in an ExtensionSyncData to the current system. 638 // Applies the change specified in an ExtensionSyncData to the current system.
638 void ProcessExtensionSyncData( 639 void ProcessExtensionSyncData(
639 const ExtensionSyncData& extension_sync_data, 640 const ExtensionSyncData& extension_sync_data,
640 SyncBundle& bundle); 641 SyncBundle& bundle);
641 642
642 // Look up an extension by ID, optionally including either or both of enabled 643 // Look up an extension by ID, optionally including either or both of enabled
643 // and disabled extensions. 644 // and disabled extensions.
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 Profile* profile_; 684 Profile* profile_;
684 685
685 // Preferences for the owning profile (weak reference). 686 // Preferences for the owning profile (weak reference).
686 ExtensionPrefs* extension_prefs_; 687 ExtensionPrefs* extension_prefs_;
687 688
688 // Settings for the owning profile. 689 // Settings for the owning profile.
689 scoped_ptr<extensions::SettingsFrontend> settings_frontend_; 690 scoped_ptr<extensions::SettingsFrontend> settings_frontend_;
690 691
691 // The current list of installed extensions. 692 // The current list of installed extensions.
692 // TODO(aa): This should use chrome/common/extensions/extension_set.h. 693 // TODO(aa): This should use chrome/common/extensions/extension_set.h.
693 ExtensionList extensions_; 694 ExtensionSet extensions_;
694 695
695 // The list of installed extensions that have been disabled. 696 // The list of installed extensions that have been disabled.
696 ExtensionList disabled_extensions_; 697 ExtensionSet disabled_extensions_;
697 698
698 // The list of installed extensions that have been terminated. 699 // The list of installed extensions that have been terminated.
699 ExtensionList terminated_extensions_; 700 ExtensionSet terminated_extensions_;
700
701 // Used to quickly check if an extension was terminated.
702 std::set<std::string> terminated_extension_ids_;
703 701
704 // Hold the set of pending extensions. 702 // Hold the set of pending extensions.
705 PendingExtensionManager pending_extension_manager_; 703 PendingExtensionManager pending_extension_manager_;
706 704
707 // The map of extension IDs to their runtime data. 705 // The map of extension IDs to their runtime data.
708 ExtensionRuntimeDataMap extension_runtime_data_; 706 ExtensionRuntimeDataMap extension_runtime_data_;
709 707
710 // Holds a map between renderer process IDs that are associated with an 708 // Holds a map between renderer process IDs that are associated with an
711 // installed app and their app. 709 // installed app and their app.
712 typedef std::map<int, scoped_refptr<const Extension> > InstalledAppMap; 710 typedef std::map<int, scoped_refptr<const Extension> > InstalledAppMap;
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 extensions::ProcessMap process_map_; 817 extensions::ProcessMap process_map_;
820 818
821 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 819 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
822 InstallAppsWithUnlimtedStorage); 820 InstallAppsWithUnlimtedStorage);
823 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 821 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
824 InstallAppsAndCheckStorageProtection); 822 InstallAppsAndCheckStorageProtection);
825 DISALLOW_COPY_AND_ASSIGN(ExtensionService); 823 DISALLOW_COPY_AND_ASSIGN(ExtensionService);
826 }; 824 };
827 825
828 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ 826 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_process_manager.cc ('k') | chrome/browser/extensions/extension_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698