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

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

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