blob: 5cff5867a681dc917cc35895da78fd49afd413ca [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]da50530a2009-06-15 17:43:018#include <map>
asargent56282ab72016-09-09 16:58:039#include <memory>
[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"
avia2f4804a2015-12-24 23:11:1317#include "base/macros.h"
[email protected]3b63f8f42011-03-28 01:54:1518#include "base/memory/ref_counted.h"
[email protected]14908b72011-04-20 06:54:3619#include "base/memory/weak_ptr.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"
binjin1569c9b2014-09-05 13:33:1822#include "chrome/browser/extensions/extension_management.h"
xiyuanf6a4c6a62016-04-19 18:14:5423#include "chrome/browser/extensions/install_gate.h"
[email protected]f3d3b382014-03-14 21:19:2824#include "chrome/browser/extensions/pending_extension_manager.h"
weidongg04695232017-06-09 00:01:0525#include "chrome/browser/upgrade_observer.h"
skym71603842016-10-10 18:17:3126#include "components/sync/model/string_ordinal.h"
[email protected]6c2381d2011-10-19 02:52:5327#include "content/public/browser/notification_observer.h"
28#include "content/public/browser/notification_registrar.h"
ginkage553af3202015-02-04 12:39:0929#include "extensions/browser/crx_file_info.h"
xiyuanf6a4c6a62016-04-19 18:14:5430#include "extensions/browser/extension_prefs.h"
[email protected]301116c62013-11-26 10:37:4531#include "extensions/browser/external_provider_interface.h"
[email protected]4a1d9c0d2014-06-13 12:50:1132#include "extensions/browser/install_flag.h"
[email protected]98b6d942013-11-10 00:34:0733#include "extensions/browser/process_manager.h"
[email protected]e43c61f2014-07-20 21:46:3434#include "extensions/browser/uninstall_reason.h"
[email protected]e4452d32013-11-15 23:07:4135#include "extensions/common/extension.h"
[email protected]289c44b2013-12-17 03:26:5736#include "extensions/common/extension_set.h"
[email protected]d42c11152013-08-22 19:36:3237#include "extensions/common/manifest.h"
brettw00899e62016-11-12 02:10:1738#include "extensions/features/features.h"
[email protected]6014d672008-12-05 00:38:2539
brettw00899e62016-11-12 02:10:1740#if !BUILDFLAG(ENABLE_EXTENSIONS)
thestig44b9ce22014-10-17 03:19:2841#error "Extensions must be enabled"
42#endif
43
mukai87a8d402014-09-15 20:15:0944class HostContentSettingsMap;
[email protected]81e63782009-02-27 19:35:0945class Profile;
[email protected]aa142702010-03-26 01:26:3346
[email protected]7f8f24f2012-11-15 19:40:1447namespace base {
[email protected]2f3b1cc2014-03-17 23:07:1548class CommandLine;
[email protected]7f8f24f2012-11-15 19:40:1449class SequencedTaskRunner;
50}
51
[email protected]dccba4f82014-05-29 00:52:5652namespace content {
53class DevToolsAgentHost;
54}
55
[email protected]9c70e0d92012-07-16 08:39:4456namespace extensions {
ryanackley48bedbd2015-01-27 23:12:1457class AppDataMigrator;
[email protected]d8c8f25f2011-11-02 18:18:0158class ComponentLoader;
[email protected]bf3d9df2012-07-24 23:20:2759class CrxInstaller;
[email protected]c77f2352012-08-08 22:07:5860class ExtensionActionStorageManager;
[email protected]373daf972014-04-10 01:50:4461class ExtensionErrorController;
[email protected]bb1bc9b32013-12-21 03:09:1462class ExtensionRegistry;
[email protected]bd306722012-07-11 20:43:5963class ExtensionSystem;
[email protected]42a08162012-03-16 18:09:1164class ExtensionUpdater;
[email protected]2894a512014-06-26 19:03:5665class ExternalInstallManager;
rdevlin.croninf5863da2015-09-10 19:21:4566class OneShotEvent;
rdevlin.cronin5e510e802016-07-26 15:09:2067class RendererStartupHelper;
[email protected]90878c52014-04-04 18:21:0268class SharedModuleService;
[email protected]a9aa62b312013-11-29 05:35:0669class UpdateObserver;
[email protected]9f4e4f082013-06-21 07:11:1970} // namespace extensions
[email protected]163ed192012-07-24 19:31:0771
[email protected]d1ca0ed12009-07-01 18:24:3272// This is an interface class to encapsulate the dependencies that
[email protected]2859946f2011-04-04 18:18:0673// various classes have on ExtensionService. This allows easy mocking.
[email protected]f8aefb132013-10-30 09:29:5274class ExtensionServiceInterface
75 : public base::SupportsWeakPtr<ExtensionServiceInterface> {
[email protected]d1ca0ed12009-07-01 18:24:3276 public:
[email protected]2859946f2011-04-04 18:18:0677 virtual ~ExtensionServiceInterface() {}
[email protected]ca975942014-01-07 12:06:4778
[email protected]dccba4f82014-05-29 00:52:5679 // Gets the object managing the set of pending extensions.
[email protected]3f213ad2012-07-26 23:39:4180 virtual extensions::PendingExtensionManager* pending_extension_manager() = 0;
[email protected]420a0ec2011-06-01 01:07:0381
[email protected]dccba4f82014-05-29 00:52:5682 // Installs an update with the contents from |extension_path|. Returns true if
83 // the install can be started. Sets |out_crx_installer| to the installer if
84 // one was started.
85 // TODO(aa): This method can be removed. ExtensionUpdater could use
86 // CrxInstaller directly instead.
[email protected]420a0ec2011-06-01 01:07:0387 virtual bool UpdateExtension(
ginkage553af3202015-02-04 12:39:0988 const extensions::CRXFileInfo& file,
[email protected]044e86992014-01-24 22:59:1189 bool file_ownership_passed,
[email protected]bf3d9df2012-07-24 23:20:2790 extensions::CrxInstaller** out_crx_installer) = 0;
[email protected]dccba4f82014-05-29 00:52:5691
[email protected]eb245382014-07-28 22:23:1492 // DEPRECATED. Use ExtensionRegistry instead.
93 //
94 // Looks up an extension by its ID.
95 //
96 // If |include_disabled| is false then this will only include enabled
97 // extensions. Use instead:
98 //
99 // ExtensionRegistry::enabled_extensions().GetByID(id).
100 //
101 // If |include_disabled| is true then this will also include disabled and
102 // blacklisted extensions (not terminated extensions). Use instead:
103 //
104 // ExtensionRegistry::GetExtensionById(
105 // id, ExtensionRegistry::ENABLED |
106 // ExtensionRegistry::DISABLED |
107 // ExtensionRegistry::BLACKLISTED)
108 //
109 // Or don't, because it's probably not something you ever need to know.
[email protected]f574c402012-12-04 23:20:31110 virtual const extensions::Extension* GetExtensionById(
111 const std::string& id,
112 bool include_disabled) const = 0;
[email protected]dccba4f82014-05-29 00:52:56113
[email protected]eb245382014-07-28 22:23:14114 // DEPRECATED: Use ExtensionRegistry instead.
115 //
[email protected]dccba4f82014-05-29 00:52:56116 // Looks up an extension by ID, regardless of whether it's enabled,
[email protected]eb245382014-07-28 22:23:14117 // disabled, blacklisted, or terminated. Use instead:
118 //
sudarsana.naginenidb931782015-06-05 12:01:50119 // ExtensionRegistry::GetInstalledExtension(id).
[email protected]1c321ee2012-05-21 03:02:34120 virtual const extensions::Extension* GetInstalledExtension(
[email protected]8001df22011-04-28 19:59:47121 const std::string& id) const = 0;
[email protected]2859946f2011-04-04 18:18:06122
[email protected]dccba4f82014-05-29 00:52:56123 // Returns an update for an extension with the specified id, if installation
124 // of that update was previously delayed because the extension was in use. If
125 // no updates are pending for the extension returns NULL.
[email protected]76b65442012-11-17 14:11:48126 virtual const extensions::Extension* GetPendingExtensionUpdate(
127 const std::string& extension_id) const = 0;
[email protected]dccba4f82014-05-29 00:52:56128
129 // Finishes installation of an update for an extension with the specified id,
130 // when installation of that extension was previously delayed because the
131 // extension was in use.
[email protected]6f6101832012-11-27 22:10:48132 virtual void FinishDelayedInstallation(const std::string& extension_id) = 0;
[email protected]76b65442012-11-17 14:11:48133
[email protected]dccba4f82014-05-29 00:52:56134 // Returns true if the extension with the given |extension_id| is enabled.
mfoltz96f329c2016-01-13 18:16:58135 // This will only return a valid answer for installed extensions (regardless
136 // of whether it is currently loaded or not). Loaded extensions return true
137 // if they are currently loaded or terminated. Unloaded extensions will
138 // return true if they are not blocked, disabled, blacklisted or uninstalled
139 // (for external extensions).
[email protected]c3cfb012011-04-06 22:07:35140 virtual bool IsExtensionEnabled(const std::string& extension_id) const = 0;
[email protected]2859946f2011-04-04 18:18:06141
[email protected]dccba4f82014-05-29 00:52:56142 // Go through each extension and unload those that are not allowed to run by
143 // management policy providers (ie. network admin and Google-managed
144 // blacklist).
[email protected]4ee07c62012-08-21 12:40:42145 virtual void CheckManagementPolicy() = 0;
[email protected]5ef47ec2010-01-28 05:58:05146
[email protected]31206602011-04-13 23:07:32147 // Safe to call multiple times in a row.
148 //
[email protected]90310d92011-04-17 07:35:04149 // TODO(akalin): Remove this method (and others) once we refactor
150 // themes sync to not use it directly.
[email protected]31206602011-04-13 23:07:32151 virtual void CheckForUpdatesSoon() = 0;
[email protected]25ae0152011-11-18 14:40:02152
[email protected]dccba4f82014-05-29 00:52:56153 // Adds |extension| to this ExtensionService and notifies observers that the
154 // extensions have been loaded.
[email protected]1c321ee2012-05-21 03:02:34155 virtual void AddExtension(const extensions::Extension* extension) = 0;
[email protected]dccba4f82014-05-29 00:52:56156
157 // Check if we have preferences for the component extension and, if not or if
158 // the stored version differs, install the extension (without requirements
159 // checking) before calling AddExtension.
[email protected]8c484b742012-11-29 06:05:36160 virtual void AddComponentExtension(
161 const extensions::Extension* extension) = 0;
[email protected]25ae0152011-11-18 14:40:02162
[email protected]dccba4f82014-05-29 00:52:56163 // Unload the specified extension.
limasdf0deef2042017-05-03 19:17:17164 virtual void UnloadExtension(const std::string& extension_id,
165 extensions::UnloadedExtensionReason reason) = 0;
[email protected]dccba4f82014-05-29 00:52:56166
167 // Remove the specified component extension.
[email protected]8b1ec202013-09-05 02:09:50168 virtual void RemoveComponentExtension(const std::string& extension_id) = 0;
[email protected]25ae0152011-11-18 14:40:02169
[email protected]dccba4f82014-05-29 00:52:56170 // Whether the extension service is ready.
[email protected]25ae0152011-11-18 14:40:02171 virtual bool is_ready() = 0;
[email protected]7f8f24f2012-11-15 19:40:14172
173 // Returns task runner for crx installation file I/O operations.
174 virtual base::SequencedTaskRunner* GetFileTaskRunner() = 0;
[email protected]d1ca0ed12009-07-01 18:24:32175};
[email protected]fbcc40302009-06-12 20:45:45176
[email protected]fafdc842014-01-17 18:09:08177// Manages installed and running Chromium extensions. An instance is shared
178// between normal and incognito profiles.
[email protected]eaa7dd182010-12-14 11:09:00179class ExtensionService
[email protected]14908b72011-04-20 06:54:36180 : public ExtensionServiceInterface,
[email protected]5df038b2012-07-16 19:03:27181 public extensions::ExternalProviderInterface::VisitorInterface,
[email protected]fdd679b2012-11-15 20:49:39182 public content::NotificationObserver,
binjin1569c9b2014-09-05 13:33:18183 public extensions::Blacklist::Observer,
weidongg04695232017-06-09 00:01:05184 public extensions::ExtensionManagement::Observer,
185 public UpgradeObserver {
[email protected]4f313d52009-05-21 00:42:29186 public:
[email protected]6aeac8342010-10-01 20:21:18187 // Attempts to uninstall an extension from a given ExtensionService. Returns
188 // true iff the target extension exists.
[email protected]eaa7dd182010-12-14 11:09:00189 static bool UninstallExtensionHelper(ExtensionService* extensions_service,
[email protected]cc2f55c2014-07-08 02:19:04190 const std::string& extension_id,
[email protected]e43c61f2014-07-20 21:46:34191 extensions::UninstallReason reason);
[email protected]6aeac8342010-10-01 20:21:18192
[email protected]73c47932010-12-06 18:13:43193 // Constructor stores pointers to |profile| and |extension_prefs| but
194 // ownership remains at caller.
[email protected]eaa7dd182010-12-14 11:09:00195 ExtensionService(Profile* profile,
[email protected]2f3b1cc2014-03-17 23:07:15196 const base::CommandLine* command_line,
[email protected]650b2d52013-02-10 03:41:45197 const base::FilePath& install_directory,
[email protected]45759612012-07-10 17:21:23198 extensions::ExtensionPrefs* extension_prefs,
[email protected]fdd679b2012-11-15 20:49:39199 extensions::Blacklist* blacklist,
[email protected]0436b102011-04-15 18:30:03200 bool autoupdate_enabled,
[email protected]4a10006a2013-05-17 23:18:35201 bool extensions_enabled,
202 extensions::OneShotEvent* ready);
[email protected]6014d672008-12-05 00:38:25203
dchengae36a4a2014-10-21 12:36:36204 ~ExtensionService() override;
[email protected]14908b72011-04-20 06:54:36205
[email protected]eb245382014-07-28 22:23:14206 // ExtensionServiceInterface implementation.
207 //
208 // NOTE: Many of these methods are DEPRECATED. See the interface for details.
dchengae36a4a2014-10-21 12:36:36209 extensions::PendingExtensionManager* pending_extension_manager() override;
210 const extensions::Extension* GetExtensionById(
[email protected]dccba4f82014-05-29 00:52:56211 const std::string& id,
dchengae36a4a2014-10-21 12:36:36212 bool include_disabled) const override;
213 const extensions::Extension* GetInstalledExtension(
214 const std::string& id) const override;
ginkage553af3202015-02-04 12:39:09215 bool UpdateExtension(const extensions::CRXFileInfo& file,
dchengae36a4a2014-10-21 12:36:36216 bool file_ownership_passed,
217 extensions::CrxInstaller** out_crx_installer) override;
218 bool IsExtensionEnabled(const std::string& extension_id) const override;
limasdf0deef2042017-05-03 19:17:17219 void UnloadExtension(const std::string& extension_id,
220 extensions::UnloadedExtensionReason reason) override;
dchengae36a4a2014-10-21 12:36:36221 void RemoveComponentExtension(const std::string& extension_id) override;
222 void AddExtension(const extensions::Extension* extension) override;
223 void AddComponentExtension(const extensions::Extension* extension) override;
224 const extensions::Extension* GetPendingExtensionUpdate(
mostynba15bee12014-10-04 00:40:32225 const std::string& extension_id) const override;
dchengae36a4a2014-10-21 12:36:36226 void FinishDelayedInstallation(const std::string& extension_id) override;
227 void CheckManagementPolicy() override;
228 void CheckForUpdatesSoon() override;
229 bool is_ready() override;
230 base::SequencedTaskRunner* GetFileTaskRunner() override;
[email protected]aa142702010-03-26 01:26:33231
lazyboye8634172016-01-28 00:10:48232 // ExternalProvider::VisitorInterface implementation.
[email protected]dccba4f82014-05-29 00:52:56233 // Exposed for testing.
lazyboye8634172016-01-28 00:10:48234 bool OnExternalExtensionFileFound(
235 const extensions::ExternalInstallInfoFile& info) override;
dchengae36a4a2014-10-21 12:36:36236 bool OnExternalExtensionUpdateUrlFound(
lazyboye8634172016-01-28 00:10:48237 const extensions::ExternalInstallInfoUpdateUrl& info,
238 bool is_initial_load) override;
dchengae36a4a2014-10-21 12:36:36239 void OnExternalProviderReady(
mostynba15bee12014-10-04 00:40:32240 const extensions::ExternalProviderInterface* provider) override;
lazyboye8634172016-01-28 00:10:48241 void OnExternalProviderUpdateComplete(
242 const extensions::ExternalProviderInterface* provider,
lazyboy4aeef202016-09-07 21:28:59243 const std::vector<
244 std::unique_ptr<extensions::ExternalInstallInfoUpdateUrl>>&
lazyboye8634172016-01-28 00:10:48245 external_update_url_extensions,
lazyboy4aeef202016-09-07 21:28:59246 const std::vector<std::unique_ptr<extensions::ExternalInstallInfoFile>>&
lazyboye8634172016-01-28 00:10:48247 external_file_extensions,
248 const std::set<std::string>& removed_extensions) override;
[email protected]ec5b50d2010-10-09 16:35:18249
binjin1569c9b2014-09-05 13:33:18250 // ExtensionManagement::Observer implementation:
dchengae36a4a2014-10-21 12:36:36251 void OnExtensionManagementSettingsChanged() override;
binjin1569c9b2014-09-05 13:33:18252
[email protected]6014d672008-12-05 00:38:25253 // Initialize and start all installed extensions.
[email protected]9f1087e2009-06-15 17:29:32254 void Init();
[email protected]6014d672008-12-05 00:38:25255
[email protected]47b896562012-08-22 23:55:15256 // Called when the associated Profile is going to be destroyed.
257 void Shutdown();
258
[email protected]2380c6b2013-01-09 02:33:13259 // Reloads the specified extension, sending the onLaunched() event to it if it
260 // currently has any window showing.
[email protected]bca4b832014-07-17 20:22:34261 // Allows noisy failures.
thestig7b4bd932014-09-09 22:44:31262 // NOTE: Reloading an extension can invalidate |extension_id| and Extension
263 // pointers for the given extension. Consider making a copy of |extension_id|
264 // first and retrieving a new Extension pointer afterwards.
[email protected]757d60a2014-05-23 00:11:44265 void ReloadExtension(const std::string& extension_id);
[email protected]9cddd4702009-07-27 22:09:40266
[email protected]bca4b832014-07-17 20:22:34267 // Suppresses noisy failures.
268 void ReloadExtensionWithQuietFailure(const std::string& extension_id);
269
[email protected]631cf822009-05-15 07:01:25270 // Uninstalls the specified extension. Callers should only call this method
[email protected]cc2f55c2014-07-08 02:19:04271 // with extensions that exist. |reason| lets the caller specify why the
272 // extension is uninstalled.
[email protected]42d58f62014-07-31 01:32:45273 //
274 // If the return value is true, |deletion_done_callback| is invoked when data
275 // deletion is done or at least is scheduled.
[email protected]0bb29bd2014-04-30 21:39:18276 virtual bool UninstallExtension(const std::string& extension_id,
[email protected]e43c61f2014-07-20 21:46:34277 extensions::UninstallReason reason,
[email protected]42d58f62014-07-31 01:32:45278 const base::Closure& deletion_done_callback,
[email protected]439f1e32013-12-09 20:09:09279 base::string16* error);
[email protected]631cf822009-05-15 07:01:25280
[email protected]06f92562011-04-29 19:27:31281 // Enables the extension. If the extension is already enabled, does
282 // nothing.
[email protected]2859946f2011-04-04 18:18:06283 virtual void EnableExtension(const std::string& extension_id);
[email protected]06f92562011-04-29 19:27:31284
treibc1192322015-05-20 12:56:07285 // Disables the extension. If the extension is already disabled, just adds
286 // the |disable_reasons| (a bitmask of Extension::DisableReason - there can
287 // be multiple DisableReasons e.g. when an extension comes in disabled from
288 // Sync). If the extension cannot be disabled (due to policy), does nothing.
289 virtual void DisableExtension(const std::string& extension_id,
290 int disable_reasons);
[email protected]0c6da502009-08-14 22:32:39291
[email protected]3082fe32013-08-06 11:12:38292 // Disable non-default and non-managed extensions with ids not in
293 // |except_ids|. Default extensions are those from the Web Store with
294 // |was_installed_by_default| flag.
mtomasz294bb3e2017-01-24 02:17:52295 void DisableUserExtensionsExcept(const std::vector<std::string>& except_ids);
[email protected]e516e4c2013-06-12 17:41:14296
mlerman6a37b6a42014-11-26 22:10:53297 // Puts all extensions in a blocked state: Unloading every extension, and
298 // preventing them from ever loading until UnblockAllExtensions is called.
299 // This state is stored in preferences, so persists until Chrome restarts.
300 //
301 // Component, external component and whitelisted policy installed extensions
302 // are exempt from being Blocked (see CanBlockExtension).
303 void BlockAllExtensions();
304
305 // All blocked extensions are reverted to their previous state, and are
306 // reloaded. Newly added extensions are no longer automatically blocked.
307 void UnblockAllExtensions();
308
[email protected]8d888c12010-11-30 00:00:25309 // Updates the |extension|'s granted permissions lists to include all
[email protected]8d888c12010-11-30 00:00:25310 // permissions in the |extension|'s manifest and re-enables the
311 // extension.
[email protected]1c321ee2012-05-21 03:02:34312 void GrantPermissionsAndEnableExtension(
[email protected]009633c2013-03-07 22:08:28313 const extensions::Extension* extension);
[email protected]8d888c12010-11-30 00:00:25314
[email protected]be083862012-09-01 03:53:45315 // Updates the |extension|'s granted permissions lists to include all
316 // permissions in the |extensions|'s manifest.
[email protected]dccba4f82014-05-29 00:52:56317 void GrantPermissions(const extensions::Extension* extension);
[email protected]be083862012-09-01 03:53:45318
[email protected]9f1087e2009-06-15 17:29:32319 // Check for updates (or potentially new extensions from external providers)
[email protected]93fd78f42009-07-10 16:43:17320 void CheckForExternalUpdates();
[email protected]9f1087e2009-06-15 17:29:32321
[email protected]bc151cf92013-02-12 04:57:26322 // Informs the service that an extension's files are in place for loading.
323 //
[email protected]4a1d9c0d2014-06-13 12:50:11324 // |extension| the extension
325 // |page_ordinal| the location of the extension in the app launcher
326 // |install_flags| a bitmask of extensions::InstallFlags
[email protected]dccba4f82014-05-29 00:52:56327 void OnExtensionInstalled(const extensions::Extension* extension,
328 const syncer::StringOrdinal& page_ordinal,
[email protected]4a1d9c0d2014-06-13 12:50:11329 int install_flags);
330 void OnExtensionInstalled(const extensions::Extension* extension,
331 const syncer::StringOrdinal& page_ordinal) {
332 OnExtensionInstalled(extension,
333 page_ordinal,
334 static_cast<int>(extensions::kInstallFlagNone));
335 }
[email protected]0db124b02012-11-07 04:55:05336
[email protected]9f4e4f082013-06-21 07:11:19337 // Checks for delayed installation for all pending installs.
338 void MaybeFinishDelayedInstallations();
339
[email protected]406027c02010-09-27 08:03:18340 // ExtensionHost of background page calls this method right after its render
341 // view has been created.
[email protected]3a1dc572012-07-31 22:25:13342 void DidCreateRenderViewForBackgroundPage(extensions::ExtensionHost* host);
[email protected]406027c02010-09-27 08:03:18343
[email protected]fe2dd7742011-04-19 22:52:49344 // Record a histogram using the PermissionMessage enum values for each
345 // permission in |e|.
346 // NOTE: If this is ever called with high frequency, the implementation may
347 // need to be made more efficient.
348 static void RecordPermissionMessagesHistogram(
[email protected]dccba4f82014-05-29 00:52:56349 const extensions::Extension* extension, const char* histogram);
[email protected]fe2dd7742011-04-19 22:52:49350
[email protected]e9d7496e2014-04-18 01:25:46351 // Unloads the given extension and mark the extension as terminated. This
352 // doesn't notify the user that the extension was terminated, if such a
353 // notification is desired the calling code is responsible for doing that.
354 void TerminateExtension(const std::string& extension_id);
355
mukai87a8d402014-09-15 20:15:09356 // Register self and content settings API with the specified map.
mmenkead5094ab2017-05-15 19:01:14357 static void RegisterContentSettings(
358 HostContentSettingsMap* host_content_settings_map,
359 Profile* profile);
mukai87a8d402014-09-15 20:15:09360
[email protected]dccba4f82014-05-29 00:52:56361 // Adds/Removes update observers.
362 void AddUpdateObserver(extensions::UpdateObserver* observer);
363 void RemoveUpdateObserver(extensions::UpdateObserver* observer);
[email protected]a51c9e92012-12-09 09:19:20364
xiyuanf6a4c6a62016-04-19 18:14:54365 // Register/unregister an InstallGate with the service.
366 void RegisterInstallGate(extensions::ExtensionPrefs::DelayReason reason,
367 extensions::InstallGate* install_delayer);
368 void UnregisterInstallGate(extensions::InstallGate* install_delayer);
369
[email protected]dccba4f82014-05-29 00:52:56370 //////////////////////////////////////////////////////////////////////////////
371 // Simple Accessors
[email protected]fa2416f2011-05-03 08:41:20372
[email protected]dccba4f82014-05-29 00:52:56373 // Returns a WeakPtr to the ExtensionService.
[email protected]77e4dc0882012-06-20 18:53:50374 base::WeakPtr<ExtensionService> AsWeakPtr() { return base::AsWeakPtr(this); }
375
[email protected]dccba4f82014-05-29 00:52:56376 // Returns profile_ as a BrowserContext.
377 content::BrowserContext* GetBrowserContext() const;
378
379 bool extensions_enabled() const { return extensions_enabled_; }
[email protected]dccba4f82014-05-29 00:52:56380
381 const base::FilePath& install_directory() const { return install_directory_; }
382
383 const extensions::ExtensionSet* delayed_installs() const {
384 return &delayed_installs_;
385 }
386
[email protected]dccba4f82014-05-29 00:52:56387 Profile* profile() { return profile_; }
388
[email protected]dccba4f82014-05-29 00:52:56389 // Note that this may return NULL if autoupdate is not turned on.
390 extensions::ExtensionUpdater* updater() { return updater_.get(); }
391
392 extensions::ComponentLoader* component_loader() {
393 return component_loader_.get();
394 }
395
[email protected]3c4abc82012-10-22 22:25:54396 bool browser_terminating() const { return browser_terminating_; }
397
[email protected]90878c52014-04-04 18:21:02398 extensions::SharedModuleService* shared_module_service() {
399 return shared_module_service_.get();
400 }
401
[email protected]2894a512014-06-26 19:03:56402 extensions::ExternalInstallManager* external_install_manager() {
403 return external_install_manager_.get();
404 }
405
[email protected]dccba4f82014-05-29 00:52:56406 //////////////////////////////////////////////////////////////////////////////
407 // For Testing
408
409 // Unload all extensions. Does not send notifications.
410 void UnloadAllExtensionsForTest();
411
412 // Reloads all extensions. Does not notify that extensions are ready.
413 void ReloadExtensionsForTest();
414
415 // Clear all ExternalProviders.
416 void ClearProvidersForTesting();
417
418 // Adds an ExternalProviderInterface for the service to use during testing.
[email protected]dccba4f82014-05-29 00:52:56419 void AddProviderForTesting(
lazyboyf33109d2016-08-31 00:37:08420 std::unique_ptr<extensions::ExternalProviderInterface> test_provider);
[email protected]dccba4f82014-05-29 00:52:56421
[email protected]8f959f522014-08-06 06:26:28422 // Simulate an extension being blacklisted for tests.
423 void BlacklistExtensionForTest(const std::string& extension_id);
424
[email protected]dccba4f82014-05-29 00:52:56425#if defined(UNIT_TEST)
426 void TrackTerminatedExtensionForTest(const extensions::Extension* extension) {
xiyuane87def2e2015-06-04 22:50:22427 TrackTerminatedExtension(extension->id());
[email protected]dccba4f82014-05-29 00:52:56428 }
429
430 void FinishInstallationForTest(const extensions::Extension* extension) {
benwells1dd4acd2015-12-09 02:20:24431 FinishInstallation(extension);
[email protected]dccba4f82014-05-29 00:52:56432 }
Takumi Fujimoto43c8c00f2017-07-26 22:48:56433
434 void UninstallMigratedExtensionsForTest() { UninstallMigratedExtensions(); }
[email protected]dccba4f82014-05-29 00:52:56435#endif
436
[email protected]3c4abc82012-10-22 22:25:54437 void set_browser_terminating_for_test(bool value) {
438 browser_terminating_ = value;
439 }
440
[email protected]4e9b59d2013-12-18 06:47:14441 // Set a callback to be called when all external providers are ready and their
442 // extensions have been installed.
443 void set_external_updates_finished_callback_for_test(
444 const base::Closure& callback) {
445 external_updates_finished_callback_ = callback;
446 }
447
lazyboy77214d3c2017-04-04 16:46:12448 void set_external_updates_disabled_for_test(bool value) {
449 external_updates_disabled_for_test_ = value;
450 }
451
[email protected]14908b72011-04-20 06:54:36452 private:
catmullings98cd1942016-08-30 22:31:59453 // Loads extensions specified via a command line flag/switch.
454 void LoadExtensionsFromCommandLineFlag(const char* switch_name);
455
[email protected]bca4b832014-07-17 20:22:34456 // Reloads the specified extension, sending the onLaunched() event to it if it
457 // currently has any window showing. |be_noisy| determines whether noisy
458 // failures are allowed for unpacked extension installs.
459 void ReloadExtensionImpl(const std::string& extension_id, bool be_noisy);
460
[email protected]dccba4f82014-05-29 00:52:56461 // content::NotificationObserver implementation:
dchengae36a4a2014-10-21 12:36:36462 void Observe(int type,
463 const content::NotificationSource& source,
464 const content::NotificationDetails& details) override;
[email protected]dccba4f82014-05-29 00:52:56465
466 // extensions::Blacklist::Observer implementation.
dchengae36a4a2014-10-21 12:36:36467 void OnBlacklistUpdated() override;
[email protected]dccba4f82014-05-29 00:52:56468
weidongg04695232017-06-09 00:01:05469 // UpgradeObserver implementation.
470 void OnUpgradeRecommended() override;
471
[email protected]dccba4f82014-05-29 00:52:56472 // Similar to FinishInstallation, but first checks if there still is an update
473 // pending for the extension, and makes sure the extension is still idle.
474 void MaybeFinishDelayedInstallation(const std::string& extension_id);
475
476 // For the extension in |version_path| with |id|, check to see if it's an
477 // externally managed extension. If so, uninstall it.
478 void CheckExternalUninstall(const std::string& id);
479
rkaplowa8fd8d32015-02-25 21:27:56480 // Attempt to enable all disabled extensions which the only disabled reason is
481 // reloading.
482 void EnabledReloadableExtensions();
483
484 // Finish install (if possible) of extensions that were still delayed while
485 // the browser was shut down.
486 void MaybeFinishShutdownDelayed();
487
[email protected]2d19eb6e2014-01-27 17:30:00488 // Populates greylist_.
489 void LoadGreylistFromPrefs();
490
[email protected]4a10006a2013-05-17 23:18:35491 // Signals *ready_ and sends a notification to the listeners.
[email protected]820d9bd2013-04-03 03:46:03492 void SetReadyAndNotifyListeners();
493
[email protected]dccba4f82014-05-29 00:52:56494 // Returns true if all the external extension providers are ready.
495 bool AreAllExternalProvidersReady() const;
496
497 // Called once all external providers are ready. Checks for unclaimed
498 // external extensions.
499 void OnAllExternalProvidersReady();
500
xiyuane87def2e2015-06-04 22:50:22501 // Adds the given extension id to the list of terminated extensions if
[email protected]fa2416f2011-05-03 08:41:20502 // it is not already there and unloads it.
xiyuane87def2e2015-06-04 22:50:22503 void TrackTerminatedExtension(const std::string& extension_id);
[email protected]fa2416f2011-05-03 08:41:20504
505 // Removes the extension with the given id from the list of
506 // terminated extensions if it is there.
[email protected]bb7f40952011-01-13 00:21:20507 void UntrackTerminatedExtension(const std::string& id);
508
[email protected]8c484b742012-11-29 06:05:36509 // Update preferences for a new or updated extension; notify observers that
510 // the extension is installed, e.g., to update event handlers on background
511 // pages; and perform other extension install tasks before calling
512 // AddExtension.
[email protected]4a1d9c0d2014-06-13 12:50:11513 // |install_flags| is a bitmask of extensions::InstallFlags.
[email protected]d8fd0fd2014-03-24 13:16:06514 void AddNewOrUpdatedExtension(const extensions::Extension* extension,
515 extensions::Extension::State initial_state,
[email protected]4a1d9c0d2014-06-13 12:50:11516 int install_flags,
[email protected]d8fd0fd2014-03-24 13:16:06517 const syncer::StringOrdinal& page_ordinal,
518 const std::string& install_parameter);
[email protected]8c484b742012-11-29 06:05:36519
[email protected]62d30f42009-10-01 22:36:06520 // Handles sending notification that |extension| was loaded.
[email protected]1c321ee2012-05-21 03:02:34521 void NotifyExtensionLoaded(const extensions::Extension* extension);
[email protected]62d30f42009-10-01 22:36:06522
rockot494f0072015-07-29 17:58:07523 // Completes extension loading after URLRequestContexts have been updated
524 // on the IO thread.
525 void OnExtensionRegisteredWithRequestContexts(
526 scoped_refptr<const extensions::Extension> extension);
527
[email protected]62d30f42009-10-01 22:36:06528 // Handles sending notification that |extension| was unloaded.
limasdf0deef2042017-05-03 19:17:17529 void NotifyExtensionUnloaded(const extensions::Extension* extension,
530 extensions::UnloadedExtensionReason reason);
[email protected]62d30f42009-10-01 22:36:06531
benwells1dd4acd2015-12-09 02:20:24532 // Common helper to finish installing the given extension.
533 void FinishInstallation(const extensions::Extension* extension);
[email protected]6f6101832012-11-27 22:10:48534
[email protected]b914e2952013-04-26 07:10:03535 // Disables the extension if the privilege level has increased
536 // (e.g., due to an upgrade).
537 void CheckPermissionsIncrease(const extensions::Extension* extension,
treib6e51bca2016-06-15 10:26:03538 bool is_extension_loaded);
[email protected]b914e2952013-04-26 07:10:03539
[email protected]aab98a52009-12-02 03:22:35540 // Helper that updates the active extension list used for crash reporting.
541 void UpdateActiveExtensionsInCrashReporter();
542
binjin47947f842014-11-18 12:10:24543 // Helper to get the disable reasons for an installed (or upgraded) extension.
544 // A return value of Extension::DISABLE_NONE indicates that we should enable
545 // this extension initially.
546 int GetDisableReasonsOnInstalled(const extensions::Extension* extension);
[email protected]612a1cb12012-10-17 13:18:03547
mlerman6a37b6a42014-11-26 22:10:53548 // Helper method to determine if an extension can be blocked.
549 bool CanBlockExtension(const extensions::Extension* extension) const;
550
xiyuanf6a4c6a62016-04-19 18:14:54551 // Helper to determine if installing an extensions should proceed immediately,
552 // or if we should delay the install until further notice, or if the install
553 // should be aborted. A pending install is delayed or aborted when any of the
554 // delayers say so and only proceeds when all delayers return INSTALL.
555 // |extension| is the extension to be installed. |install_immediately| is the
556 // install flag set with the install. |reason| is the reason associated with
557 // the install delayer that wants to defer or abort the install.
558 extensions::InstallGate::Action ShouldDelayExtensionInstall(
559 const extensions::Extension* extension,
560 bool install_immediately,
561 extensions::ExtensionPrefs::DelayReason* reason) const;
[email protected]e7aa7b7e2012-11-27 04:51:22562
[email protected]695b5712012-12-06 23:55:28563 // Manages the blacklisted extensions, intended as callback from
564 // Blacklist::GetBlacklistedIDs.
[email protected]2d19eb6e2014-01-27 17:30:00565 void ManageBlacklist(
566 const extensions::Blacklist::BlacklistStateMap& blacklisted_ids);
567
mlerman6a37b6a42014-11-26 22:10:53568 // Add extensions in |blacklisted| to blacklisted_extensions, remove
569 // extensions that are neither in |blacklisted|, nor in |unchanged|.
570 void UpdateBlacklistedExtensions(
571 const extensions::ExtensionIdSet& to_blacklist,
572 const extensions::ExtensionIdSet& unchanged);
[email protected]2d19eb6e2014-01-27 17:30:00573
574 void UpdateGreylistedExtensions(
[email protected]dccba4f82014-05-29 00:52:56575 const extensions::ExtensionIdSet& greylist,
576 const extensions::ExtensionIdSet& unchanged,
[email protected]2d19eb6e2014-01-27 17:30:00577 const extensions::Blacklist::BlacklistStateMap& state_map);
[email protected]695b5712012-12-06 23:55:28578
[email protected]bb1bc9b32013-12-21 03:09:14579 // Used only by test code.
580 void UnloadAllExtensionsInternal();
581
[email protected]ebe07772014-05-22 04:16:06582 // Disable apps & extensions now to stop them from running after a profile
583 // has been conceptually deleted. Don't wait for full browser shutdown and
584 // the actual profile objects to be destroyed.
585 void OnProfileDestructionStarted();
586
[email protected]5a145e82014-05-29 22:19:07587 // Called on file task runner thread to uninstall extension.
588 static void UninstallExtensionOnFileThread(
589 const std::string& id,
590 Profile* profile,
591 const base::FilePath& install_dir,
592 const base::FilePath& extension_path);
593
rdevlin.croninf2e1cb012017-05-27 01:27:59594 // Called when the initial extensions load has completed.
595 void OnInstalledExtensionsLoaded();
596
lazyboy75b9def2017-06-06 18:56:59597 // Upon reloading an extension, spins up its lazy background page if
598 // necessary.
599 void MaybeSpinUpLazyBackgroundPage(const extensions::Extension* extension_id);
600
Takumi Fujimoto43c8c00f2017-07-26 22:48:56601 // Uninstall extensions that have been migrated to component extensions.
602 void UninstallMigratedExtensions();
603
catmullings98cd1942016-08-30 22:31:59604 const base::CommandLine* command_line_ = nullptr;
605
[email protected]31d8f5f22012-04-02 15:22:08606 // The normal profile associated with this ExtensionService.
achuith2f5578b2016-02-26 21:57:13607 Profile* profile_ = nullptr;
[email protected]6ef635e42009-07-26 06:16:12608
[email protected]31d8f5f22012-04-02 15:22:08609 // The ExtensionSystem for the profile above.
achuith2f5578b2016-02-26 21:57:13610 extensions::ExtensionSystem* system_ = nullptr;
[email protected]31d8f5f22012-04-02 15:22:08611
[email protected]695b5712012-12-06 23:55:28612 // Preferences for the owning profile.
achuith2f5578b2016-02-26 21:57:13613 extensions::ExtensionPrefs* extension_prefs_ = nullptr;
[email protected]894bb502009-05-21 22:39:57614
[email protected]695b5712012-12-06 23:55:28615 // Blacklist for the owning profile.
achuith2f5578b2016-02-26 21:57:13616 extensions::Blacklist* blacklist_ = nullptr;
[email protected]695b5712012-12-06 23:55:28617
[email protected]5fdfa562013-12-27 17:43:59618 // Sets of enabled/disabled/terminated/blacklisted extensions. Not owned.
achuith2f5578b2016-02-26 21:57:13619 extensions::ExtensionRegistry* registry_ = nullptr;
[email protected]695b5712012-12-06 23:55:28620
[email protected]2d19eb6e2014-01-27 17:30:00621 // Set of greylisted extensions. These extensions are disabled if they are
622 // already installed in Chromium at the time when they are added to
623 // the greylist. Unlike blacklisted extensions, greylisted ones are visible
624 // to the user and if user re-enables such an extension, they remain enabled.
625 //
626 // These extensions should appear in registry_.
627 extensions::ExtensionSet greylist_;
628
catmullings98cd1942016-08-30 22:31:59629 // Set of whitelisted enabled extensions loaded from the
630 // --disable-extensions-except command line flag.
631 std::set<std::string> disable_flag_exempted_extensions_;
632
[email protected]9f4e4f082013-06-21 07:11:19633 // The list of extension installs delayed for various reasons. The reason
[email protected]bb1bc9b32013-12-21 03:09:14634 // for delayed install is stored in ExtensionPrefs. These are not part of
635 // ExtensionRegistry because they are not yet installed.
[email protected]289c44b2013-12-17 03:26:57636 extensions::ExtensionSet delayed_installs_;
[email protected]0db124b02012-11-07 04:55:05637
[email protected]b2907fd2011-03-25 16:43:37638 // Hold the set of pending extensions.
[email protected]3f213ad2012-07-26 23:39:41639 extensions::PendingExtensionManager pending_extension_manager_;
[email protected]aa142702010-03-26 01:26:33640
[email protected]6014d672008-12-05 00:38:25641 // The full path to the directory where extensions are installed.
[email protected]650b2d52013-02-10 03:41:45642 base::FilePath install_directory_;
[email protected]6014d672008-12-05 00:38:25643
[email protected]e2eb43112009-05-29 21:19:54644 // Whether or not extensions are enabled.
achuith2f5578b2016-02-26 21:57:13645 bool extensions_enabled_ = true;
[email protected]e2eb43112009-05-29 21:19:54646
[email protected]4a10006a2013-05-17 23:18:35647 // Signaled when all extensions are loaded.
648 extensions::OneShotEvent* const ready_;
[email protected]e81dba32009-06-19 20:19:13649
[email protected]93fd78f42009-07-10 16:43:17650 // Our extension updater, if updates are turned on.
dchengc963c7142016-04-08 03:55:22651 std::unique_ptr<extensions::ExtensionUpdater> updater_;
[email protected]93fd78f42009-07-10 16:43:17652
[email protected]1eb175082010-02-10 09:26:16653 // Map unloaded extensions' ids to their paths. When a temporarily loaded
[email protected]5fb889382011-06-03 00:29:20654 // extension is unloaded, we lose the information about it and don't have
[email protected]1eb175082010-02-10 09:26:16655 // any in the extension preferences file.
achuith2f5578b2016-02-26 21:57:13656 using UnloadedExtensionPathMap = std::map<std::string, base::FilePath>;
[email protected]1eb175082010-02-10 09:26:16657 UnloadedExtensionPathMap unloaded_extension_paths_;
658
[email protected]04ea1bb2013-07-10 09:26:09659 // Map of DevToolsAgentHost instances that are detached,
660 // waiting for an extension to be reloaded.
achuith2f5578b2016-02-26 21:57:13661 using OrphanedDevTools =
662 std::map<std::string, scoped_refptr<content::DevToolsAgentHost>>;
[email protected]4814b512009-11-07 00:12:29663 OrphanedDevTools orphaned_dev_tools_;
664
[email protected]6c2381d2011-10-19 02:52:53665 content::NotificationRegistrar registrar_;
[email protected]4814b512009-11-07 00:12:29666
[email protected]d8c8f25f2011-11-02 18:18:01667 // Keeps track of loading and unloading component extensions.
dchengc963c7142016-04-08 03:55:22668 std::unique_ptr<extensions::ComponentLoader> component_loader_;
[email protected]d8c8f25f2011-11-02 18:18:01669
[email protected]8e4560b62011-01-14 10:09:14670 // A collection of external extension providers. Each provider reads
671 // a source of external extension information. Examples include the
672 // windows registry and external_extensions.json.
[email protected]5df038b2012-07-16 19:03:27673 extensions::ProviderCollection external_extension_providers_;
[email protected]8e4560b62011-01-14 10:09:14674
675 // Set to true by OnExternalExtensionUpdateUrlFound() when an external
[email protected]94fde232012-04-27 10:22:30676 // extension URL is found, and by CheckForUpdatesSoon() when an update check
677 // has to wait for the external providers. Used in
678 // OnAllExternalProvidersReady() to determine if an update check is needed to
679 // install pending extensions.
achuith2f5578b2016-02-26 21:57:13680 bool update_once_all_providers_are_ready_ = false;
[email protected]8e4560b62011-01-14 10:09:14681
[email protected]4e9b59d2013-12-18 06:47:14682 // A callback to be called when all external providers are ready and their
683 // extensions have been installed. Normally this is a null callback, but
684 // is used in external provider related tests.
685 base::Closure external_updates_finished_callback_;
686
[email protected]3c4abc82012-10-22 22:25:54687 // Set when the browser is terminating. Prevents us from installing or
688 // updating additional extensions and allows in-progress installations to
689 // decide to abort.
achuith2f5578b2016-02-26 21:57:13690 bool browser_terminating_ = false;
[email protected]3c4abc82012-10-22 22:25:54691
lazyboy77214d3c2017-04-04 16:46:12692 // If set, call to CheckForExternalUpdates() will bail out.
693 bool external_updates_disabled_for_test_ = false;
694
[email protected]460c6712013-04-24 07:20:01695 // Set to true if this is the first time this ExtensionService has run.
696 // Used for specially handling external extensions that are installed the
697 // first time.
achuith2f5578b2016-02-26 21:57:13698 bool is_first_run_ = false;
[email protected]460c6712013-04-24 07:20:01699
mlerman6a37b6a42014-11-26 22:10:53700 // Set to true if extensions are all to be blocked.
achuith2f5578b2016-02-26 21:57:13701 bool block_extensions_ = false;
mlerman6a37b6a42014-11-26 22:10:53702
[email protected]dccba4f82014-05-29 00:52:56703 // Store the ids of reloading extensions. We use this to re-enable extensions
704 // which were disabled for a reload.
705 std::set<std::string> reloading_extensions_;
[email protected]e178ad92013-06-28 02:29:25706
[email protected]3964e572014-02-13 21:57:41707 // A set of the extension ids currently being terminated. We use this to
708 // avoid trying to unload the same extension twice.
709 std::set<std::string> extensions_being_terminated_;
710
[email protected]373daf972014-04-10 01:50:44711 // The controller for the UI that alerts the user about any blacklisted
712 // extensions.
dchengc963c7142016-04-08 03:55:22713 std::unique_ptr<extensions::ExtensionErrorController> error_controller_;
[email protected]373daf972014-04-10 01:50:44714
[email protected]2894a512014-06-26 19:03:56715 // The manager for extensions that were externally installed that is
716 // responsible for prompting the user about suspicious extensions.
dchengc963c7142016-04-08 03:55:22717 std::unique_ptr<extensions::ExternalInstallManager> external_install_manager_;
[email protected]2894a512014-06-26 19:03:56718
[email protected]7f8f24f2012-11-15 19:40:14719 // Sequenced task runner for extension related file operations.
fdoray71c48e722017-05-17 22:37:09720 const scoped_refptr<base::SequencedTaskRunner> file_task_runner_;
[email protected]a9aa5932012-01-25 08:27:40721
dchengc963c7142016-04-08 03:55:22722 std::unique_ptr<extensions::ExtensionActionStorageManager>
[email protected]c77f2352012-08-08 22:07:58723 extension_action_storage_manager_;
724
[email protected]90878c52014-04-04 18:21:02725 // The SharedModuleService used to check for import dependencies.
dchengc963c7142016-04-08 03:55:22726 std::unique_ptr<extensions::SharedModuleService> shared_module_service_;
[email protected]90878c52014-04-04 18:21:02727
rdevlin.cronin5e510e802016-07-26 15:09:20728 // The associated RendererStartupHelper. Guaranteed to outlive the
729 // ExtensionSystem, and thus us.
730 extensions::RendererStartupHelper* renderer_helper_;
731
brettwd195c952015-06-02 17:31:12732 base::ObserverList<extensions::UpdateObserver, true> update_observers_;
[email protected]efdb7f1a2014-03-28 20:43:38733
ryanackley48bedbd2015-01-27 23:12:14734 // Migrates app data when upgrading a legacy packaged app to a platform app
dchengc963c7142016-04-08 03:55:22735 std::unique_ptr<extensions::AppDataMigrator> app_data_migrator_;
ryanackley48bedbd2015-01-27 23:12:14736
xiyuanf6a4c6a62016-04-19 18:14:54737 using InstallGateRegistry = std::map<extensions::ExtensionPrefs::DelayReason,
738 extensions::InstallGate*>;
739 InstallGateRegistry install_delayer_registry_;
740
[email protected]eaa7dd182010-12-14 11:09:00741 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
[email protected]dccba4f82014-05-29 00:52:56742 DestroyingProfileClearsExtensions);
[email protected]f71b582c2014-01-10 17:03:15743 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, SetUnsetBlacklistInPrefs);
744 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
745 BlacklistedExtensionWillNotInstall);
746 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
747 UnloadBlacklistedExtensionPolicy);
748 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
749 WillNotLoadBlacklistedExtensionsFromDirectory);
[email protected]757d60a2014-05-23 00:11:44750 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, ReloadBlacklistedExtension);
atuchin6dc7c442016-07-20 07:04:34751 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
752 RemoveExtensionFromBlacklist);
[email protected]757d60a2014-05-23 00:11:44753 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, BlacklistedInPrefsFromStartup);
[email protected]2d19eb6e2014-01-27 17:30:00754 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
755 GreylistedExtensionDisabled);
756 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
757 GreylistDontEnableManuallyDisabled);
758 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
759 GreylistUnknownDontChange);
binjin47947f842014-11-18 12:10:24760 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
761 ManagementPolicyProhibitsEnableOnInstalled);
mlerman6a37b6a42014-11-26 22:10:53762 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
763 BlockAndUnblockBlacklistedExtension);
[email protected]dccba4f82014-05-29 00:52:56764
[email protected]eaa7dd182010-12-14 11:09:00765 DISALLOW_COPY_AND_ASSIGN(ExtensionService);
[email protected]6014d672008-12-05 00:38:25766};
767
[email protected]eaa7dd182010-12-14 11:09:00768#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_