blob: f968583720dceaed70d2d3f8f3c2ae617e368d98 [file] [log] [blame]
[email protected]c333e792012-01-06 16:57:391// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]6014d672008-12-05 00:38:252// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]eaa7dd182010-12-14 11:09:005#ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_
6#define CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_
[email protected]6014d672008-12-05 00:38:257
[email protected]669b2372013-10-17 15:04:588#include <list>
[email protected]da50530a2009-06-15 17:43:019#include <map>
[email protected]31bb5ee62012-09-12 22:58:4010#include <set>
[email protected]b0beaa662009-02-26 00:04:1511#include <string>
[email protected]6014d672008-12-05 00:38:2512#include <vector>
13
[email protected]e0785902011-05-19 23:34:1714#include "base/compiler_specific.h"
[email protected]57999812013-02-24 05:40:5215#include "base/files/file_path.h"
[email protected]a918f872010-06-01 14:30:5116#include "base/gtest_prod_util.h"
[email protected]3b63f8f42011-03-28 01:54:1517#include "base/memory/ref_counted.h"
[email protected]14908b72011-04-20 06:54:3618#include "base/memory/weak_ptr.h"
[email protected]1ab137b2013-03-21 03:33:1819#include "base/prefs/pref_change_registrar.h"
[email protected]00e7bef2013-06-10 20:35:1720#include "base/strings/string16.h"
[email protected]fdd679b2012-11-15 20:49:3921#include "chrome/browser/extensions/blacklist.h"
[email protected]906a9982014-03-19 00:39:3622#include "chrome/browser/extensions/extension_sync_service.h"
[email protected]f3d3b382014-03-14 21:19:2823#include "chrome/browser/extensions/pending_extension_manager.h"
[email protected]814a7bf0f2011-08-13 05:30:5924#include "chrome/common/extensions/extension_constants.h"
[email protected]04ea1bb2013-07-10 09:26:0925#include "content/public/browser/devtools_agent_host.h"
[email protected]6c2381d2011-10-19 02:52:5326#include "content/public/browser/notification_observer.h"
27#include "content/public/browser/notification_registrar.h"
[email protected]1ee7f892014-03-04 06:04:2528#include "extensions/browser/extension_function_histogram_value.h"
[email protected]489db0842014-01-22 18:20:0329#include "extensions/browser/extension_prefs.h"
[email protected]301116c62013-11-26 10:37:4530#include "extensions/browser/external_provider_interface.h"
31#include "extensions/browser/management_policy.h"
[email protected]98b6d942013-11-10 00:34:0732#include "extensions/browser/process_manager.h"
[email protected]e4452d32013-11-15 23:07:4133#include "extensions/common/extension.h"
[email protected]289c44b2013-12-17 03:26:5734#include "extensions/common/extension_set.h"
[email protected]d42c11152013-08-22 19:36:3235#include "extensions/common/manifest.h"
[email protected]301116c62013-11-26 10:37:4536#include "extensions/common/manifest_handlers/shared_module_info.h"
[email protected]4a10006a2013-05-17 23:18:3537#include "extensions/common/one_shot_event.h"
[email protected]6014d672008-12-05 00:38:2538
[email protected]89226982012-07-16 20:09:1839class ExtensionErrorUI;
[email protected]69f1be82009-04-16 22:27:2140class GURL;
[email protected]81e63782009-02-27 19:35:0941class Profile;
[email protected]aa142702010-03-26 01:26:3342
[email protected]7f8f24f2012-11-15 19:40:1443namespace base {
[email protected]2f3b1cc2014-03-17 23:07:1544class CommandLine;
[email protected]7f8f24f2012-11-15 19:40:1445class SequencedTaskRunner;
[email protected]1f04ef42013-04-22 07:35:5046class Version;
[email protected]7f8f24f2012-11-15 19:40:1447}
48
[email protected]9c70e0d92012-07-16 08:39:4449namespace extensions {
[email protected]5a38dfd2012-07-23 23:22:1050class BrowserEventRouter;
[email protected]d8c8f25f2011-11-02 18:18:0151class ComponentLoader;
[email protected]bf3d9df2012-07-24 23:20:2752class CrxInstaller;
[email protected]c77f2352012-08-08 22:07:5853class ExtensionActionStorageManager;
[email protected]e5f8fffe2014-04-02 00:30:4454class ExtensionGarbageCollector;
[email protected]bb1bc9b32013-12-21 03:09:1455class ExtensionRegistry;
[email protected]bd306722012-07-11 20:43:5956class ExtensionSystem;
[email protected]a74569b2014-03-25 02:56:3057class ExtensionToolbarModel;
[email protected]42a08162012-03-16 18:09:1158class ExtensionUpdater;
[email protected]3f213ad2012-07-26 23:39:4159class PendingExtensionManager;
[email protected]44366da12014-01-28 01:38:4160class RendererStartupHelper;
[email protected]a9aa62b312013-11-29 05:35:0661class UpdateObserver;
[email protected]9f4e4f082013-06-21 07:11:1962} // namespace extensions
[email protected]163ed192012-07-24 19:31:0763
[email protected]2d19eb6e2014-01-27 17:30:0064using extensions::ExtensionIdSet;
65
[email protected]163ed192012-07-24 19:31:0766namespace syncer {
[email protected]163ed192012-07-24 19:31:0767class SyncErrorFactory;
[email protected]d8c8f25f2011-11-02 18:18:0168}
[email protected]771a6182011-10-05 16:32:5269
[email protected]d1ca0ed12009-07-01 18:24:3270// This is an interface class to encapsulate the dependencies that
[email protected]2859946f2011-04-04 18:18:0671// various classes have on ExtensionService. This allows easy mocking.
[email protected]f8aefb132013-10-30 09:29:5272class ExtensionServiceInterface
73 : public base::SupportsWeakPtr<ExtensionServiceInterface> {
[email protected]d1ca0ed12009-07-01 18:24:3274 public:
[email protected]2859946f2011-04-04 18:18:0675 virtual ~ExtensionServiceInterface() {}
[email protected]ca975942014-01-07 12:06:4776
77 // DEPRECATED: Use ExtensionRegistry::enabled_extensions() instead.
78 // ExtensionRegistry also has the disabled, terminated and blacklisted sets.
[email protected]289c44b2013-12-17 03:26:5779 virtual const extensions::ExtensionSet* extensions() const = 0;
[email protected]ca975942014-01-07 12:06:4780
[email protected]3f213ad2012-07-26 23:39:4181 virtual extensions::PendingExtensionManager* pending_extension_manager() = 0;
[email protected]420a0ec2011-06-01 01:07:0382
83 // Install an update. Return true if the install can be started.
84 // Set out_crx_installer to the installer if one was started.
85 virtual bool UpdateExtension(
86 const std::string& id,
[email protected]650b2d52013-02-10 03:41:4587 const base::FilePath& path,
[email protected]044e86992014-01-24 22:59:1188 bool file_ownership_passed,
[email protected]420a0ec2011-06-01 01:07:0389 const GURL& download_url,
[email protected]bf3d9df2012-07-24 23:20:2790 extensions::CrxInstaller** out_crx_installer) = 0;
[email protected]f574c402012-12-04 23:20:3191 virtual const extensions::Extension* GetExtensionById(
92 const std::string& id,
93 bool include_disabled) const = 0;
[email protected]1c321ee2012-05-21 03:02:3494 virtual const extensions::Extension* GetInstalledExtension(
[email protected]8001df22011-04-28 19:59:4795 const std::string& id) const = 0;
[email protected]2859946f2011-04-04 18:18:0696
[email protected]76b65442012-11-17 14:11:4897 virtual const extensions::Extension* GetPendingExtensionUpdate(
98 const std::string& extension_id) const = 0;
[email protected]6f6101832012-11-27 22:10:4899 virtual void FinishDelayedInstallation(const std::string& extension_id) = 0;
[email protected]76b65442012-11-17 14:11:48100
[email protected]c3cfb012011-04-06 22:07:35101 virtual bool IsExtensionEnabled(const std::string& extension_id) const = 0;
[email protected]2859946f2011-04-04 18:18:06102
[email protected]4ee07c62012-08-21 12:40:42103 virtual void CheckManagementPolicy() = 0;
[email protected]5ef47ec2010-01-28 05:58:05104
[email protected]31206602011-04-13 23:07:32105 // Safe to call multiple times in a row.
106 //
[email protected]90310d92011-04-17 07:35:04107 // TODO(akalin): Remove this method (and others) once we refactor
108 // themes sync to not use it directly.
[email protected]31206602011-04-13 23:07:32109 virtual void CheckForUpdatesSoon() = 0;
[email protected]25ae0152011-11-18 14:40:02110
[email protected]1c321ee2012-05-21 03:02:34111 virtual void AddExtension(const extensions::Extension* extension) = 0;
[email protected]8c484b742012-11-29 06:05:36112 virtual void AddComponentExtension(
113 const extensions::Extension* extension) = 0;
[email protected]25ae0152011-11-18 14:40:02114
115 virtual void UnloadExtension(
116 const std::string& extension_id,
[email protected]b0af4792013-10-23 09:12:13117 extensions::UnloadedExtensionInfo::Reason reason) = 0;
[email protected]8b1ec202013-09-05 02:09:50118 virtual void RemoveComponentExtension(const std::string& extension_id) = 0;
[email protected]25ae0152011-11-18 14:40:02119
120 virtual bool is_ready() = 0;
[email protected]7f8f24f2012-11-15 19:40:14121
122 // Returns task runner for crx installation file I/O operations.
123 virtual base::SequencedTaskRunner* GetFileTaskRunner() = 0;
[email protected]d1ca0ed12009-07-01 18:24:32124};
[email protected]fbcc40302009-06-12 20:45:45125
[email protected]fafdc842014-01-17 18:09:08126// Manages installed and running Chromium extensions. An instance is shared
127// between normal and incognito profiles.
[email protected]eaa7dd182010-12-14 11:09:00128class ExtensionService
[email protected]14908b72011-04-20 06:54:36129 : public ExtensionServiceInterface,
[email protected]5df038b2012-07-16 19:03:27130 public extensions::ExternalProviderInterface::VisitorInterface,
[email protected]fdd679b2012-11-15 20:49:39131 public content::NotificationObserver,
132 public extensions::Blacklist::Observer {
[email protected]4f313d52009-05-21 00:42:29133 public:
[email protected]68e5cc72013-12-17 02:41:53134 // Returns the Extension for a given url or NULL if the url doesn't belong to
135 // an installed extension. This may be a hosted app extent or a
136 // chrome-extension:// url.
[email protected]400c4392013-12-13 14:41:58137 const extensions::Extension* GetInstalledExtensionByUrl(
138 const GURL& url) const;
139
[email protected]d9696672011-03-15 22:45:09140 // Returns the Extension of hosted or packaged apps, NULL otherwise.
[email protected]dc9a74f72012-08-17 18:07:21141 const extensions::Extension* GetInstalledApp(const GURL& url) const;
[email protected]d9696672011-03-15 22:45:09142
[email protected]ffb204f22010-12-05 23:20:27143 // Returns whether the URL is from either a hosted or packaged app.
[email protected]dc9a74f72012-08-17 18:07:21144 bool IsInstalledApp(const GURL& url) const;
[email protected]ffb204f22010-12-05 23:20:27145
[email protected]6aeac8342010-10-01 20:21:18146 // Attempts to uninstall an extension from a given ExtensionService. Returns
147 // true iff the target extension exists.
[email protected]eaa7dd182010-12-14 11:09:00148 static bool UninstallExtensionHelper(ExtensionService* extensions_service,
[email protected]6aeac8342010-10-01 20:21:18149 const std::string& extension_id);
150
[email protected]73c47932010-12-06 18:13:43151 // Constructor stores pointers to |profile| and |extension_prefs| but
152 // ownership remains at caller.
[email protected]eaa7dd182010-12-14 11:09:00153 ExtensionService(Profile* profile,
[email protected]2f3b1cc2014-03-17 23:07:15154 const base::CommandLine* command_line,
[email protected]650b2d52013-02-10 03:41:45155 const base::FilePath& install_directory,
[email protected]45759612012-07-10 17:21:23156 extensions::ExtensionPrefs* extension_prefs,
[email protected]fdd679b2012-11-15 20:49:39157 extensions::Blacklist* blacklist,
[email protected]0436b102011-04-15 18:30:03158 bool autoupdate_enabled,
[email protected]4a10006a2013-05-17 23:18:35159 bool extensions_enabled,
160 extensions::OneShotEvent* ready);
[email protected]6014d672008-12-05 00:38:25161
[email protected]14908b72011-04-20 06:54:36162 virtual ~ExtensionService();
163
[email protected]ca975942014-01-07 12:06:47164 // DEPRECATED: Use ExtensionRegistry::enabled_extensions() instead.
165 // ExtensionRegistry also has the disabled, terminated and blacklisted sets.
[email protected]289c44b2013-12-17 03:26:57166 virtual const extensions::ExtensionSet* extensions() const OVERRIDE;
[email protected]5fdfa562013-12-27 17:43:59167
[email protected]289c44b2013-12-17 03:26:57168 const extensions::ExtensionSet* delayed_installs() const;
[email protected]6014d672008-12-05 00:38:25169
[email protected]b2907fd2011-03-25 16:43:37170 // Gets the object managing the set of pending extensions.
[email protected]3f213ad2012-07-26 23:39:41171 virtual extensions::PendingExtensionManager*
172 pending_extension_manager() OVERRIDE;
[email protected]aa142702010-03-26 01:26:33173
[email protected]650b2d52013-02-10 03:41:45174 const base::FilePath& install_directory() const { return install_directory_; }
[email protected]ec5b50d2010-10-09 16:35:18175
[email protected]e178ad92013-06-28 02:29:25176 // Getter and setter for the flag that specifies whether the extension is
177 // being reloaded.
[email protected]5b3ee852013-09-26 06:33:10178 bool IsBeingReloaded(const std::string& extension_id) const;
[email protected]e178ad92013-06-28 02:29:25179 void SetBeingReloaded(const std::string& extension_id, bool value);
180
[email protected]6014d672008-12-05 00:38:25181 // Initialize and start all installed extensions.
[email protected]9f1087e2009-06-15 17:29:32182 void Init();
[email protected]6014d672008-12-05 00:38:25183
[email protected]47b896562012-08-22 23:55:15184 // Called when the associated Profile is going to be destroyed.
185 void Shutdown();
186
[email protected]695b5712012-12-06 23:55:28187 // Look up an extension by ID. Does not include terminated
[email protected]8001df22011-04-28 19:59:47188 // extensions.
[email protected]1c321ee2012-05-21 03:02:34189 virtual const extensions::Extension* GetExtensionById(
[email protected]b05fb9ff2011-04-23 00:07:56190 const std::string& id, bool include_disabled) const OVERRIDE;
[email protected]0c6da502009-08-14 22:32:39191
[email protected]8001df22011-04-28 19:59:47192 // Looks up an extension by ID, regardless of whether it's enabled,
[email protected]695b5712012-12-06 23:55:28193 // disabled, blacklisted, or terminated.
[email protected]599539802014-01-07 23:06:00194 // DEPRECATED: Replace with:
195 // ExtensionRegistry::GetExtensionById(id, ExtensionRegistry::EVERYTHING).
[email protected]1c321ee2012-05-21 03:02:34196 virtual const extensions::Extension* GetInstalledExtension(
[email protected]8001df22011-04-28 19:59:47197 const std::string& id) const OVERRIDE;
[email protected]0dfe05c2011-02-23 23:03:36198
[email protected]e957fe52009-06-23 16:51:05199 // Updates a currently-installed extension with the contents from
[email protected]7577a5c52009-07-30 06:21:58200 // |extension_path|.
[email protected]2a464a92009-08-01 17:58:35201 // TODO(aa): This method can be removed. ExtensionUpdater could use
202 // CrxInstaller directly instead.
[email protected]420a0ec2011-06-01 01:07:03203 virtual bool UpdateExtension(
204 const std::string& id,
[email protected]650b2d52013-02-10 03:41:45205 const base::FilePath& extension_path,
[email protected]044e86992014-01-24 22:59:11206 bool file_ownership_passed,
[email protected]420a0ec2011-06-01 01:07:03207 const GURL& download_url,
[email protected]bf3d9df2012-07-24 23:20:27208 extensions::CrxInstaller** out_crx_installer) OVERRIDE;
[email protected]e957fe52009-06-23 16:51:05209
[email protected]2380c6b2013-01-09 02:33:13210 // Reloads the specified extension, sending the onLaunched() event to it if it
211 // currently has any window showing.
[email protected]e178ad92013-06-28 02:29:25212 void ReloadExtension(const std::string extension_id);
[email protected]9cddd4702009-07-27 22:09:40213
[email protected]631cf822009-05-15 07:01:25214 // Uninstalls the specified extension. Callers should only call this method
[email protected]17c4f3c2009-07-04 16:36:25215 // with extensions that exist. |external_uninstall| is a magical parameter
216 // that is only used to send information to ExtensionPrefs, which external
217 // callers should never set to true.
[email protected]a12c706e2011-12-01 00:58:08218 //
219 // We pass the |extension_id| by value to avoid having it deleted from under
220 // us incase someone calls it with Extension::id() or another string that we
221 // are going to delete in this function.
222 //
[email protected]17c4f3c2009-07-04 16:36:25223 // TODO(aa): Remove |external_uninstall| -- this information should be passed
224 // to ExtensionPrefs some other way.
[email protected]a12c706e2011-12-01 00:58:08225 virtual bool UninstallExtension(std::string extension_id,
[email protected]d6ebc9792011-04-07 18:18:33226 bool external_uninstall,
[email protected]439f1e32013-12-09 20:09:09227 base::string16* error);
[email protected]631cf822009-05-15 07:01:25228
[email protected]b05fb9ff2011-04-23 00:07:56229 virtual bool IsExtensionEnabled(
230 const std::string& extension_id) const OVERRIDE;
[email protected]c3cfb012011-04-06 22:07:35231
[email protected]06f92562011-04-29 19:27:31232 // Enables the extension. If the extension is already enabled, does
233 // nothing.
[email protected]2859946f2011-04-04 18:18:06234 virtual void EnableExtension(const std::string& extension_id);
[email protected]06f92562011-04-29 19:27:31235
236 // Disables the extension. If the extension is already disabled, or
237 // cannot be disabled, does nothing.
[email protected]44d62b62012-04-11 00:06:03238 virtual void DisableExtension(const std::string& extension_id,
[email protected]1c321ee2012-05-21 03:02:34239 extensions::Extension::DisableReason disable_reason);
[email protected]0c6da502009-08-14 22:32:39240
[email protected]3082fe32013-08-06 11:12:38241 // Disable non-default and non-managed extensions with ids not in
242 // |except_ids|. Default extensions are those from the Web Store with
243 // |was_installed_by_default| flag.
[email protected]1abf05e2013-07-09 17:04:36244 void DisableUserExtensions(const std::vector<std::string>& except_ids);
[email protected]e516e4c2013-06-12 17:41:14245
[email protected]8d888c12010-11-30 00:00:25246 // Updates the |extension|'s granted permissions lists to include all
[email protected]8d888c12010-11-30 00:00:25247 // permissions in the |extension|'s manifest and re-enables the
248 // extension.
[email protected]1c321ee2012-05-21 03:02:34249 void GrantPermissionsAndEnableExtension(
[email protected]009633c2013-03-07 22:08:28250 const extensions::Extension* extension);
[email protected]8d888c12010-11-30 00:00:25251
[email protected]be083862012-09-01 03:53:45252 // Updates the |extension|'s granted permissions lists to include all
253 // permissions in the |extensions|'s manifest.
254 void GrantPermissions(
[email protected]009633c2013-03-07 22:08:28255 const extensions::Extension* extension);
[email protected]be083862012-09-01 03:53:45256
[email protected]9f1087e2009-06-15 17:29:32257 // Check for updates (or potentially new extensions from external providers)
[email protected]93fd78f42009-07-10 16:43:17258 void CheckForExternalUpdates();
[email protected]9f1087e2009-06-15 17:29:32259
260 // Unload the specified extension.
[email protected]25ae0152011-11-18 14:40:02261 virtual void UnloadExtension(
262 const std::string& extension_id,
[email protected]b0af4792013-10-23 09:12:13263 extensions::UnloadedExtensionInfo::Reason reason) OVERRIDE;
[email protected]9f1087e2009-06-15 17:29:32264
[email protected]8b1ec202013-09-05 02:09:50265 // Remove the specified component extension.
266 virtual void RemoveComponentExtension(const std::string& extension_id)
267 OVERRIDE;
268
[email protected]bb1bc9b32013-12-21 03:09:14269 // Unload all extensions. Does not send notifications.
270 void UnloadAllExtensionsForTest();
[email protected]9f1087e2009-06-15 17:29:32271
[email protected]bb1bc9b32013-12-21 03:09:14272 // Reloads all extensions. Does not notify that extensions are ready.
273 void ReloadExtensionsForTest();
[email protected]9f1087e2009-06-15 17:29:32274
[email protected]c6d474f82009-12-16 21:11:06275 // Called when the initial extensions load has completed.
276 virtual void OnLoadedInstalledExtensions();
[email protected]7577a5c52009-07-30 06:21:58277
[email protected]bc151cf92013-02-12 04:57:26278 // Adds |extension| to this ExtensionService and notifies observers that the
279 // extensions have been loaded.
[email protected]1c321ee2012-05-21 03:02:34280 virtual void AddExtension(const extensions::Extension* extension) OVERRIDE;
[email protected]7577a5c52009-07-30 06:21:58281
[email protected]8c484b742012-11-29 06:05:36282 // Check if we have preferences for the component extension and, if not or if
283 // the stored version differs, install the extension (without requirements
284 // checking) before calling AddExtension.
285 virtual void AddComponentExtension(const extensions::Extension* extension)
286 OVERRIDE;
287
[email protected]9f4e4f082013-06-21 07:11:19288 enum ImportStatus {
289 IMPORT_STATUS_OK,
290 IMPORT_STATUS_UNSATISFIED,
291 IMPORT_STATUS_UNRECOVERABLE
292 };
293
[email protected]669b2372013-10-17 15:04:58294 // Checks an extension's imports. No installed and outdated imports will be
295 // stored in |missing_modules| and |outdated_modules|.
296 ImportStatus CheckImports(
297 const extensions::Extension* extension,
298 std::list<extensions::SharedModuleInfo::ImportInfo>* missing_modules,
299 std::list<extensions::SharedModuleInfo::ImportInfo>* outdated_modules);
300
[email protected]9f4e4f082013-06-21 07:11:19301 // Checks an extension's shared module imports to see if they are satisfied.
302 // If they are not, this function adds the dependencies to the pending install
303 // list if |extension| came from the webstore.
304 ImportStatus SatisfyImports(const extensions::Extension* extension);
305
306 // Returns a set of extensions that import a given extension.
[email protected]289c44b2013-12-17 03:26:57307 scoped_ptr<const extensions::ExtensionSet> GetDependentExtensions(
[email protected]9f4e4f082013-06-21 07:11:19308 const extensions::Extension* extension);
309
310 // Uninstalls shared modules that were only referenced by |extension|.
311 void PruneSharedModulesOnUninstall(const extensions::Extension* extension);
312
[email protected]bc151cf92013-02-12 04:57:26313 // Informs the service that an extension's files are in place for loading.
314 //
[email protected]9f3c8532013-07-31 19:52:07315 // |page_ordinal| is the location of the extension in the app launcher.
316 // |has_requirement_errors| is true if requirements of the extension weren't
317 // met (for example graphics capabilities).
318 // |blacklist_state| will be BLACKLISTED if the extension is blacklisted.
319 // |wait_for_idle| may be false to install the extension immediately.
[email protected]8266d662011-07-12 21:53:26320 void OnExtensionInstalled(
[email protected]1c321ee2012-05-21 03:02:34321 const extensions::Extension* extension,
[email protected]98270432012-09-11 20:51:24322 const syncer::StringOrdinal& page_ordinal,
[email protected]0db124b02012-11-07 04:55:05323 bool has_requirement_errors,
[email protected]8e289f0b2013-12-17 17:49:07324 extensions::BlacklistState blacklist_state,
[email protected]0db124b02012-11-07 04:55:05325 bool wait_for_idle);
326
[email protected]9f4e4f082013-06-21 07:11:19327 // Checks for delayed installation for all pending installs.
328 void MaybeFinishDelayedInstallations();
329
[email protected]6f6101832012-11-27 22:10:48330 // Similar to FinishInstallation, but first checks if there still is an update
331 // pending for the extension, and makes sure the extension is still idle.
332 void MaybeFinishDelayedInstallation(const std::string& extension_id);
333
[email protected]0db124b02012-11-07 04:55:05334 // Finishes installation of an update for an extension with the specified id,
335 // when installation of that extension was previously delayed because the
336 // extension was in use.
[email protected]6f6101832012-11-27 22:10:48337 virtual void FinishDelayedInstallation(
338 const std::string& extension_id) OVERRIDE;
[email protected]7577a5c52009-07-30 06:21:58339
[email protected]76b65442012-11-17 14:11:48340 // Returns an update for an extension with the specified id, if installation
341 // of that update was previously delayed because the extension was in use. If
342 // no updates are pending for the extension returns NULL.
343 virtual const extensions::Extension* GetPendingExtensionUpdate(
344 const std::string& extension_id) const OVERRIDE;
345
[email protected]4ee07c62012-08-21 12:40:42346 // Go through each extension and unload those that are not allowed to run by
347 // management policy providers (ie. network admin and Google-managed
348 // blacklist).
349 virtual void CheckManagementPolicy() OVERRIDE;
[email protected]aa96d3a2010-08-21 08:45:25350
[email protected]b05fb9ff2011-04-23 00:07:56351 virtual void CheckForUpdatesSoon() OVERRIDE;
[email protected]c3cfb012011-04-06 22:07:35352
[email protected]7577a5c52009-07-30 06:21:58353 void set_extensions_enabled(bool enabled) { extensions_enabled_ = enabled; }
[email protected]abe7a8942009-06-23 05:14:29354 bool extensions_enabled() { return extensions_enabled_; }
355
[email protected]0e34d7892009-06-05 19:17:40356 void set_show_extensions_prompts(bool enabled) {
357 show_extensions_prompts_ = enabled;
[email protected]e2eb43112009-05-29 21:19:54358 }
359
[email protected]0e34d7892009-06-05 19:17:40360 bool show_extensions_prompts() {
361 return show_extensions_prompts_;
[email protected]e2eb43112009-05-29 21:19:54362 }
363
[email protected]c3cfb012011-04-06 22:07:35364 Profile* profile();
[email protected]24e7a9d2009-11-04 11:11:34365
[email protected]599539802014-01-07 23:06:00366 // Returns profile_ as a BrowserContext.
367 content::BrowserContext* GetBrowserContext() const;
368
[email protected]f8aefb132013-10-30 09:29:52369 void set_extension_sync_service(
370 ExtensionSyncService* extension_sync_service) {
371 extension_sync_service_ = extension_sync_service;
372 }
373
[email protected]3ecda252010-11-18 19:50:55374 // Whether the extension service is ready.
[email protected]25ae0152011-11-18 14:40:02375 virtual bool is_ready() OVERRIDE;
[email protected]3ecda252010-11-18 19:50:55376
[email protected]7f8f24f2012-11-15 19:40:14377 virtual base::SequencedTaskRunner* GetFileTaskRunner() OVERRIDE;
378
[email protected]d8c8f25f2011-11-02 18:18:01379 extensions::ComponentLoader* component_loader() {
380 return component_loader_.get();
381 }
382
[email protected]1fab8452009-09-03 02:23:39383 // Note that this may return NULL if autoupdate is not turned on.
[email protected]42a08162012-03-16 18:09:11384 extensions::ExtensionUpdater* updater();
[email protected]1fab8452009-09-03 02:23:39385
[email protected]d11c8e92009-10-20 23:26:40386 // Notify the frontend that there was an error loading an extension.
[email protected]d8c8f25f2011-11-02 18:18:01387 // This method is public because UnpackedInstaller and InstalledLoader
388 // can post to here.
389 // TODO(aa): Remove this. It doesn't do enough to be worth the dependency
390 // of these classes on ExtensionService.
[email protected]650b2d52013-02-10 03:41:45391 void ReportExtensionLoadError(const base::FilePath& extension_path,
[email protected]d11c8e92009-10-20 23:26:40392 const std::string& error,
[email protected]d11c8e92009-10-20 23:26:40393 bool be_noisy);
394
[email protected]add57db72014-04-01 23:25:22395 // Notifies ExtensionSettingsHandler whether or not to retry installation for
396 // given |extension_path|.
397 void NotifyLoadRetry(bool retry, const base::FilePath& extension_path);
398
[email protected]406027c02010-09-27 08:03:18399 // ExtensionHost of background page calls this method right after its render
400 // view has been created.
[email protected]3a1dc572012-07-31 22:25:13401 void DidCreateRenderViewForBackgroundPage(extensions::ExtensionHost* host);
[email protected]406027c02010-09-27 08:03:18402
[email protected]8e4560b62011-01-14 10:09:14403 // For the extension in |version_path| with |id|, check to see if it's an
404 // externally managed extension. If so, uninstall it.
405 void CheckExternalUninstall(const std::string& id);
406
[email protected]7f8f24f2012-11-15 19:40:14407 // Changes sequenced task runner for crx installation tasks to |task_runner|.
408 void SetFileTaskRunnerForTesting(base::SequencedTaskRunner* task_runner);
409
[email protected]5df038b2012-07-16 19:03:27410 // Clear all ExternalProviders.
[email protected]8e4560b62011-01-14 10:09:14411 void ClearProvidersForTesting();
412
[email protected]5df038b2012-07-16 19:03:27413 // Adds an ExternalProviderInterface for the service to use during testing.
414 // Takes ownership of |test_provider|.
415 void AddProviderForTesting(
416 extensions::ExternalProviderInterface* test_provider);
[email protected]8e4560b62011-01-14 10:09:14417
[email protected]5df038b2012-07-16 19:03:27418 // ExternalProvider::Visitor implementation.
[email protected]1c321ee2012-05-21 03:02:34419 virtual bool OnExternalExtensionFileFound(
420 const std::string& id,
[email protected]1f04ef42013-04-22 07:35:50421 const base::Version* version,
[email protected]650b2d52013-02-10 03:41:45422 const base::FilePath& path,
[email protected]1d5e58b2013-01-31 08:41:40423 extensions::Manifest::Location location,
[email protected]1c321ee2012-05-21 03:02:34424 int creation_flags,
425 bool mark_acknowledged) OVERRIDE;
[email protected]8e4560b62011-01-14 10:09:14426
[email protected]1c321ee2012-05-21 03:02:34427 virtual bool OnExternalExtensionUpdateUrlFound(
428 const std::string& id,
[email protected]d8fd0fd2014-03-24 13:16:06429 const std::string& install_parameter,
[email protected]1c321ee2012-05-21 03:02:34430 const GURL& update_url,
[email protected]464213a2013-10-15 01:06:48431 extensions::Manifest::Location location,
432 int creation_flags,
433 bool mark_acknowledged) OVERRIDE;
[email protected]8e4560b62011-01-14 10:09:14434
[email protected]50067e52011-10-20 23:17:07435 virtual void OnExternalProviderReady(
[email protected]5df038b2012-07-16 19:03:27436 const extensions::ExternalProviderInterface* provider) OVERRIDE;
[email protected]50067e52011-10-20 23:17:07437
[email protected]94fde232012-04-27 10:22:30438 // Returns true when all the external extension providers are ready.
439 bool AreAllExternalProvidersReady() const;
440
[email protected]50067e52011-10-20 23:17:07441 void OnAllExternalProvidersReady();
[email protected]8e4560b62011-01-14 10:09:14442
[email protected]62433d32011-10-12 22:33:12443 // Once all external providers are done, generates any needed alerts about
[email protected]e5af875f2011-10-10 21:09:14444 // extensions.
445 void IdentifyAlertableExtensions();
446
[email protected]89226982012-07-16 20:09:18447 // Given an ExtensionErrorUI alert, populates it with any extensions that
[email protected]07c9f2f42012-02-29 18:45:22448 // need alerting. Returns true if the alert should be displayed at all.
449 //
[email protected]89226982012-07-16 20:09:18450 // This method takes the extension_error_ui argument rather than using
[email protected]07c9f2f42012-02-29 18:45:22451 // the member variable to make it easier to test the method in isolation.
[email protected]89226982012-07-16 20:09:18452 bool PopulateExtensionErrorUI(ExtensionErrorUI* extension_error_ui);
[email protected]07c9f2f42012-02-29 18:45:22453
[email protected]612a1cb12012-10-17 13:18:03454 // Checks if there are any new external extensions to notify the user about.
455 void UpdateExternalExtensionAlert();
[email protected]e5af875f2011-10-10 21:09:14456
[email protected]47fc70c2011-12-06 07:29:51457 // Given a (presumably just-installed) extension id, mark that extension as
458 // acknowledged.
459 void AcknowledgeExternalExtension(const std::string& id);
460
[email protected]d96eb512012-11-01 23:44:08461 // Returns true if this extension is an external one that has yet to be
462 // marked as acknowledged.
463 bool IsUnacknowledgedExternalExtension(
464 const extensions::Extension* extension);
465
[email protected]59ee99d2013-10-11 15:46:16466 // Disable extensions that are known to be disabled yet are currently enabled.
467 void ReconcileKnownDisabled();
468
[email protected]62433d32011-10-12 22:33:12469 // Opens the Extensions page because the user wants to get more details
470 // about the alerts.
[email protected]89226982012-07-16 20:09:18471 void HandleExtensionAlertDetails();
[email protected]62433d32011-10-12 22:33:12472
[email protected]73a85e012013-04-04 10:45:30473 // Called when the extension alert is closed. Updates prefs and deletes
474 // the active |extension_error_ui_|.
[email protected]a9aa5932012-01-25 08:27:40475 void HandleExtensionAlertClosed();
[email protected]e5af875f2011-10-10 21:09:14476
[email protected]612a1cb12012-10-17 13:18:03477 // Marks alertable extensions as acknowledged, after the user presses the
478 // accept button.
479 void HandleExtensionAlertAccept();
480
[email protected]6c2381d2011-10-19 02:52:53481 // content::NotificationObserver
[email protected]432115822011-07-10 15:52:27482 virtual void Observe(int type,
[email protected]6c2381d2011-10-19 02:52:53483 const content::NotificationSource& source,
484 const content::NotificationDetails& details) OVERRIDE;
[email protected]4814b512009-11-07 00:12:29485
[email protected]e5f8fffe2014-04-02 00:30:44486 // Postpone installations so that we don't have to worry about race
487 // conditions.
488 void OnGarbageCollectIsolatedStorageStart();
489
490 // Restart any extension installs which were delayed for isolated storage
491 // garbage collection.
492 void OnGarbageCollectIsolatedStorageFinished();
493
[email protected]fe2dd7742011-04-19 22:52:49494 // Record a histogram using the PermissionMessage enum values for each
495 // permission in |e|.
496 // NOTE: If this is ever called with high frequency, the implementation may
497 // need to be made more efficient.
498 static void RecordPermissionMessagesHistogram(
[email protected]1c321ee2012-05-21 03:02:34499 const extensions::Extension* e, const char* histogram);
[email protected]fe2dd7742011-04-19 22:52:49500
[email protected]fa2416f2011-05-03 08:41:20501#if defined(UNIT_TEST)
[email protected]1c321ee2012-05-21 03:02:34502 void TrackTerminatedExtensionForTest(const extensions::Extension* extension) {
[email protected]fa2416f2011-05-03 08:41:20503 TrackTerminatedExtension(extension);
504 }
[email protected]a51c9e92012-12-09 09:19:20505
506 void FinishInstallationForTest(const extensions::Extension* extension) {
507 FinishInstallation(extension);
508 }
[email protected]fa2416f2011-05-03 08:41:20509#endif
510
[email protected]77e4dc0882012-06-20 18:53:50511 base::WeakPtr<ExtensionService> AsWeakPtr() { return base::AsWeakPtr(this); }
512
[email protected]e5f8fffe2014-04-02 00:30:44513 extensions::ExtensionGarbageCollector* garbage_collector() {
514 return garbage_collector_.get();
515 }
516
[email protected]3c4abc82012-10-22 22:25:54517 bool browser_terminating() const { return browser_terminating_; }
518
519 // For testing.
520 void set_browser_terminating_for_test(bool value) {
521 browser_terminating_ = value;
522 }
523
[email protected]fc332ae2012-11-14 20:17:33524 // By default ExtensionService will wait with installing an updated extension
525 // until the extension is idle. Tests might not like this behavior, so you can
526 // disable it with this method.
527 void set_install_updates_when_idle_for_test(bool value) {
528 install_updates_when_idle_ = value;
529 }
530
[email protected]4e9b59d2013-12-18 06:47:14531 // Set a callback to be called when all external providers are ready and their
532 // extensions have been installed.
533 void set_external_updates_finished_callback_for_test(
534 const base::Closure& callback) {
535 external_updates_finished_callback_ = callback;
536 }
537
[email protected]75bdcb872013-03-13 00:41:45538 // Adds/Removes update observers.
539 void AddUpdateObserver(extensions::UpdateObserver* observer);
540 void RemoveUpdateObserver(extensions::UpdateObserver* observer);
541
[email protected]14908b72011-04-20 06:54:36542 private:
[email protected]2d19eb6e2014-01-27 17:30:00543 // Populates greylist_.
544 void LoadGreylistFromPrefs();
545
[email protected]4a10006a2013-05-17 23:18:35546 // Signals *ready_ and sends a notification to the listeners.
[email protected]820d9bd2013-04-03 03:46:03547 void SetReadyAndNotifyListeners();
548
[email protected]5db9ada2012-04-11 13:48:20549 // Return true if the sync type of |extension| matches |type|.
[email protected]90bb38d2012-11-14 18:36:03550 void OnExtensionInstallPrefChanged();
551
[email protected]fa2416f2011-05-03 08:41:20552 // Adds the given extension to the list of terminated extensions if
553 // it is not already there and unloads it.
[email protected]1c321ee2012-05-21 03:02:34554 void TrackTerminatedExtension(const extensions::Extension* extension);
[email protected]fa2416f2011-05-03 08:41:20555
556 // Removes the extension with the given id from the list of
557 // terminated extensions if it is there.
[email protected]bb7f40952011-01-13 00:21:20558 void UntrackTerminatedExtension(const std::string& id);
559
[email protected]8c484b742012-11-29 06:05:36560 // Update preferences for a new or updated extension; notify observers that
561 // the extension is installed, e.g., to update event handlers on background
562 // pages; and perform other extension install tasks before calling
563 // AddExtension.
[email protected]d8fd0fd2014-03-24 13:16:06564 void AddNewOrUpdatedExtension(const extensions::Extension* extension,
565 extensions::Extension::State initial_state,
566 extensions::BlacklistState blacklist_state,
567 const syncer::StringOrdinal& page_ordinal,
568 const std::string& install_parameter);
[email protected]8c484b742012-11-29 06:05:36569
[email protected]62d30f42009-10-01 22:36:06570 // Handles sending notification that |extension| was loaded.
[email protected]1c321ee2012-05-21 03:02:34571 void NotifyExtensionLoaded(const extensions::Extension* extension);
[email protected]62d30f42009-10-01 22:36:06572
573 // Handles sending notification that |extension| was unloaded.
[email protected]b0af4792013-10-23 09:12:13574 void NotifyExtensionUnloaded(
575 const extensions::Extension* extension,
576 extensions::UnloadedExtensionInfo::Reason reason);
[email protected]62d30f42009-10-01 22:36:06577
[email protected]6f6101832012-11-27 22:10:48578 // Common helper to finish installing the given extension.
579 void FinishInstallation(const extensions::Extension* extension);
580
[email protected]b914e2952013-04-26 07:10:03581 // Updates the |extension|'s active permission set to include only permissions
582 // currently requested by the extension and all the permissions required by
583 // the extension.
584 void UpdateActivePermissions(const extensions::Extension* extension);
585
586 // Disables the extension if the privilege level has increased
587 // (e.g., due to an upgrade).
588 void CheckPermissionsIncrease(const extensions::Extension* extension,
[email protected]116d40e2013-08-08 17:23:17589 bool is_extension_installed);
[email protected]b914e2952013-04-26 07:10:03590
[email protected]aab98a52009-12-02 03:22:35591 // Helper that updates the active extension list used for crash reporting.
592 void UpdateActiveExtensionsInCrashReporter();
593
[email protected]612a1cb12012-10-17 13:18:03594 // Helper to determine whether we should initially enable an installed
595 // (or upgraded) extension.
596 bool ShouldEnableOnInstall(const extensions::Extension* extension);
597
[email protected]e7aa7b7e2012-11-27 04:51:22598 // Helper to determine if updating an extensions should proceed immediately,
599 // or if we should delay the update until further notice.
600 bool ShouldDelayExtensionUpdate(const std::string& extension_id,
601 bool wait_for_idle) const;
602
[email protected]fdd679b2012-11-15 20:49:39603 // extensions::Blacklist::Observer implementation.
604 virtual void OnBlacklistUpdated() OVERRIDE;
605
[email protected]695b5712012-12-06 23:55:28606 // Manages the blacklisted extensions, intended as callback from
607 // Blacklist::GetBlacklistedIDs.
[email protected]2d19eb6e2014-01-27 17:30:00608 void ManageBlacklist(
609 const extensions::Blacklist::BlacklistStateMap& blacklisted_ids);
610
611 // Add extensions in |blocked| to blacklisted_extensions, remove extensions
612 // that are neither in |blocked|, nor in |unchanged|.
613 void UpdateBlockedExtensions(const ExtensionIdSet& blocked,
614 const ExtensionIdSet& unchanged);
615
616 void UpdateGreylistedExtensions(
617 const ExtensionIdSet& greylist,
618 const ExtensionIdSet& unchanged,
619 const extensions::Blacklist::BlacklistStateMap& state_map);
[email protected]695b5712012-12-06 23:55:28620
[email protected]bb1bc9b32013-12-21 03:09:14621 // Used only by test code.
622 void UnloadAllExtensionsInternal();
623
[email protected]31d8f5f22012-04-02 15:22:08624 // The normal profile associated with this ExtensionService.
[email protected]6ef635e42009-07-26 06:16:12625 Profile* profile_;
626
[email protected]31d8f5f22012-04-02 15:22:08627 // The ExtensionSystem for the profile above.
[email protected]bd306722012-07-11 20:43:59628 extensions::ExtensionSystem* system_;
[email protected]31d8f5f22012-04-02 15:22:08629
[email protected]695b5712012-12-06 23:55:28630 // Preferences for the owning profile.
[email protected]45759612012-07-10 17:21:23631 extensions::ExtensionPrefs* extension_prefs_;
[email protected]894bb502009-05-21 22:39:57632
[email protected]695b5712012-12-06 23:55:28633 // Blacklist for the owning profile.
634 extensions::Blacklist* blacklist_;
635
[email protected]f8aefb132013-10-30 09:29:52636 // The ExtensionSyncService that is used by this ExtensionService.
637 ExtensionSyncService* extension_sync_service_;
638
[email protected]5fdfa562013-12-27 17:43:59639 // Sets of enabled/disabled/terminated/blacklisted extensions. Not owned.
640 extensions::ExtensionRegistry* registry_;
[email protected]695b5712012-12-06 23:55:28641
[email protected]2d19eb6e2014-01-27 17:30:00642 // Set of greylisted extensions. These extensions are disabled if they are
643 // already installed in Chromium at the time when they are added to
644 // the greylist. Unlike blacklisted extensions, greylisted ones are visible
645 // to the user and if user re-enables such an extension, they remain enabled.
646 //
647 // These extensions should appear in registry_.
648 extensions::ExtensionSet greylist_;
649
[email protected]9f4e4f082013-06-21 07:11:19650 // The list of extension installs delayed for various reasons. The reason
[email protected]bb1bc9b32013-12-21 03:09:14651 // for delayed install is stored in ExtensionPrefs. These are not part of
652 // ExtensionRegistry because they are not yet installed.
[email protected]289c44b2013-12-17 03:26:57653 extensions::ExtensionSet delayed_installs_;
[email protected]0db124b02012-11-07 04:55:05654
[email protected]b2907fd2011-03-25 16:43:37655 // Hold the set of pending extensions.
[email protected]3f213ad2012-07-26 23:39:41656 extensions::PendingExtensionManager pending_extension_manager_;
[email protected]aa142702010-03-26 01:26:33657
[email protected]6014d672008-12-05 00:38:25658 // The full path to the directory where extensions are installed.
[email protected]650b2d52013-02-10 03:41:45659 base::FilePath install_directory_;
[email protected]6014d672008-12-05 00:38:25660
[email protected]e2eb43112009-05-29 21:19:54661 // Whether or not extensions are enabled.
662 bool extensions_enabled_;
663
[email protected]0e34d7892009-06-05 19:17:40664 // Whether to notify users when they attempt to install an extension.
665 bool show_extensions_prompts_;
[email protected]e2eb43112009-05-29 21:19:54666
[email protected]fc332ae2012-11-14 20:17:33667 // Whether to delay installing of extension updates until the extension is
668 // idle.
669 bool install_updates_when_idle_;
670
[email protected]4a10006a2013-05-17 23:18:35671 // Signaled when all extensions are loaded.
672 extensions::OneShotEvent* const ready_;
[email protected]e81dba32009-06-19 20:19:13673
[email protected]93fd78f42009-07-10 16:43:17674 // Our extension updater, if updates are turned on.
[email protected]42a08162012-03-16 18:09:11675 scoped_ptr<extensions::ExtensionUpdater> updater_;
[email protected]93fd78f42009-07-10 16:43:17676
[email protected]1eb175082010-02-10 09:26:16677 // Map unloaded extensions' ids to their paths. When a temporarily loaded
[email protected]5fb889382011-06-03 00:29:20678 // extension is unloaded, we lose the information about it and don't have
[email protected]1eb175082010-02-10 09:26:16679 // any in the extension preferences file.
[email protected]650b2d52013-02-10 03:41:45680 typedef std::map<std::string, base::FilePath> UnloadedExtensionPathMap;
[email protected]1eb175082010-02-10 09:26:16681 UnloadedExtensionPathMap unloaded_extension_paths_;
682
[email protected]b914e2952013-04-26 07:10:03683 // Store the ids of reloading extensions.
684 std::set<std::string> reloading_extensions_;
[email protected]f17dbd42010-08-16 23:21:10685
[email protected]04ea1bb2013-07-10 09:26:09686 // Map of DevToolsAgentHost instances that are detached,
687 // waiting for an extension to be reloaded.
688 typedef std::map<std::string, scoped_refptr<content::DevToolsAgentHost> >
689 OrphanedDevTools;
[email protected]4814b512009-11-07 00:12:29690 OrphanedDevTools orphaned_dev_tools_;
691
[email protected]6c2381d2011-10-19 02:52:53692 content::NotificationRegistrar registrar_;
[email protected]2fb7dc982010-09-29 12:24:28693 PrefChangeRegistrar pref_change_registrar_;
[email protected]4814b512009-11-07 00:12:29694
[email protected]d8c8f25f2011-11-02 18:18:01695 // Keeps track of loading and unloading component extensions.
696 scoped_ptr<extensions::ComponentLoader> component_loader_;
697
[email protected]8e4560b62011-01-14 10:09:14698 // A collection of external extension providers. Each provider reads
699 // a source of external extension information. Examples include the
700 // windows registry and external_extensions.json.
[email protected]5df038b2012-07-16 19:03:27701 extensions::ProviderCollection external_extension_providers_;
[email protected]8e4560b62011-01-14 10:09:14702
703 // Set to true by OnExternalExtensionUpdateUrlFound() when an external
[email protected]94fde232012-04-27 10:22:30704 // extension URL is found, and by CheckForUpdatesSoon() when an update check
705 // has to wait for the external providers. Used in
706 // OnAllExternalProvidersReady() to determine if an update check is needed to
707 // install pending extensions.
708 bool update_once_all_providers_are_ready_;
[email protected]8e4560b62011-01-14 10:09:14709
[email protected]4e9b59d2013-12-18 06:47:14710 // A callback to be called when all external providers are ready and their
711 // extensions have been installed. Normally this is a null callback, but
712 // is used in external provider related tests.
713 base::Closure external_updates_finished_callback_;
714
[email protected]3c4abc82012-10-22 22:25:54715 // Set when the browser is terminating. Prevents us from installing or
716 // updating additional extensions and allows in-progress installations to
717 // decide to abort.
718 bool browser_terminating_;
719
[email protected]9f4e4f082013-06-21 07:11:19720 // Set to true to delay all new extension installations. Acts as a lock to
721 // allow background processing of garbage collection of on-disk state without
722 // needing to worry about race conditions caused by extension installation and
723 // reinstallation.
724 bool installs_delayed_for_gc_;
[email protected]399583b2012-12-11 09:33:42725
[email protected]460c6712013-04-24 07:20:01726 // Set to true if this is the first time this ExtensionService has run.
727 // Used for specially handling external extensions that are installed the
728 // first time.
729 bool is_first_run_;
730
[email protected]e178ad92013-06-28 02:29:25731 // A set of the extension ids currently being reloaded. We use this to
732 // avoid showing a "new install" notice for an extension reinstall.
733 std::set<std::string> extensions_being_reloaded_;
734
[email protected]3964e572014-02-13 21:57:41735 // A set of the extension ids currently being terminated. We use this to
736 // avoid trying to unload the same extension twice.
737 std::set<std::string> extensions_being_terminated_;
738
[email protected]89226982012-07-16 20:09:18739 scoped_ptr<ExtensionErrorUI> extension_error_ui_;
[email protected]7f8f24f2012-11-15 19:40:14740 // Sequenced task runner for extension related file operations.
741 scoped_refptr<base::SequencedTaskRunner> file_task_runner_;
[email protected]a9aa5932012-01-25 08:27:40742
[email protected]9ce11d22012-08-08 23:20:13743#if defined(ENABLE_EXTENSIONS)
[email protected]c77f2352012-08-08 22:07:58744 scoped_ptr<extensions::ExtensionActionStorageManager>
745 extension_action_storage_manager_;
[email protected]9ce11d22012-08-08 23:20:13746#endif
[email protected]4c9201c42013-08-16 04:56:21747 scoped_ptr<extensions::ManagementPolicy::Provider>
748 shared_module_policy_provider_;
[email protected]c77f2352012-08-08 22:07:58749
[email protected]e5f8fffe2014-04-02 00:30:44750 // The ExtensionGarbageCollector to clean up all the garbage that leaks into
751 // the extensions directory.
752 scoped_ptr<extensions::ExtensionGarbageCollector> garbage_collector_;
[email protected]c04fd3dd2013-09-05 08:20:10753
[email protected]e5f8fffe2014-04-02 00:30:44754 ObserverList<extensions::UpdateObserver, true> update_observers_;
[email protected]efdb7f1a2014-03-28 20:43:38755
[email protected]eaa7dd182010-12-14 11:09:00756 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
[email protected]c2c263c2010-08-13 21:59:48757 InstallAppsWithUnlimtedStorage);
[email protected]eaa7dd182010-12-14 11:09:00758 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
[email protected]654512b2010-09-01 02:09:42759 InstallAppsAndCheckStorageProtection);
[email protected]f71b582c2014-01-10 17:03:15760 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, SetUnsetBlacklistInPrefs);
761 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
762 BlacklistedExtensionWillNotInstall);
763 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
764 UnloadBlacklistedExtensionPolicy);
765 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
766 WillNotLoadBlacklistedExtensionsFromDirectory);
767 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
768 BlacklistedInPrefsFromStartup);
[email protected]2d19eb6e2014-01-27 17:30:00769 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
770 GreylistedExtensionDisabled);
771 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
772 GreylistDontEnableManuallyDisabled);
773 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
774 GreylistUnknownDontChange);
[email protected]eaa7dd182010-12-14 11:09:00775 DISALLOW_COPY_AND_ASSIGN(ExtensionService);
[email protected]6014d672008-12-05 00:38:25776};
777
[email protected]eaa7dd182010-12-14 11:09:00778#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_