blob: eef19e976f1ca37199f707988463b2c39572a7dc [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"
Karandeep Bhatiaa8930652017-10-11 17:41:1220#include "base/optional.h"
[email protected]00e7bef2013-06-10 20:35:1721#include "base/strings/string16.h"
[email protected]fdd679b2012-11-15 20:49:3922#include "chrome/browser/extensions/blacklist.h"
binjin1569c9b2014-09-05 13:33:1823#include "chrome/browser/extensions/extension_management.h"
Sergey Poromov0360b9e72018-04-19 17:37:2924#include "chrome/browser/extensions/forced_extensions/installation_tracker.h"
xiyuanf6a4c6a62016-04-19 18:14:5425#include "chrome/browser/extensions/install_gate.h"
[email protected]f3d3b382014-03-14 21:19:2826#include "chrome/browser/extensions/pending_extension_manager.h"
Greg Thompson8bcd799b2018-08-10 09:49:3327#include "chrome/browser/upgrade_detector/upgrade_observer.h"
skym71603842016-10-10 18:17:3128#include "components/sync/model/string_ordinal.h"
[email protected]6c2381d2011-10-19 02:52:5329#include "content/public/browser/notification_observer.h"
30#include "content/public/browser/notification_registrar.h"
ginkage553af3202015-02-04 12:39:0931#include "extensions/browser/crx_file_info.h"
Ivan Sandrk4a55dc22018-05-17 18:14:4832#include "extensions/browser/disable_reason.h"
xiyuanf6a4c6a62016-04-19 18:14:5433#include "extensions/browser/extension_prefs.h"
Devlin Cronin5b35a082017-10-05 20:44:3634#include "extensions/browser/extension_registrar.h"
[email protected]301116c62013-11-26 10:37:4535#include "extensions/browser/external_provider_interface.h"
[email protected]4a1d9c0d2014-06-13 12:50:1136#include "extensions/browser/install_flag.h"
[email protected]98b6d942013-11-10 00:34:0737#include "extensions/browser/process_manager.h"
[email protected]e43c61f2014-07-20 21:46:3438#include "extensions/browser/uninstall_reason.h"
Scott Violetc8240b02018-03-08 22:03:5939#include "extensions/buildflags/buildflags.h"
[email protected]e4452d32013-11-15 23:07:4140#include "extensions/common/extension.h"
[email protected]289c44b2013-12-17 03:26:5741#include "extensions/common/extension_set.h"
[email protected]d42c11152013-08-22 19:36:3242#include "extensions/common/manifest.h"
[email protected]6014d672008-12-05 00:38:2543
brettw00899e62016-11-12 02:10:1744#if !BUILDFLAG(ENABLE_EXTENSIONS)
thestig44b9ce22014-10-17 03:19:2845#error "Extensions must be enabled"
46#endif
47
Devlin Cronineea1b7a2018-05-26 02:46:2148class BlacklistedExtensionSyncServiceTest;
mukai87a8d402014-09-15 20:15:0949class HostContentSettingsMap;
[email protected]81e63782009-02-27 19:35:0950class Profile;
[email protected]aa142702010-03-26 01:26:3351
[email protected]7f8f24f2012-11-15 19:40:1452namespace base {
[email protected]2f3b1cc2014-03-17 23:07:1553class CommandLine;
[email protected]7f8f24f2012-11-15 19:40:1454}
55
Devlin Cronineea1b7a2018-05-26 02:46:2156FORWARD_DECLARE_TEST(BlacklistedExtensionSyncServiceTest,
57 SyncBlacklistedExtension);
58
[email protected]9c70e0d92012-07-16 08:39:4459namespace extensions {
ryanackley48bedbd2015-01-27 23:12:1460class AppDataMigrator;
[email protected]d8c8f25f2011-11-02 18:18:0161class ComponentLoader;
[email protected]bf3d9df2012-07-24 23:20:2762class CrxInstaller;
[email protected]c77f2352012-08-08 22:07:5863class ExtensionActionStorageManager;
[email protected]373daf972014-04-10 01:50:4464class ExtensionErrorController;
[email protected]bb1bc9b32013-12-21 03:09:1465class ExtensionRegistry;
[email protected]bd306722012-07-11 20:43:5966class ExtensionSystem;
[email protected]42a08162012-03-16 18:09:1167class ExtensionUpdater;
[email protected]2894a512014-06-26 19:03:5668class ExternalInstallManager;
rdevlin.croninf5863da2015-09-10 19:21:4569class OneShotEvent;
[email protected]90878c52014-04-04 18:21:0270class SharedModuleService;
[email protected]a9aa62b312013-11-29 05:35:0671class UpdateObserver;
[email protected]163ed192012-07-24 19:31:0772
[email protected]d1ca0ed12009-07-01 18:24:3273// This is an interface class to encapsulate the dependencies that
[email protected]2859946f2011-04-04 18:18:0674// various classes have on ExtensionService. This allows easy mocking.
[email protected]f8aefb132013-10-30 09:29:5275class ExtensionServiceInterface
76 : public base::SupportsWeakPtr<ExtensionServiceInterface> {
[email protected]d1ca0ed12009-07-01 18:24:3277 public:
[email protected]2859946f2011-04-04 18:18:0678 virtual ~ExtensionServiceInterface() {}
[email protected]ca975942014-01-07 12:06:4779
[email protected]dccba4f82014-05-29 00:52:5680 // Gets the object managing the set of pending extensions.
Devlin Cronineea1b7a2018-05-26 02:46:2181 virtual PendingExtensionManager* pending_extension_manager() = 0;
[email protected]420a0ec2011-06-01 01:07:0382
[email protected]dccba4f82014-05-29 00:52:5683 // Installs an update with the contents from |extension_path|. Returns true if
84 // the install can be started. Sets |out_crx_installer| to the installer if
85 // one was started.
86 // TODO(aa): This method can be removed. ExtensionUpdater could use
87 // CrxInstaller directly instead.
Devlin Cronineea1b7a2018-05-26 02:46:2188 virtual bool UpdateExtension(const CRXFileInfo& file,
89 bool file_ownership_passed,
90 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.
Devlin Cronineea1b7a2018-05-26 02:46:21110 virtual const Extension* GetExtensionById(const std::string& id,
111 bool include_disabled) const = 0;
[email protected]dccba4f82014-05-29 00:52:56112
[email protected]eb245382014-07-28 22:23:14113 // DEPRECATED: Use ExtensionRegistry instead.
114 //
[email protected]dccba4f82014-05-29 00:52:56115 // Looks up an extension by ID, regardless of whether it's enabled,
[email protected]eb245382014-07-28 22:23:14116 // disabled, blacklisted, or terminated. Use instead:
117 //
sudarsana.naginenidb931782015-06-05 12:01:50118 // ExtensionRegistry::GetInstalledExtension(id).
Devlin Cronineea1b7a2018-05-26 02:46:21119 virtual const Extension* GetInstalledExtension(
[email protected]8001df22011-04-28 19:59:47120 const std::string& id) const = 0;
[email protected]2859946f2011-04-04 18:18:06121
[email protected]dccba4f82014-05-29 00:52:56122 // Returns an update for an extension with the specified id, if installation
123 // of that update was previously delayed because the extension was in use. If
124 // no updates are pending for the extension returns NULL.
Devlin Cronineea1b7a2018-05-26 02:46:21125 virtual const Extension* GetPendingExtensionUpdate(
[email protected]76b65442012-11-17 14:11:48126 const std::string& extension_id) const = 0;
[email protected]dccba4f82014-05-29 00:52:56127
Toni Barzic667db0d32018-01-09 18:00:19128 // Attempts finishing installation of an update for an extension with the
129 // specified id, when installation of that extension was previously delayed.
130 // |install_immediately| - Whether the extension should be installed if it's
131 // currently in use.
132 // Returns whether the extension installation was finished.
133 virtual bool FinishDelayedInstallationIfReady(const std::string& extension_id,
134 bool install_immediately) = 0;
[email protected]76b65442012-11-17 14:11:48135
[email protected]dccba4f82014-05-29 00:52:56136 // Returns true if the extension with the given |extension_id| is enabled.
mfoltz96f329c2016-01-13 18:16:58137 // This will only return a valid answer for installed extensions (regardless
138 // of whether it is currently loaded or not). Loaded extensions return true
139 // if they are currently loaded or terminated. Unloaded extensions will
140 // return true if they are not blocked, disabled, blacklisted or uninstalled
141 // (for external extensions).
[email protected]c3cfb012011-04-06 22:07:35142 virtual bool IsExtensionEnabled(const std::string& extension_id) const = 0;
[email protected]2859946f2011-04-04 18:18:06143
[email protected]dccba4f82014-05-29 00:52:56144 // Go through each extension and unload those that are not allowed to run by
145 // management policy providers (ie. network admin and Google-managed
146 // blacklist).
[email protected]4ee07c62012-08-21 12:40:42147 virtual void CheckManagementPolicy() = 0;
[email protected]5ef47ec2010-01-28 05:58:05148
[email protected]31206602011-04-13 23:07:32149 // Safe to call multiple times in a row.
150 //
[email protected]90310d92011-04-17 07:35:04151 // TODO(akalin): Remove this method (and others) once we refactor
152 // themes sync to not use it directly.
[email protected]31206602011-04-13 23:07:32153 virtual void CheckForUpdatesSoon() = 0;
[email protected]25ae0152011-11-18 14:40:02154
[email protected]dccba4f82014-05-29 00:52:56155 // Adds |extension| to this ExtensionService and notifies observers that the
Michael Giuffrida023e3532017-09-28 23:21:21156 // extension has been loaded.
Devlin Cronineea1b7a2018-05-26 02:46:21157 virtual void AddExtension(const Extension* extension) = 0;
[email protected]dccba4f82014-05-29 00:52:56158
159 // Check if we have preferences for the component extension and, if not or if
160 // the stored version differs, install the extension (without requirements
161 // checking) before calling AddExtension.
Devlin Cronineea1b7a2018-05-26 02:46:21162 virtual void AddComponentExtension(const Extension* extension) = 0;
[email protected]25ae0152011-11-18 14:40:02163
[email protected]dccba4f82014-05-29 00:52:56164 // Unload the specified extension.
limasdf0deef2042017-05-03 19:17:17165 virtual void UnloadExtension(const std::string& extension_id,
Devlin Cronineea1b7a2018-05-26 02:46:21166 UnloadedExtensionReason reason) = 0;
[email protected]dccba4f82014-05-29 00:52:56167
168 // Remove the specified component extension.
[email protected]8b1ec202013-09-05 02:09:50169 virtual void RemoveComponentExtension(const std::string& extension_id) = 0;
[email protected]25ae0152011-11-18 14:40:02170
[email protected]dccba4f82014-05-29 00:52:56171 // Whether the extension service is ready.
[email protected]25ae0152011-11-18 14:40:02172 virtual bool is_ready() = 0;
[email protected]d1ca0ed12009-07-01 18:24:32173};
[email protected]fbcc40302009-06-12 20:45:45174
[email protected]fafdc842014-01-17 18:09:08175// Manages installed and running Chromium extensions. An instance is shared
176// between normal and incognito profiles.
Devlin Cronineea1b7a2018-05-26 02:46:21177class ExtensionService : public ExtensionServiceInterface,
178 public ExternalProviderInterface::VisitorInterface,
179 public content::NotificationObserver,
180 public Blacklist::Observer,
181 public ExtensionManagement::Observer,
182 public UpgradeObserver,
183 public ExtensionRegistrar::Delegate {
[email protected]4f313d52009-05-21 00:42:29184 public:
[email protected]73c47932010-12-06 18:13:43185 // Constructor stores pointers to |profile| and |extension_prefs| but
186 // ownership remains at caller.
[email protected]eaa7dd182010-12-14 11:09:00187 ExtensionService(Profile* profile,
[email protected]2f3b1cc2014-03-17 23:07:15188 const base::CommandLine* command_line,
[email protected]650b2d52013-02-10 03:41:45189 const base::FilePath& install_directory,
Devlin Cronineea1b7a2018-05-26 02:46:21190 ExtensionPrefs* extension_prefs,
191 Blacklist* blacklist,
[email protected]0436b102011-04-15 18:30:03192 bool autoupdate_enabled,
[email protected]4a10006a2013-05-17 23:18:35193 bool extensions_enabled,
Devlin Cronineea1b7a2018-05-26 02:46:21194 OneShotEvent* ready);
[email protected]6014d672008-12-05 00:38:25195
dchengae36a4a2014-10-21 12:36:36196 ~ExtensionService() override;
[email protected]14908b72011-04-20 06:54:36197
[email protected]eb245382014-07-28 22:23:14198 // ExtensionServiceInterface implementation.
199 //
200 // NOTE: Many of these methods are DEPRECATED. See the interface for details.
Devlin Cronineea1b7a2018-05-26 02:46:21201 PendingExtensionManager* pending_extension_manager() override;
202 const Extension* GetExtensionById(const std::string& id,
203 bool include_disabled) const override;
204 const Extension* GetInstalledExtension(const std::string& id) const override;
205 bool UpdateExtension(const CRXFileInfo& file,
dchengae36a4a2014-10-21 12:36:36206 bool file_ownership_passed,
Devlin Cronineea1b7a2018-05-26 02:46:21207 CrxInstaller** out_crx_installer) override;
dchengae36a4a2014-10-21 12:36:36208 bool IsExtensionEnabled(const std::string& extension_id) const override;
limasdf0deef2042017-05-03 19:17:17209 void UnloadExtension(const std::string& extension_id,
Devlin Cronineea1b7a2018-05-26 02:46:21210 UnloadedExtensionReason reason) override;
dchengae36a4a2014-10-21 12:36:36211 void RemoveComponentExtension(const std::string& extension_id) override;
Devlin Cronineea1b7a2018-05-26 02:46:21212 void AddExtension(const Extension* extension) override;
213 void AddComponentExtension(const Extension* extension) override;
214 const Extension* GetPendingExtensionUpdate(
mostynba15bee12014-10-04 00:40:32215 const std::string& extension_id) const override;
Toni Barzic667db0d32018-01-09 18:00:19216 bool FinishDelayedInstallationIfReady(const std::string& extension_id,
217 bool install_immediately) override;
dchengae36a4a2014-10-21 12:36:36218 void CheckManagementPolicy() override;
219 void CheckForUpdatesSoon() override;
220 bool is_ready() override;
[email protected]aa142702010-03-26 01:26:33221
lazyboye8634172016-01-28 00:10:48222 // ExternalProvider::VisitorInterface implementation.
[email protected]dccba4f82014-05-29 00:52:56223 // Exposed for testing.
lazyboye8634172016-01-28 00:10:48224 bool OnExternalExtensionFileFound(
Devlin Cronineea1b7a2018-05-26 02:46:21225 const ExternalInstallInfoFile& info) override;
dchengae36a4a2014-10-21 12:36:36226 bool OnExternalExtensionUpdateUrlFound(
Devlin Cronineea1b7a2018-05-26 02:46:21227 const ExternalInstallInfoUpdateUrl& info,
lazyboye8634172016-01-28 00:10:48228 bool is_initial_load) override;
dchengae36a4a2014-10-21 12:36:36229 void OnExternalProviderReady(
Devlin Cronineea1b7a2018-05-26 02:46:21230 const ExternalProviderInterface* provider) override;
lazyboye8634172016-01-28 00:10:48231 void OnExternalProviderUpdateComplete(
Devlin Cronineea1b7a2018-05-26 02:46:21232 const ExternalProviderInterface* provider,
233 const std::vector<ExternalInstallInfoUpdateUrl>&
lazyboye8634172016-01-28 00:10:48234 external_update_url_extensions,
Devlin Cronineea1b7a2018-05-26 02:46:21235 const std::vector<ExternalInstallInfoFile>& external_file_extensions,
lazyboye8634172016-01-28 00:10:48236 const std::set<std::string>& removed_extensions) override;
[email protected]ec5b50d2010-10-09 16:35:18237
binjin1569c9b2014-09-05 13:33:18238 // ExtensionManagement::Observer implementation:
dchengae36a4a2014-10-21 12:36:36239 void OnExtensionManagementSettingsChanged() override;
binjin1569c9b2014-09-05 13:33:18240
[email protected]6014d672008-12-05 00:38:25241 // Initialize and start all installed extensions.
[email protected]9f1087e2009-06-15 17:29:32242 void Init();
[email protected]6014d672008-12-05 00:38:25243
[email protected]47b896562012-08-22 23:55:15244 // Called when the associated Profile is going to be destroyed.
245 void Shutdown();
246
[email protected]2380c6b2013-01-09 02:33:13247 // Reloads the specified extension, sending the onLaunched() event to it if it
248 // currently has any window showing.
[email protected]bca4b832014-07-17 20:22:34249 // Allows noisy failures.
thestig7b4bd932014-09-09 22:44:31250 // NOTE: Reloading an extension can invalidate |extension_id| and Extension
251 // pointers for the given extension. Consider making a copy of |extension_id|
252 // first and retrieving a new Extension pointer afterwards.
[email protected]757d60a2014-05-23 00:11:44253 void ReloadExtension(const std::string& extension_id);
[email protected]9cddd4702009-07-27 22:09:40254
[email protected]bca4b832014-07-17 20:22:34255 // Suppresses noisy failures.
256 void ReloadExtensionWithQuietFailure(const std::string& extension_id);
257
[email protected]631cf822009-05-15 07:01:25258 // Uninstalls the specified extension. Callers should only call this method
[email protected]cc2f55c2014-07-08 02:19:04259 // with extensions that exist. |reason| lets the caller specify why the
260 // extension is uninstalled.
Devlin Cronin218df7f2017-11-21 21:41:31261 // Note: this method synchronously removes the extension from the
262 // set of installed extensions stored in the ExtensionRegistry, but will
263 // asynchronously remove site-related data and the files stored on disk.
264 // Returns true if an uninstall was successfully triggered; this can fail if
265 // the extension cannot be uninstalled (such as a policy force-installed
266 // extension).
Devlin Croninad24e5b2017-11-29 00:54:43267 bool UninstallExtension(const std::string& extension_id,
Devlin Cronineea1b7a2018-05-26 02:46:21268 UninstallReason reason,
Devlin Croninad24e5b2017-11-29 00:54:43269 base::string16* error);
[email protected]631cf822009-05-15 07:01:25270
[email protected]06f92562011-04-29 19:27:31271 // Enables the extension. If the extension is already enabled, does
272 // nothing.
Devlin Croninad24e5b2017-11-29 00:54:43273 void EnableExtension(const std::string& extension_id);
[email protected]06f92562011-04-29 19:27:31274
treibc1192322015-05-20 12:56:07275 // Disables the extension. If the extension is already disabled, just adds
Minh X. Nguyen45479012017-08-18 21:35:36276 // the |disable_reasons| (a bitmask of disable_reason::DisableReason - there
277 // can be multiple DisableReasons e.g. when an extension comes in disabled
278 // from Sync). If the extension cannot be disabled (due to policy), does
279 // nothing.
Devlin Croninad24e5b2017-11-29 00:54:43280 void DisableExtension(const std::string& extension_id, int disable_reasons);
[email protected]0c6da502009-08-14 22:32:39281
Ivan Sandrk4a55dc22018-05-17 18:14:48282 // Same as |DisableExtension|, but assumes that the request to disable
283 // |extension_id| originates from |source_extension| when evaluating whether
284 // the extension can be disabled. Please see |ExtensionMayModifySettings|
285 // for details.
286 void DisableExtensionWithSource(
Devlin Cronineea1b7a2018-05-26 02:46:21287 const Extension* source_extension,
Ivan Sandrk4a55dc22018-05-17 18:14:48288 const std::string& extension_id,
Devlin Cronineea1b7a2018-05-26 02:46:21289 disable_reason::DisableReason disable_reasons);
Ivan Sandrk4a55dc22018-05-17 18:14:48290
[email protected]3082fe32013-08-06 11:12:38291 // Disable non-default and non-managed extensions with ids not in
292 // |except_ids|. Default extensions are those from the Web Store with
293 // |was_installed_by_default| flag.
mtomasz294bb3e2017-01-24 02:17:52294 void DisableUserExtensionsExcept(const std::vector<std::string>& except_ids);
[email protected]e516e4c2013-06-12 17:41:14295
mlerman6a37b6a42014-11-26 22:10:53296 // Puts all extensions in a blocked state: Unloading every extension, and
297 // preventing them from ever loading until UnblockAllExtensions is called.
298 // This state is stored in preferences, so persists until Chrome restarts.
299 //
300 // Component, external component and whitelisted policy installed extensions
Michael Giuffrida6397c592017-10-09 20:46:53301 // are exempt from being Blocked (see CanBlockExtension in .cc file).
mlerman6a37b6a42014-11-26 22:10:53302 void BlockAllExtensions();
303
304 // All blocked extensions are reverted to their previous state, and are
305 // reloaded. Newly added extensions are no longer automatically blocked.
306 void UnblockAllExtensions();
307
[email protected]8d888c12010-11-30 00:00:25308 // Updates the |extension|'s granted permissions lists to include all
[email protected]8d888c12010-11-30 00:00:25309 // permissions in the |extension|'s manifest and re-enables the
310 // extension.
Devlin Cronineea1b7a2018-05-26 02:46:21311 void GrantPermissionsAndEnableExtension(const Extension* extension);
[email protected]8d888c12010-11-30 00:00:25312
[email protected]be083862012-09-01 03:53:45313 // Updates the |extension|'s granted permissions lists to include all
314 // permissions in the |extensions|'s manifest.
Devlin Cronineea1b7a2018-05-26 02:46:21315 void GrantPermissions(const Extension* extension);
[email protected]be083862012-09-01 03:53:45316
[email protected]9f1087e2009-06-15 17:29:32317 // Check for updates (or potentially new extensions from external providers)
[email protected]93fd78f42009-07-10 16:43:17318 void CheckForExternalUpdates();
[email protected]9f1087e2009-06-15 17:29:32319
[email protected]bc151cf92013-02-12 04:57:26320 // Informs the service that an extension's files are in place for loading.
321 //
Karandeep Bhatiaa8930652017-10-11 17:41:12322 // |extension| the extension
323 // |page_ordinal| the location of the extension in the app launcher
Devlin Cronineea1b7a2018-05-26 02:46:21324 // |install_flags| a bitmask of InstallFlags
Karandeep Bhatiaa8930652017-10-11 17:41:12325 // |dnr_ruleset_checksum| Checksum of the indexed ruleset for the Declarative
326 // Net Request API.
327 void OnExtensionInstalled(
Devlin Cronineea1b7a2018-05-26 02:46:21328 const Extension* extension,
Karandeep Bhatiaa8930652017-10-11 17:41:12329 const syncer::StringOrdinal& page_ordinal,
330 int install_flags,
331 const base::Optional<int>& dnr_ruleset_checksum = base::nullopt);
Devlin Cronineea1b7a2018-05-26 02:46:21332 void OnExtensionInstalled(const Extension* extension,
[email protected]4a1d9c0d2014-06-13 12:50:11333 const syncer::StringOrdinal& page_ordinal) {
Devlin Cronineea1b7a2018-05-26 02:46:21334 OnExtensionInstalled(extension, page_ordinal,
335 static_cast<int>(kInstallFlagNone));
[email protected]4a1d9c0d2014-06-13 12:50:11336 }
[email protected]0db124b02012-11-07 04:55:05337
[email protected]9f4e4f082013-06-21 07:11:19338 // Checks for delayed installation for all pending installs.
339 void MaybeFinishDelayedInstallations();
340
[email protected]406027c02010-09-27 08:03:18341 // ExtensionHost of background page calls this method right after its render
342 // view has been created.
Devlin Cronineea1b7a2018-05-26 02:46:21343 void DidCreateRenderViewForBackgroundPage(ExtensionHost* host);
[email protected]406027c02010-09-27 08:03:18344
[email protected]fe2dd7742011-04-19 22:52:49345 // Record a histogram using the PermissionMessage enum values for each
346 // permission in |e|.
347 // NOTE: If this is ever called with high frequency, the implementation may
348 // need to be made more efficient.
Devlin Cronineea1b7a2018-05-26 02:46:21349 static void RecordPermissionMessagesHistogram(const Extension* extension,
350 const char* histogram);
[email protected]fe2dd7742011-04-19 22:52:49351
Michael Giuffridafcb420362017-10-11 21:50:26352 // Unloads the given extension and marks the extension as terminated. This
[email protected]e9d7496e2014-04-18 01:25:46353 // doesn't notify the user that the extension was terminated, if such a
354 // notification is desired the calling code is responsible for doing that.
355 void TerminateExtension(const std::string& extension_id);
356
mukai87a8d402014-09-15 20:15:09357 // Register self and content settings API with the specified map.
mmenkead5094ab2017-05-15 19:01:14358 static void RegisterContentSettings(
359 HostContentSettingsMap* host_content_settings_map,
360 Profile* profile);
mukai87a8d402014-09-15 20:15:09361
[email protected]dccba4f82014-05-29 00:52:56362 // Adds/Removes update observers.
Devlin Cronineea1b7a2018-05-26 02:46:21363 void AddUpdateObserver(UpdateObserver* observer);
364 void RemoveUpdateObserver(UpdateObserver* observer);
[email protected]a51c9e92012-12-09 09:19:20365
xiyuanf6a4c6a62016-04-19 18:14:54366 // Register/unregister an InstallGate with the service.
Devlin Cronineea1b7a2018-05-26 02:46:21367 void RegisterInstallGate(ExtensionPrefs::DelayReason reason,
368 InstallGate* install_delayer);
369 void UnregisterInstallGate(InstallGate* install_delayer);
xiyuanf6a4c6a62016-04-19 18:14:54370
[email protected]dccba4f82014-05-29 00:52:56371 //////////////////////////////////////////////////////////////////////////////
372 // Simple Accessors
[email protected]fa2416f2011-05-03 08:41:20373
[email protected]dccba4f82014-05-29 00:52:56374 // Returns a WeakPtr to the ExtensionService.
[email protected]77e4dc0882012-06-20 18:53:50375 base::WeakPtr<ExtensionService> AsWeakPtr() { return base::AsWeakPtr(this); }
376
[email protected]dccba4f82014-05-29 00:52:56377 // Returns profile_ as a BrowserContext.
378 content::BrowserContext* GetBrowserContext() const;
379
380 bool extensions_enabled() const { return extensions_enabled_; }
[email protected]dccba4f82014-05-29 00:52:56381
382 const base::FilePath& install_directory() const { return install_directory_; }
383
Devlin Cronineea1b7a2018-05-26 02:46:21384 const ExtensionSet* delayed_installs() const { return &delayed_installs_; }
[email protected]dccba4f82014-05-29 00:52:56385
[email protected]dccba4f82014-05-29 00:52:56386 Profile* profile() { return profile_; }
387
[email protected]dccba4f82014-05-29 00:52:56388 // Note that this may return NULL if autoupdate is not turned on.
Devlin Cronineea1b7a2018-05-26 02:46:21389 ExtensionUpdater* updater() { return updater_.get(); }
[email protected]dccba4f82014-05-29 00:52:56390
Devlin Cronineea1b7a2018-05-26 02:46:21391 ComponentLoader* component_loader() { return component_loader_.get(); }
[email protected]dccba4f82014-05-29 00:52:56392
[email protected]3c4abc82012-10-22 22:25:54393 bool browser_terminating() const { return browser_terminating_; }
394
Devlin Cronineea1b7a2018-05-26 02:46:21395 SharedModuleService* shared_module_service() {
[email protected]90878c52014-04-04 18:21:02396 return shared_module_service_.get();
397 }
398
Devlin Cronineea1b7a2018-05-26 02:46:21399 ExternalInstallManager* external_install_manager() {
[email protected]2894a512014-06-26 19:03:56400 return external_install_manager_.get();
401 }
402
[email protected]dccba4f82014-05-29 00:52:56403 //////////////////////////////////////////////////////////////////////////////
404 // For Testing
405
406 // Unload all extensions. Does not send notifications.
407 void UnloadAllExtensionsForTest();
408
409 // Reloads all extensions. Does not notify that extensions are ready.
410 void ReloadExtensionsForTest();
411
Tatsuhisa Yamaguchi5ed1aece32017-10-26 10:18:56412 // Enable Zip Unpacker Extension component extensions for unit test.
413 void EnableZipUnpackerExtensionForTest();
414
[email protected]dccba4f82014-05-29 00:52:56415 // 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(
Devlin Cronineea1b7a2018-05-26 02:46:21420 std::unique_ptr<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)
Devlin Cronineea1b7a2018-05-26 02:46:21426 void FinishInstallationForTest(const Extension* extension) {
benwells1dd4acd2015-12-09 02:20:24427 FinishInstallation(extension);
[email protected]dccba4f82014-05-29 00:52:56428 }
Takumi Fujimoto43c8c00f2017-07-26 22:48:56429
430 void UninstallMigratedExtensionsForTest() { UninstallMigratedExtensions(); }
[email protected]dccba4f82014-05-29 00:52:56431#endif
432
[email protected]3c4abc82012-10-22 22:25:54433 void set_browser_terminating_for_test(bool value) {
434 browser_terminating_ = value;
435 }
436
[email protected]4e9b59d2013-12-18 06:47:14437 // Set a callback to be called when all external providers are ready and their
438 // extensions have been installed.
439 void set_external_updates_finished_callback_for_test(
440 const base::Closure& callback) {
441 external_updates_finished_callback_ = callback;
442 }
443
lazyboy77214d3c2017-04-04 16:46:12444 void set_external_updates_disabled_for_test(bool value) {
445 external_updates_disabled_for_test_ = value;
446 }
447
[email protected]14908b72011-04-20 06:54:36448 private:
catmullings98cd1942016-08-30 22:31:59449 // Loads extensions specified via a command line flag/switch.
450 void LoadExtensionsFromCommandLineFlag(const char* switch_name);
451
[email protected]dccba4f82014-05-29 00:52:56452 // content::NotificationObserver implementation:
dchengae36a4a2014-10-21 12:36:36453 void Observe(int type,
454 const content::NotificationSource& source,
455 const content::NotificationDetails& details) override;
[email protected]dccba4f82014-05-29 00:52:56456
Devlin Cronineea1b7a2018-05-26 02:46:21457 // Blacklist::Observer implementation.
dchengae36a4a2014-10-21 12:36:36458 void OnBlacklistUpdated() override;
[email protected]dccba4f82014-05-29 00:52:56459
weidongg04695232017-06-09 00:01:05460 // UpgradeObserver implementation.
461 void OnUpgradeRecommended() override;
462
Devlin Cronineea1b7a2018-05-26 02:46:21463 // ExtensionRegistrar::Delegate implementation.
464 void PreAddExtension(const Extension* extension,
465 const Extension* old_extension) override;
466 void PostActivateExtension(scoped_refptr<const Extension> extension) override;
Michael Giuffrida6397c592017-10-09 20:46:53467 void PostDeactivateExtension(
Devlin Cronineea1b7a2018-05-26 02:46:21468 scoped_refptr<const Extension> extension) override;
469 void LoadExtensionForReload(
470 const ExtensionId& extension_id,
471 const base::FilePath& path,
472 ExtensionRegistrar::LoadErrorBehavior load_error_behavior) override;
473 bool CanEnableExtension(const Extension* extension) override;
474 bool CanDisableExtension(const Extension* extension) override;
475 bool ShouldBlockExtension(const Extension* extension) override;
Michael Giuffrida6397c592017-10-09 20:46:53476
[email protected]dccba4f82014-05-29 00:52:56477 // For the extension in |version_path| with |id|, check to see if it's an
478 // externally managed extension. If so, uninstall it.
479 void CheckExternalUninstall(const std::string& id);
480
Tatsuhisa Yamaguchi5ed1aece32017-10-26 10:18:56481 // Attempt to enable Zip Unpacker component extension if it is disabled.
482 // This function doesn't override MUST_REAMIN_DISABLED management policy.
483 // Component extensions are managed and cannot be disabled by user, however,
484 // there are some cases having a disabled component extension in profile.
485 void EnableZipUnpackerExtension();
486
rkaplowa8fd8d32015-02-25 21:27:56487 // Attempt to enable all disabled extensions which the only disabled reason is
488 // reloading.
489 void EnabledReloadableExtensions();
490
491 // Finish install (if possible) of extensions that were still delayed while
492 // the browser was shut down.
493 void MaybeFinishShutdownDelayed();
494
[email protected]2d19eb6e2014-01-27 17:30:00495 // Populates greylist_.
496 void LoadGreylistFromPrefs();
497
[email protected]4a10006a2013-05-17 23:18:35498 // Signals *ready_ and sends a notification to the listeners.
[email protected]820d9bd2013-04-03 03:46:03499 void SetReadyAndNotifyListeners();
500
[email protected]dccba4f82014-05-29 00:52:56501 // Returns true if all the external extension providers are ready.
502 bool AreAllExternalProvidersReady() const;
503
504 // Called once all external providers are ready. Checks for unclaimed
505 // external extensions.
506 void OnAllExternalProvidersReady();
507
[email protected]8c484b742012-11-29 06:05:36508 // Update preferences for a new or updated extension; notify observers that
509 // the extension is installed, e.g., to update event handlers on background
510 // pages; and perform other extension install tasks before calling
511 // AddExtension.
Devlin Cronineea1b7a2018-05-26 02:46:21512 // |install_flags| is a bitmask of InstallFlags.
Karandeep Bhatiaa8930652017-10-11 17:41:12513 void AddNewOrUpdatedExtension(
Devlin Cronineea1b7a2018-05-26 02:46:21514 const Extension* extension,
515 Extension::State initial_state,
Karandeep Bhatiaa8930652017-10-11 17:41:12516 int install_flags,
517 const syncer::StringOrdinal& page_ordinal,
518 const std::string& install_parameter,
519 const base::Optional<int>& dnr_ruleset_checksum);
[email protected]8c484b742012-11-29 06:05:36520
benwells1dd4acd2015-12-09 02:20:24521 // Common helper to finish installing the given extension.
Devlin Cronineea1b7a2018-05-26 02:46:21522 void FinishInstallation(const Extension* extension);
[email protected]6f6101832012-11-27 22:10:48523
[email protected]b914e2952013-04-26 07:10:03524 // Disables the extension if the privilege level has increased
525 // (e.g., due to an upgrade).
Devlin Cronineea1b7a2018-05-26 02:46:21526 void CheckPermissionsIncrease(const Extension* extension,
treib6e51bca2016-06-15 10:26:03527 bool is_extension_loaded);
[email protected]b914e2952013-04-26 07:10:03528
[email protected]aab98a52009-12-02 03:22:35529 // Helper that updates the active extension list used for crash reporting.
530 void UpdateActiveExtensionsInCrashReporter();
531
binjin47947f842014-11-18 12:10:24532 // Helper to get the disable reasons for an installed (or upgraded) extension.
Minh X. Nguyen45479012017-08-18 21:35:36533 // A return value of disable_reason::DISABLE_NONE indicates that we should
534 // enable this extension initially.
Devlin Cronineea1b7a2018-05-26 02:46:21535 int GetDisableReasonsOnInstalled(const Extension* extension);
[email protected]612a1cb12012-10-17 13:18:03536
mlerman6a37b6a42014-11-26 22:10:53537 // Helper method to determine if an extension can be blocked.
Devlin Cronineea1b7a2018-05-26 02:46:21538 bool CanBlockExtension(const Extension* extension) const;
mlerman6a37b6a42014-11-26 22:10:53539
xiyuanf6a4c6a62016-04-19 18:14:54540 // Helper to determine if installing an extensions should proceed immediately,
541 // or if we should delay the install until further notice, or if the install
542 // should be aborted. A pending install is delayed or aborted when any of the
543 // delayers say so and only proceeds when all delayers return INSTALL.
544 // |extension| is the extension to be installed. |install_immediately| is the
545 // install flag set with the install. |reason| is the reason associated with
546 // the install delayer that wants to defer or abort the install.
Devlin Cronineea1b7a2018-05-26 02:46:21547 InstallGate::Action ShouldDelayExtensionInstall(
548 const Extension* extension,
xiyuanf6a4c6a62016-04-19 18:14:54549 bool install_immediately,
Devlin Cronineea1b7a2018-05-26 02:46:21550 ExtensionPrefs::DelayReason* reason) const;
[email protected]e7aa7b7e2012-11-27 04:51:22551
[email protected]695b5712012-12-06 23:55:28552 // Manages the blacklisted extensions, intended as callback from
553 // Blacklist::GetBlacklistedIDs.
Devlin Cronineea1b7a2018-05-26 02:46:21554 void ManageBlacklist(const Blacklist::BlacklistStateMap& blacklisted_ids);
[email protected]2d19eb6e2014-01-27 17:30:00555
mlerman6a37b6a42014-11-26 22:10:53556 // Add extensions in |blacklisted| to blacklisted_extensions, remove
557 // extensions that are neither in |blacklisted|, nor in |unchanged|.
Devlin Cronineea1b7a2018-05-26 02:46:21558 void UpdateBlacklistedExtensions(const ExtensionIdSet& to_blacklist,
559 const ExtensionIdSet& unchanged);
[email protected]2d19eb6e2014-01-27 17:30:00560
561 void UpdateGreylistedExtensions(
Devlin Cronineea1b7a2018-05-26 02:46:21562 const ExtensionIdSet& greylist,
563 const ExtensionIdSet& unchanged,
564 const Blacklist::BlacklistStateMap& state_map);
[email protected]695b5712012-12-06 23:55:28565
[email protected]bb1bc9b32013-12-21 03:09:14566 // Used only by test code.
567 void UnloadAllExtensionsInternal();
568
[email protected]ebe07772014-05-22 04:16:06569 // Disable apps & extensions now to stop them from running after a profile
570 // has been conceptually deleted. Don't wait for full browser shutdown and
571 // the actual profile objects to be destroyed.
572 void OnProfileDestructionStarted();
573
[email protected]5a145e82014-05-29 22:19:07574 // Called on file task runner thread to uninstall extension.
575 static void UninstallExtensionOnFileThread(
576 const std::string& id,
577 Profile* profile,
578 const base::FilePath& install_dir,
579 const base::FilePath& extension_path);
580
rdevlin.croninf2e1cb012017-05-27 01:27:59581 // Called when the initial extensions load has completed.
582 void OnInstalledExtensionsLoaded();
583
Takumi Fujimoto43c8c00f2017-07-26 22:48:56584 // Uninstall extensions that have been migrated to component extensions.
585 void UninstallMigratedExtensions();
586
catmullings98cd1942016-08-30 22:31:59587 const base::CommandLine* command_line_ = nullptr;
588
[email protected]31d8f5f22012-04-02 15:22:08589 // The normal profile associated with this ExtensionService.
achuith2f5578b2016-02-26 21:57:13590 Profile* profile_ = nullptr;
[email protected]6ef635e42009-07-26 06:16:12591
[email protected]31d8f5f22012-04-02 15:22:08592 // The ExtensionSystem for the profile above.
Devlin Cronineea1b7a2018-05-26 02:46:21593 ExtensionSystem* system_ = nullptr;
[email protected]31d8f5f22012-04-02 15:22:08594
[email protected]695b5712012-12-06 23:55:28595 // Preferences for the owning profile.
Devlin Cronineea1b7a2018-05-26 02:46:21596 ExtensionPrefs* extension_prefs_ = nullptr;
[email protected]894bb502009-05-21 22:39:57597
[email protected]695b5712012-12-06 23:55:28598 // Blacklist for the owning profile.
Devlin Cronineea1b7a2018-05-26 02:46:21599 Blacklist* blacklist_ = nullptr;
[email protected]695b5712012-12-06 23:55:28600
[email protected]5fdfa562013-12-27 17:43:59601 // Sets of enabled/disabled/terminated/blacklisted extensions. Not owned.
Devlin Cronineea1b7a2018-05-26 02:46:21602 ExtensionRegistry* registry_ = nullptr;
[email protected]695b5712012-12-06 23:55:28603
[email protected]2d19eb6e2014-01-27 17:30:00604 // Set of greylisted extensions. These extensions are disabled if they are
605 // already installed in Chromium at the time when they are added to
606 // the greylist. Unlike blacklisted extensions, greylisted ones are visible
607 // to the user and if user re-enables such an extension, they remain enabled.
608 //
609 // These extensions should appear in registry_.
Devlin Cronineea1b7a2018-05-26 02:46:21610 ExtensionSet greylist_;
[email protected]2d19eb6e2014-01-27 17:30:00611
catmullings98cd1942016-08-30 22:31:59612 // Set of whitelisted enabled extensions loaded from the
613 // --disable-extensions-except command line flag.
614 std::set<std::string> disable_flag_exempted_extensions_;
615
[email protected]9f4e4f082013-06-21 07:11:19616 // The list of extension installs delayed for various reasons. The reason
[email protected]bb1bc9b32013-12-21 03:09:14617 // for delayed install is stored in ExtensionPrefs. These are not part of
618 // ExtensionRegistry because they are not yet installed.
Devlin Cronineea1b7a2018-05-26 02:46:21619 ExtensionSet delayed_installs_;
[email protected]0db124b02012-11-07 04:55:05620
[email protected]b2907fd2011-03-25 16:43:37621 // Hold the set of pending extensions.
Devlin Cronineea1b7a2018-05-26 02:46:21622 PendingExtensionManager pending_extension_manager_;
[email protected]aa142702010-03-26 01:26:33623
[email protected]6014d672008-12-05 00:38:25624 // The full path to the directory where extensions are installed.
[email protected]650b2d52013-02-10 03:41:45625 base::FilePath install_directory_;
[email protected]6014d672008-12-05 00:38:25626
[email protected]e2eb43112009-05-29 21:19:54627 // Whether or not extensions are enabled.
achuith2f5578b2016-02-26 21:57:13628 bool extensions_enabled_ = true;
[email protected]e2eb43112009-05-29 21:19:54629
[email protected]4a10006a2013-05-17 23:18:35630 // Signaled when all extensions are loaded.
Devlin Cronineea1b7a2018-05-26 02:46:21631 OneShotEvent* const ready_;
[email protected]e81dba32009-06-19 20:19:13632
[email protected]93fd78f42009-07-10 16:43:17633 // Our extension updater, if updates are turned on.
Devlin Cronineea1b7a2018-05-26 02:46:21634 std::unique_ptr<ExtensionUpdater> updater_;
[email protected]93fd78f42009-07-10 16:43:17635
[email protected]6c2381d2011-10-19 02:52:53636 content::NotificationRegistrar registrar_;
[email protected]4814b512009-11-07 00:12:29637
[email protected]d8c8f25f2011-11-02 18:18:01638 // Keeps track of loading and unloading component extensions.
Devlin Cronineea1b7a2018-05-26 02:46:21639 std::unique_ptr<ComponentLoader> component_loader_;
[email protected]d8c8f25f2011-11-02 18:18:01640
[email protected]8e4560b62011-01-14 10:09:14641 // A collection of external extension providers. Each provider reads
642 // a source of external extension information. Examples include the
643 // windows registry and external_extensions.json.
Devlin Cronineea1b7a2018-05-26 02:46:21644 ProviderCollection external_extension_providers_;
[email protected]8e4560b62011-01-14 10:09:14645
646 // Set to true by OnExternalExtensionUpdateUrlFound() when an external
[email protected]94fde232012-04-27 10:22:30647 // extension URL is found, and by CheckForUpdatesSoon() when an update check
648 // has to wait for the external providers. Used in
649 // OnAllExternalProvidersReady() to determine if an update check is needed to
650 // install pending extensions.
achuith2f5578b2016-02-26 21:57:13651 bool update_once_all_providers_are_ready_ = false;
[email protected]8e4560b62011-01-14 10:09:14652
[email protected]4e9b59d2013-12-18 06:47:14653 // A callback to be called when all external providers are ready and their
654 // extensions have been installed. Normally this is a null callback, but
655 // is used in external provider related tests.
Minh X. Nguyen722b9682018-04-25 21:46:48656 // TODO(mxnguyen): Change |external_updates_finished_callback_| to
657 // OnceClosure.
[email protected]4e9b59d2013-12-18 06:47:14658 base::Closure external_updates_finished_callback_;
659
[email protected]3c4abc82012-10-22 22:25:54660 // Set when the browser is terminating. Prevents us from installing or
661 // updating additional extensions and allows in-progress installations to
662 // decide to abort.
achuith2f5578b2016-02-26 21:57:13663 bool browser_terminating_ = false;
[email protected]3c4abc82012-10-22 22:25:54664
lazyboy77214d3c2017-04-04 16:46:12665 // If set, call to CheckForExternalUpdates() will bail out.
666 bool external_updates_disabled_for_test_ = false;
667
[email protected]460c6712013-04-24 07:20:01668 // Set to true if this is the first time this ExtensionService has run.
669 // Used for specially handling external extensions that are installed the
670 // first time.
achuith2f5578b2016-02-26 21:57:13671 bool is_first_run_ = false;
[email protected]460c6712013-04-24 07:20:01672
mlerman6a37b6a42014-11-26 22:10:53673 // Set to true if extensions are all to be blocked.
achuith2f5578b2016-02-26 21:57:13674 bool block_extensions_ = false;
mlerman6a37b6a42014-11-26 22:10:53675
[email protected]373daf972014-04-10 01:50:44676 // The controller for the UI that alerts the user about any blacklisted
677 // extensions.
Devlin Cronineea1b7a2018-05-26 02:46:21678 std::unique_ptr<ExtensionErrorController> error_controller_;
[email protected]373daf972014-04-10 01:50:44679
[email protected]2894a512014-06-26 19:03:56680 // The manager for extensions that were externally installed that is
681 // responsible for prompting the user about suspicious extensions.
Devlin Cronineea1b7a2018-05-26 02:46:21682 std::unique_ptr<ExternalInstallManager> external_install_manager_;
[email protected]2894a512014-06-26 19:03:56683
Devlin Cronineea1b7a2018-05-26 02:46:21684 std::unique_ptr<ExtensionActionStorageManager>
[email protected]c77f2352012-08-08 22:07:58685 extension_action_storage_manager_;
686
[email protected]90878c52014-04-04 18:21:02687 // The SharedModuleService used to check for import dependencies.
Devlin Cronineea1b7a2018-05-26 02:46:21688 std::unique_ptr<SharedModuleService> shared_module_service_;
[email protected]90878c52014-04-04 18:21:02689
Devlin Cronineea1b7a2018-05-26 02:46:21690 base::ObserverList<UpdateObserver, true> update_observers_;
[email protected]efdb7f1a2014-03-28 20:43:38691
ryanackley48bedbd2015-01-27 23:12:14692 // Migrates app data when upgrading a legacy packaged app to a platform app
Devlin Cronineea1b7a2018-05-26 02:46:21693 std::unique_ptr<AppDataMigrator> app_data_migrator_;
ryanackley48bedbd2015-01-27 23:12:14694
Michael Giuffrida023e3532017-09-28 23:21:21695 // Helper to register and unregister extensions.
Devlin Cronineea1b7a2018-05-26 02:46:21696 ExtensionRegistrar extension_registrar_;
Michael Giuffrida023e3532017-09-28 23:21:21697
Sergey Poromov0360b9e72018-04-19 17:37:29698 // Tracker of enterprise policy forced installation.
Devlin Cronineea1b7a2018-05-26 02:46:21699 InstallationTracker forced_extensions_tracker_;
Sergey Poromov0360b9e72018-04-19 17:37:29700
Devlin Cronineea1b7a2018-05-26 02:46:21701 using InstallGateRegistry =
702 std::map<ExtensionPrefs::DelayReason, InstallGate*>;
xiyuanf6a4c6a62016-04-19 18:14:54703 InstallGateRegistry install_delayer_registry_;
704
[email protected]eaa7dd182010-12-14 11:09:00705 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
[email protected]dccba4f82014-05-29 00:52:56706 DestroyingProfileClearsExtensions);
[email protected]f71b582c2014-01-10 17:03:15707 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, SetUnsetBlacklistInPrefs);
708 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
709 BlacklistedExtensionWillNotInstall);
710 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
711 UnloadBlacklistedExtensionPolicy);
712 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
713 WillNotLoadBlacklistedExtensionsFromDirectory);
[email protected]757d60a2014-05-23 00:11:44714 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, ReloadBlacklistedExtension);
atuchin6dc7c442016-07-20 07:04:34715 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
716 RemoveExtensionFromBlacklist);
[email protected]757d60a2014-05-23 00:11:44717 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, BlacklistedInPrefsFromStartup);
[email protected]2d19eb6e2014-01-27 17:30:00718 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
719 GreylistedExtensionDisabled);
720 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
721 GreylistDontEnableManuallyDisabled);
722 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
723 GreylistUnknownDontChange);
binjin47947f842014-11-18 12:10:24724 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
725 ManagementPolicyProhibitsEnableOnInstalled);
mlerman6a37b6a42014-11-26 22:10:53726 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
727 BlockAndUnblockBlacklistedExtension);
Devlin Cronineea1b7a2018-05-26 02:46:21728 FRIEND_TEST_ALL_PREFIXES(::BlacklistedExtensionSyncServiceTest,
proberge901ecab2017-08-31 19:24:28729 SyncBlacklistedExtension);
Devlin Cronineea1b7a2018-05-26 02:46:21730 friend class ::BlacklistedExtensionSyncServiceTest;
[email protected]dccba4f82014-05-29 00:52:56731
[email protected]eaa7dd182010-12-14 11:09:00732 DISALLOW_COPY_AND_ASSIGN(ExtensionService);
[email protected]6014d672008-12-05 00:38:25733};
734
Devlin Cronineea1b7a2018-05-26 02:46:21735} // namespace extensions
736
[email protected]eaa7dd182010-12-14 11:09:00737#endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_