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

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

Issue 139943005: Convert extensions::ProcessMap to BrowserContextKeyedService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase process_map Created 6 years, 11 months 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) 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 12 matching lines...) Expand all
23 #include "chrome/browser/extensions/extension_prefs.h" 23 #include "chrome/browser/extensions/extension_prefs.h"
24 #include "chrome/browser/extensions/extension_sync_service.h" 24 #include "chrome/browser/extensions/extension_sync_service.h"
25 #include "chrome/common/extensions/extension_constants.h" 25 #include "chrome/common/extensions/extension_constants.h"
26 #include "content/public/browser/devtools_agent_host.h" 26 #include "content/public/browser/devtools_agent_host.h"
27 #include "content/public/browser/notification_observer.h" 27 #include "content/public/browser/notification_observer.h"
28 #include "content/public/browser/notification_registrar.h" 28 #include "content/public/browser/notification_registrar.h"
29 #include "extensions/browser/external_provider_interface.h" 29 #include "extensions/browser/external_provider_interface.h"
30 #include "extensions/browser/management_policy.h" 30 #include "extensions/browser/management_policy.h"
31 #include "extensions/browser/pending_extension_manager.h" 31 #include "extensions/browser/pending_extension_manager.h"
32 #include "extensions/browser/process_manager.h" 32 #include "extensions/browser/process_manager.h"
33 #include "extensions/browser/process_map.h"
34 #include "extensions/browser/quota_service.h" 33 #include "extensions/browser/quota_service.h"
35 #include "extensions/common/extension.h" 34 #include "extensions/common/extension.h"
36 #include "extensions/common/extension_set.h" 35 #include "extensions/common/extension_set.h"
37 #include "extensions/common/manifest.h" 36 #include "extensions/common/manifest.h"
38 #include "extensions/common/manifest_handlers/shared_module_info.h" 37 #include "extensions/common/manifest_handlers/shared_module_info.h"
39 #include "extensions/common/one_shot_event.h" 38 #include "extensions/common/one_shot_event.h"
40 39
41 class CommandLine; 40 class CommandLine;
42 class ExtensionErrorUI; 41 class ExtensionErrorUI;
43 class ExtensionToolbarModel; 42 class ExtensionToolbarModel;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
118 const std::string& extension_id, 117 const std::string& extension_id,
119 extensions::UnloadedExtensionInfo::Reason reason) = 0; 118 extensions::UnloadedExtensionInfo::Reason reason) = 0;
120 virtual void RemoveComponentExtension(const std::string& extension_id) = 0; 119 virtual void RemoveComponentExtension(const std::string& extension_id) = 0;
121 120
122 virtual bool is_ready() = 0; 121 virtual bool is_ready() = 0;
123 122
124 // Returns task runner for crx installation file I/O operations. 123 // Returns task runner for crx installation file I/O operations.
125 virtual base::SequencedTaskRunner* GetFileTaskRunner() = 0; 124 virtual base::SequencedTaskRunner* GetFileTaskRunner() = 0;
126 }; 125 };
127 126
128 // Manages installed and running Chromium extensions. 127 // Manages installed and running Chromium extensions. An instance is shared
128 // between normal and incognito profiles.
129 class ExtensionService 129 class ExtensionService
130 : public ExtensionServiceInterface, 130 : public ExtensionServiceInterface,
131 public extensions::ExternalProviderInterface::VisitorInterface, 131 public extensions::ExternalProviderInterface::VisitorInterface,
132 public content::NotificationObserver, 132 public content::NotificationObserver,
133 public extensions::Blacklist::Observer { 133 public extensions::Blacklist::Observer {
134 public: 134 public:
135 // Returns the Extension for a given url or NULL if the url doesn't belong to 135 // Returns the Extension for a given url or NULL if the url doesn't belong to
136 // an installed extension. This may be a hosted app extent or a 136 // an installed extension. This may be a hosted app extent or a
137 // chrome-extension:// url. 137 // chrome-extension:// url.
138 const extensions::Extension* GetInstalledExtensionByUrl( 138 const extensions::Extension* GetInstalledExtensionByUrl(
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 // Returns a set of all installed, disabled, blacklisted, and terminated 172 // Returns a set of all installed, disabled, blacklisted, and terminated
173 // extensions. 173 // extensions.
174 scoped_ptr<extensions::ExtensionSet> GenerateInstalledExtensionsSet() const; 174 scoped_ptr<extensions::ExtensionSet> GenerateInstalledExtensionsSet() const;
175 175
176 // Gets the object managing the set of pending extensions. 176 // Gets the object managing the set of pending extensions.
177 virtual extensions::PendingExtensionManager* 177 virtual extensions::PendingExtensionManager*
178 pending_extension_manager() OVERRIDE; 178 pending_extension_manager() OVERRIDE;
179 179
180 const base::FilePath& install_directory() const { return install_directory_; } 180 const base::FilePath& install_directory() const { return install_directory_; }
181 181
182 extensions::ProcessMap* process_map() { return &process_map_; }
183
184 // Updates the app launcher value for the moved extension so that it is now 182 // Updates the app launcher value for the moved extension so that it is now
185 // located after the given predecessor and before the successor. This will 183 // located after the given predecessor and before the successor. This will
186 // trigger a sync if needed. Empty strings are used to indicate no successor 184 // trigger a sync if needed. Empty strings are used to indicate no successor
187 // or predecessor. 185 // or predecessor.
188 void OnExtensionMoved(const std::string& moved_extension_id, 186 void OnExtensionMoved(const std::string& moved_extension_id,
189 const std::string& predecessor_extension_id, 187 const std::string& predecessor_extension_id,
190 const std::string& successor_extension_id); 188 const std::string& successor_extension_id);
191 189
192 // Whether the persistent background page, if any, is ready. We don't load 190 // Whether the persistent background page, if any, is ready. We don't load
193 // other components until then. If there is no background page, or if it is 191 // other components until then. If there is no background page, or if it is
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after
815 // allow background processing of garbage collection of on-disk state without 813 // allow background processing of garbage collection of on-disk state without
816 // needing to worry about race conditions caused by extension installation and 814 // needing to worry about race conditions caused by extension installation and
817 // reinstallation. 815 // reinstallation.
818 bool installs_delayed_for_gc_; 816 bool installs_delayed_for_gc_;
819 817
820 // Set to true if this is the first time this ExtensionService has run. 818 // Set to true if this is the first time this ExtensionService has run.
821 // Used for specially handling external extensions that are installed the 819 // Used for specially handling external extensions that are installed the
822 // first time. 820 // first time.
823 bool is_first_run_; 821 bool is_first_run_;
824 822
825 extensions::ProcessMap process_map_;
826
827 // A set of the extension ids currently being reloaded. We use this to 823 // A set of the extension ids currently being reloaded. We use this to
828 // avoid showing a "new install" notice for an extension reinstall. 824 // avoid showing a "new install" notice for an extension reinstall.
829 std::set<std::string> extensions_being_reloaded_; 825 std::set<std::string> extensions_being_reloaded_;
830 826
831 scoped_ptr<ExtensionErrorUI> extension_error_ui_; 827 scoped_ptr<ExtensionErrorUI> extension_error_ui_;
832 // Sequenced task runner for extension related file operations. 828 // Sequenced task runner for extension related file operations.
833 scoped_refptr<base::SequencedTaskRunner> file_task_runner_; 829 scoped_refptr<base::SequencedTaskRunner> file_task_runner_;
834 830
835 #if defined(ENABLE_EXTENSIONS) 831 #if defined(ENABLE_EXTENSIONS)
836 scoped_ptr<extensions::ExtensionActionStorageManager> 832 scoped_ptr<extensions::ExtensionActionStorageManager>
(...skipping 22 matching lines...) Expand all
859 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 855 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
860 UnloadBlacklistedExtensionPolicy); 856 UnloadBlacklistedExtensionPolicy);
861 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 857 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
862 WillNotLoadBlacklistedExtensionsFromDirectory); 858 WillNotLoadBlacklistedExtensionsFromDirectory);
863 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, 859 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
864 BlacklistedInPrefsFromStartup); 860 BlacklistedInPrefsFromStartup);
865 DISALLOW_COPY_AND_ASSIGN(ExtensionService); 861 DISALLOW_COPY_AND_ASSIGN(ExtensionService);
866 }; 862 };
867 863
868 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_ 864 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_function_dispatcher.cc ('k') | chrome/browser/extensions/extension_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698