Cast: Stop logging kVideoFrameSentToEncoder and rename a couple events.
[chromium-blink-merge.git] / chrome / browser / extensions / extension_service.h
blob03f18a1957bce230be6e745614a80eefb2d8d16b
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_
6 #define CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_
8 #include <list>
9 #include <map>
10 #include <set>
11 #include <string>
12 #include <vector>
14 #include "base/compiler_specific.h"
15 #include "base/files/file_path.h"
16 #include "base/gtest_prod_util.h"
17 #include "base/memory/ref_counted.h"
18 #include "base/memory/weak_ptr.h"
19 #include "base/prefs/pref_change_registrar.h"
20 #include "base/strings/string16.h"
21 #include "chrome/browser/extensions/blacklist.h"
22 #include "chrome/browser/extensions/extension_sync_service.h"
23 #include "chrome/browser/extensions/pending_extension_manager.h"
24 #include "content/public/browser/devtools_agent_host.h"
25 #include "content/public/browser/notification_observer.h"
26 #include "content/public/browser/notification_registrar.h"
27 #include "extensions/browser/extension_function_histogram_value.h"
28 #include "extensions/browser/extension_prefs.h"
29 #include "extensions/browser/external_provider_interface.h"
30 #include "extensions/browser/management_policy.h"
31 #include "extensions/browser/process_manager.h"
32 #include "extensions/common/extension.h"
33 #include "extensions/common/extension_set.h"
34 #include "extensions/common/manifest.h"
35 #include "extensions/common/one_shot_event.h"
37 class GURL;
38 class Profile;
40 namespace base {
41 class CommandLine;
42 class SequencedTaskRunner;
43 class Version;
46 namespace extensions {
47 class BrowserEventRouter;
48 class ComponentLoader;
49 class CrxInstaller;
50 class ExtensionActionStorageManager;
51 class ExtensionErrorController;
52 class ExtensionRegistry;
53 class ExtensionSystem;
54 class ExtensionToolbarModel;
55 class ExtensionUpdater;
56 class PendingExtensionManager;
57 class RendererStartupHelper;
58 class SharedModuleService;
59 class UpdateObserver;
60 } // namespace extensions
62 using extensions::ExtensionIdSet;
64 namespace syncer {
65 class SyncErrorFactory;
68 // This is an interface class to encapsulate the dependencies that
69 // various classes have on ExtensionService. This allows easy mocking.
70 class ExtensionServiceInterface
71 : public base::SupportsWeakPtr<ExtensionServiceInterface> {
72 public:
73 virtual ~ExtensionServiceInterface() {}
75 // DEPRECATED: Use ExtensionRegistry::enabled_extensions() instead.
76 // ExtensionRegistry also has the disabled, terminated and blacklisted sets.
77 virtual const extensions::ExtensionSet* extensions() const = 0;
79 virtual extensions::PendingExtensionManager* pending_extension_manager() = 0;
81 // Install an update. Return true if the install can be started.
82 // Set out_crx_installer to the installer if one was started.
83 virtual bool UpdateExtension(
84 const std::string& id,
85 const base::FilePath& path,
86 bool file_ownership_passed,
87 extensions::CrxInstaller** out_crx_installer) = 0;
88 virtual const extensions::Extension* GetExtensionById(
89 const std::string& id,
90 bool include_disabled) const = 0;
91 virtual const extensions::Extension* GetInstalledExtension(
92 const std::string& id) const = 0;
94 virtual const extensions::Extension* GetPendingExtensionUpdate(
95 const std::string& extension_id) const = 0;
96 virtual void FinishDelayedInstallation(const std::string& extension_id) = 0;
98 virtual bool IsExtensionEnabled(const std::string& extension_id) const = 0;
100 virtual void CheckManagementPolicy() = 0;
102 // Safe to call multiple times in a row.
104 // TODO(akalin): Remove this method (and others) once we refactor
105 // themes sync to not use it directly.
106 virtual void CheckForUpdatesSoon() = 0;
108 virtual void AddExtension(const extensions::Extension* extension) = 0;
109 virtual void AddComponentExtension(
110 const extensions::Extension* extension) = 0;
112 virtual void UnloadExtension(
113 const std::string& extension_id,
114 extensions::UnloadedExtensionInfo::Reason reason) = 0;
115 virtual void RemoveComponentExtension(const std::string& extension_id) = 0;
117 virtual bool is_ready() = 0;
119 // Returns task runner for crx installation file I/O operations.
120 virtual base::SequencedTaskRunner* GetFileTaskRunner() = 0;
123 // Manages installed and running Chromium extensions. An instance is shared
124 // between normal and incognito profiles.
125 class ExtensionService
126 : public ExtensionServiceInterface,
127 public extensions::ExternalProviderInterface::VisitorInterface,
128 public content::NotificationObserver,
129 public extensions::Blacklist::Observer {
130 public:
131 // Attempts to uninstall an extension from a given ExtensionService. Returns
132 // true iff the target extension exists.
133 static bool UninstallExtensionHelper(ExtensionService* extensions_service,
134 const std::string& extension_id);
136 // Constructor stores pointers to |profile| and |extension_prefs| but
137 // ownership remains at caller.
138 ExtensionService(Profile* profile,
139 const base::CommandLine* command_line,
140 const base::FilePath& install_directory,
141 extensions::ExtensionPrefs* extension_prefs,
142 extensions::Blacklist* blacklist,
143 bool autoupdate_enabled,
144 bool extensions_enabled,
145 extensions::OneShotEvent* ready);
147 virtual ~ExtensionService();
149 // DEPRECATED: Use ExtensionRegistry::enabled_extensions() instead.
150 // ExtensionRegistry also has the disabled, terminated and blacklisted sets.
151 virtual const extensions::ExtensionSet* extensions() const OVERRIDE;
153 const extensions::ExtensionSet* delayed_installs() const;
155 // Gets the object managing the set of pending extensions.
156 virtual extensions::PendingExtensionManager*
157 pending_extension_manager() OVERRIDE;
159 const base::FilePath& install_directory() const { return install_directory_; }
161 // Getter and setter for the flag that specifies whether the extension is
162 // being reloaded.
163 bool IsBeingReloaded(const std::string& extension_id) const;
164 void SetBeingReloaded(const std::string& extension_id, bool value);
166 // Initialize and start all installed extensions.
167 void Init();
169 // Called when the associated Profile is going to be destroyed.
170 void Shutdown();
172 // Look up an extension by ID. Does not include terminated
173 // extensions.
174 virtual const extensions::Extension* GetExtensionById(
175 const std::string& id, bool include_disabled) const OVERRIDE;
177 // Looks up an extension by ID, regardless of whether it's enabled,
178 // disabled, blacklisted, or terminated.
179 // DEPRECATED: Replace with:
180 // ExtensionRegistry::GetExtensionById(id, ExtensionRegistry::EVERYTHING).
181 virtual const extensions::Extension* GetInstalledExtension(
182 const std::string& id) const OVERRIDE;
184 // Updates a currently-installed extension with the contents from
185 // |extension_path|.
186 // TODO(aa): This method can be removed. ExtensionUpdater could use
187 // CrxInstaller directly instead.
188 virtual bool UpdateExtension(
189 const std::string& id,
190 const base::FilePath& extension_path,
191 bool file_ownership_passed,
192 extensions::CrxInstaller** out_crx_installer) OVERRIDE;
194 // Reloads the specified extension, sending the onLaunched() event to it if it
195 // currently has any window showing.
196 void ReloadExtension(const std::string extension_id);
198 // Uninstalls the specified extension. Callers should only call this method
199 // with extensions that exist. |external_uninstall| is a magical parameter
200 // that is only used to send information to ExtensionPrefs, which external
201 // callers should never set to true.
203 // We pass the |extension_id| by value to avoid having it deleted from under
204 // us incase someone calls it with Extension::id() or another string that we
205 // are going to delete in this function.
207 // TODO(aa): Remove |external_uninstall| -- this information should be passed
208 // to ExtensionPrefs some other way.
209 virtual bool UninstallExtension(const std::string& extension_id,
210 bool external_uninstall,
211 base::string16* error);
213 virtual bool IsExtensionEnabled(
214 const std::string& extension_id) const OVERRIDE;
216 // Enables the extension. If the extension is already enabled, does
217 // nothing.
218 virtual void EnableExtension(const std::string& extension_id);
220 // Disables the extension. If the extension is already disabled, or
221 // cannot be disabled, does nothing.
222 virtual void DisableExtension(const std::string& extension_id,
223 extensions::Extension::DisableReason disable_reason);
225 // Disable non-default and non-managed extensions with ids not in
226 // |except_ids|. Default extensions are those from the Web Store with
227 // |was_installed_by_default| flag.
228 void DisableUserExtensions(const std::vector<std::string>& except_ids);
230 // Updates the |extension|'s granted permissions lists to include all
231 // permissions in the |extension|'s manifest and re-enables the
232 // extension.
233 void GrantPermissionsAndEnableExtension(
234 const extensions::Extension* extension);
236 // Updates the |extension|'s granted permissions lists to include all
237 // permissions in the |extensions|'s manifest.
238 void GrantPermissions(
239 const extensions::Extension* extension);
241 // Check for updates (or potentially new extensions from external providers)
242 void CheckForExternalUpdates();
244 // Unload the specified extension.
245 virtual void UnloadExtension(
246 const std::string& extension_id,
247 extensions::UnloadedExtensionInfo::Reason reason) OVERRIDE;
249 // Remove the specified component extension.
250 virtual void RemoveComponentExtension(const std::string& extension_id)
251 OVERRIDE;
253 // Unload all extensions. Does not send notifications.
254 void UnloadAllExtensionsForTest();
256 // Reloads all extensions. Does not notify that extensions are ready.
257 void ReloadExtensionsForTest();
259 // Called when the initial extensions load has completed.
260 virtual void OnLoadedInstalledExtensions();
262 // Adds |extension| to this ExtensionService and notifies observers that the
263 // extensions have been loaded.
264 virtual void AddExtension(const extensions::Extension* extension) OVERRIDE;
266 // Check if we have preferences for the component extension and, if not or if
267 // the stored version differs, install the extension (without requirements
268 // checking) before calling AddExtension.
269 virtual void AddComponentExtension(const extensions::Extension* extension)
270 OVERRIDE;
272 // Informs the service that an extension's files are in place for loading.
274 // |page_ordinal| is the location of the extension in the app launcher.
275 // |has_requirement_errors| is true if requirements of the extension weren't
276 // met (for example graphics capabilities).
277 // |blacklist_state| will be BLACKLISTED if the extension is blacklisted.
278 // |wait_for_idle| may be false to install the extension immediately.
279 void OnExtensionInstalled(
280 const extensions::Extension* extension,
281 const syncer::StringOrdinal& page_ordinal,
282 bool has_requirement_errors,
283 extensions::BlacklistState blacklist_state,
284 bool wait_for_idle);
286 // Checks for delayed installation for all pending installs.
287 void MaybeFinishDelayedInstallations();
289 // Similar to FinishInstallation, but first checks if there still is an update
290 // pending for the extension, and makes sure the extension is still idle.
291 void MaybeFinishDelayedInstallation(const std::string& extension_id);
293 // Finishes installation of an update for an extension with the specified id,
294 // when installation of that extension was previously delayed because the
295 // extension was in use.
296 virtual void FinishDelayedInstallation(
297 const std::string& extension_id) OVERRIDE;
299 // Returns an update for an extension with the specified id, if installation
300 // of that update was previously delayed because the extension was in use. If
301 // no updates are pending for the extension returns NULL.
302 virtual const extensions::Extension* GetPendingExtensionUpdate(
303 const std::string& extension_id) const OVERRIDE;
305 // Go through each extension and unload those that are not allowed to run by
306 // management policy providers (ie. network admin and Google-managed
307 // blacklist).
308 virtual void CheckManagementPolicy() OVERRIDE;
310 virtual void CheckForUpdatesSoon() OVERRIDE;
312 void set_extensions_enabled(bool enabled) { extensions_enabled_ = enabled; }
313 bool extensions_enabled() { return extensions_enabled_; }
315 void set_show_extensions_prompts(bool enabled) {
316 show_extensions_prompts_ = enabled;
319 bool show_extensions_prompts() {
320 return show_extensions_prompts_;
323 Profile* profile();
325 // Returns profile_ as a BrowserContext.
326 content::BrowserContext* GetBrowserContext() const;
328 void set_extension_sync_service(
329 ExtensionSyncService* extension_sync_service) {
330 extension_sync_service_ = extension_sync_service;
333 // Whether the extension service is ready.
334 virtual bool is_ready() OVERRIDE;
336 virtual base::SequencedTaskRunner* GetFileTaskRunner() OVERRIDE;
338 extensions::ComponentLoader* component_loader() {
339 return component_loader_.get();
342 // Note that this may return NULL if autoupdate is not turned on.
343 extensions::ExtensionUpdater* updater();
345 // Notify the frontend that there was an error loading an extension.
346 // This method is public because UnpackedInstaller and InstalledLoader
347 // can post to here.
348 // TODO(aa): Remove this. It doesn't do enough to be worth the dependency
349 // of these classes on ExtensionService.
350 void ReportExtensionLoadError(const base::FilePath& extension_path,
351 const std::string& error);
353 // ExtensionHost of background page calls this method right after its render
354 // view has been created.
355 void DidCreateRenderViewForBackgroundPage(extensions::ExtensionHost* host);
357 // For the extension in |version_path| with |id|, check to see if it's an
358 // externally managed extension. If so, uninstall it.
359 void CheckExternalUninstall(const std::string& id);
361 // Changes sequenced task runner for crx installation tasks to |task_runner|.
362 void SetFileTaskRunnerForTesting(base::SequencedTaskRunner* task_runner);
364 // Clear all ExternalProviders.
365 void ClearProvidersForTesting();
367 // Adds an ExternalProviderInterface for the service to use during testing.
368 // Takes ownership of |test_provider|.
369 void AddProviderForTesting(
370 extensions::ExternalProviderInterface* test_provider);
372 // ExternalProvider::Visitor implementation.
373 virtual bool OnExternalExtensionFileFound(
374 const std::string& id,
375 const base::Version* version,
376 const base::FilePath& path,
377 extensions::Manifest::Location location,
378 int creation_flags,
379 bool mark_acknowledged) OVERRIDE;
381 virtual bool OnExternalExtensionUpdateUrlFound(
382 const std::string& id,
383 const std::string& install_parameter,
384 const GURL& update_url,
385 extensions::Manifest::Location location,
386 int creation_flags,
387 bool mark_acknowledged) OVERRIDE;
389 virtual void OnExternalProviderReady(
390 const extensions::ExternalProviderInterface* provider) OVERRIDE;
392 // Returns true when all the external extension providers are ready.
393 bool AreAllExternalProvidersReady() const;
395 void OnAllExternalProvidersReady();
397 // Checks if there are any new external extensions to notify the user about.
398 void UpdateExternalExtensionAlert();
400 // Given a (presumably just-installed) extension id, mark that extension as
401 // acknowledged.
402 void AcknowledgeExternalExtension(const std::string& id);
404 // Returns true if this extension is an external one that has yet to be
405 // marked as acknowledged.
406 bool IsUnacknowledgedExternalExtension(
407 const extensions::Extension* extension);
409 // Disable extensions that are known to be disabled yet are currently enabled.
410 void ReconcileKnownDisabled();
412 // content::NotificationObserver
413 virtual void Observe(int type,
414 const content::NotificationSource& source,
415 const content::NotificationDetails& details) OVERRIDE;
417 // Postpone installations so that we don't have to worry about race
418 // conditions.
419 void OnGarbageCollectIsolatedStorageStart();
421 // Restart any extension installs which were delayed for isolated storage
422 // garbage collection.
423 void OnGarbageCollectIsolatedStorageFinished();
425 // Record a histogram using the PermissionMessage enum values for each
426 // permission in |e|.
427 // NOTE: If this is ever called with high frequency, the implementation may
428 // need to be made more efficient.
429 static void RecordPermissionMessagesHistogram(
430 const extensions::Extension* e, const char* histogram);
432 // Unloads the given extension and mark the extension as terminated. This
433 // doesn't notify the user that the extension was terminated, if such a
434 // notification is desired the calling code is responsible for doing that.
435 void TerminateExtension(const std::string& extension_id);
437 #if defined(UNIT_TEST)
438 void TrackTerminatedExtensionForTest(const extensions::Extension* extension) {
439 TrackTerminatedExtension(extension);
442 void FinishInstallationForTest(const extensions::Extension* extension) {
443 FinishInstallation(extension);
445 #endif
447 base::WeakPtr<ExtensionService> AsWeakPtr() { return base::AsWeakPtr(this); }
449 bool browser_terminating() const { return browser_terminating_; }
451 extensions::SharedModuleService* shared_module_service() {
452 return shared_module_service_.get();
455 // For testing.
456 void set_browser_terminating_for_test(bool value) {
457 browser_terminating_ = value;
460 // By default ExtensionService will wait with installing an updated extension
461 // until the extension is idle. Tests might not like this behavior, so you can
462 // disable it with this method.
463 void set_install_updates_when_idle_for_test(bool value) {
464 install_updates_when_idle_ = value;
467 // Set a callback to be called when all external providers are ready and their
468 // extensions have been installed.
469 void set_external_updates_finished_callback_for_test(
470 const base::Closure& callback) {
471 external_updates_finished_callback_ = callback;
474 // Adds/Removes update observers.
475 void AddUpdateObserver(extensions::UpdateObserver* observer);
476 void RemoveUpdateObserver(extensions::UpdateObserver* observer);
478 private:
479 // Populates greylist_.
480 void LoadGreylistFromPrefs();
482 // Signals *ready_ and sends a notification to the listeners.
483 void SetReadyAndNotifyListeners();
485 // Return true if the sync type of |extension| matches |type|.
486 void OnExtensionInstallPrefChanged();
488 // Adds the given extension to the list of terminated extensions if
489 // it is not already there and unloads it.
490 void TrackTerminatedExtension(const extensions::Extension* extension);
492 // Removes the extension with the given id from the list of
493 // terminated extensions if it is there.
494 void UntrackTerminatedExtension(const std::string& id);
496 // Update preferences for a new or updated extension; notify observers that
497 // the extension is installed, e.g., to update event handlers on background
498 // pages; and perform other extension install tasks before calling
499 // AddExtension.
500 void AddNewOrUpdatedExtension(const extensions::Extension* extension,
501 extensions::Extension::State initial_state,
502 extensions::BlacklistState blacklist_state,
503 const syncer::StringOrdinal& page_ordinal,
504 const std::string& install_parameter);
506 // Handles sending notification that |extension| was loaded.
507 void NotifyExtensionLoaded(const extensions::Extension* extension);
509 // Handles sending notification that |extension| was unloaded.
510 void NotifyExtensionUnloaded(
511 const extensions::Extension* extension,
512 extensions::UnloadedExtensionInfo::Reason reason);
514 // Common helper to finish installing the given extension.
515 void FinishInstallation(const extensions::Extension* extension);
517 // Updates the |extension|'s active permission set to include only permissions
518 // currently requested by the extension and all the permissions required by
519 // the extension.
520 void UpdateActivePermissions(const extensions::Extension* extension);
522 // Disables the extension if the privilege level has increased
523 // (e.g., due to an upgrade).
524 void CheckPermissionsIncrease(const extensions::Extension* extension,
525 bool is_extension_installed);
527 // Helper that updates the active extension list used for crash reporting.
528 void UpdateActiveExtensionsInCrashReporter();
530 // Helper to determine whether we should initially enable an installed
531 // (or upgraded) extension.
532 bool ShouldEnableOnInstall(const extensions::Extension* extension);
534 // Helper to determine if updating an extensions should proceed immediately,
535 // or if we should delay the update until further notice.
536 bool ShouldDelayExtensionUpdate(const std::string& extension_id,
537 bool wait_for_idle) const;
539 // extensions::Blacklist::Observer implementation.
540 virtual void OnBlacklistUpdated() OVERRIDE;
542 // Manages the blacklisted extensions, intended as callback from
543 // Blacklist::GetBlacklistedIDs.
544 void ManageBlacklist(
545 const extensions::Blacklist::BlacklistStateMap& blacklisted_ids);
547 // Add extensions in |blocked| to blacklisted_extensions, remove extensions
548 // that are neither in |blocked|, nor in |unchanged|.
549 void UpdateBlockedExtensions(const ExtensionIdSet& blocked,
550 const ExtensionIdSet& unchanged);
552 void UpdateGreylistedExtensions(
553 const ExtensionIdSet& greylist,
554 const ExtensionIdSet& unchanged,
555 const extensions::Blacklist::BlacklistStateMap& state_map);
557 // Used only by test code.
558 void UnloadAllExtensionsInternal();
560 // The normal profile associated with this ExtensionService.
561 Profile* profile_;
563 // The ExtensionSystem for the profile above.
564 extensions::ExtensionSystem* system_;
566 // Preferences for the owning profile.
567 extensions::ExtensionPrefs* extension_prefs_;
569 // Blacklist for the owning profile.
570 extensions::Blacklist* blacklist_;
572 // The ExtensionSyncService that is used by this ExtensionService.
573 ExtensionSyncService* extension_sync_service_;
575 // Sets of enabled/disabled/terminated/blacklisted extensions. Not owned.
576 extensions::ExtensionRegistry* registry_;
578 // Set of greylisted extensions. These extensions are disabled if they are
579 // already installed in Chromium at the time when they are added to
580 // the greylist. Unlike blacklisted extensions, greylisted ones are visible
581 // to the user and if user re-enables such an extension, they remain enabled.
583 // These extensions should appear in registry_.
584 extensions::ExtensionSet greylist_;
586 // The list of extension installs delayed for various reasons. The reason
587 // for delayed install is stored in ExtensionPrefs. These are not part of
588 // ExtensionRegistry because they are not yet installed.
589 extensions::ExtensionSet delayed_installs_;
591 // Hold the set of pending extensions.
592 extensions::PendingExtensionManager pending_extension_manager_;
594 // The full path to the directory where extensions are installed.
595 base::FilePath install_directory_;
597 // Whether or not extensions are enabled.
598 bool extensions_enabled_;
600 // Whether to notify users when they attempt to install an extension.
601 bool show_extensions_prompts_;
603 // Whether to delay installing of extension updates until the extension is
604 // idle.
605 bool install_updates_when_idle_;
607 // Signaled when all extensions are loaded.
608 extensions::OneShotEvent* const ready_;
610 // Our extension updater, if updates are turned on.
611 scoped_ptr<extensions::ExtensionUpdater> updater_;
613 // Map unloaded extensions' ids to their paths. When a temporarily loaded
614 // extension is unloaded, we lose the information about it and don't have
615 // any in the extension preferences file.
616 typedef std::map<std::string, base::FilePath> UnloadedExtensionPathMap;
617 UnloadedExtensionPathMap unloaded_extension_paths_;
619 // Store the ids of reloading extensions.
620 std::set<std::string> reloading_extensions_;
622 // Map of DevToolsAgentHost instances that are detached,
623 // waiting for an extension to be reloaded.
624 typedef std::map<std::string, scoped_refptr<content::DevToolsAgentHost> >
625 OrphanedDevTools;
626 OrphanedDevTools orphaned_dev_tools_;
628 content::NotificationRegistrar registrar_;
629 PrefChangeRegistrar pref_change_registrar_;
631 // Keeps track of loading and unloading component extensions.
632 scoped_ptr<extensions::ComponentLoader> component_loader_;
634 // A collection of external extension providers. Each provider reads
635 // a source of external extension information. Examples include the
636 // windows registry and external_extensions.json.
637 extensions::ProviderCollection external_extension_providers_;
639 // Set to true by OnExternalExtensionUpdateUrlFound() when an external
640 // extension URL is found, and by CheckForUpdatesSoon() when an update check
641 // has to wait for the external providers. Used in
642 // OnAllExternalProvidersReady() to determine if an update check is needed to
643 // install pending extensions.
644 bool update_once_all_providers_are_ready_;
646 // A callback to be called when all external providers are ready and their
647 // extensions have been installed. Normally this is a null callback, but
648 // is used in external provider related tests.
649 base::Closure external_updates_finished_callback_;
651 // Set when the browser is terminating. Prevents us from installing or
652 // updating additional extensions and allows in-progress installations to
653 // decide to abort.
654 bool browser_terminating_;
656 // Set to true to delay all new extension installations. Acts as a lock to
657 // allow background processing of garbage collection of on-disk state without
658 // needing to worry about race conditions caused by extension installation and
659 // reinstallation.
660 bool installs_delayed_for_gc_;
662 // Set to true if this is the first time this ExtensionService has run.
663 // Used for specially handling external extensions that are installed the
664 // first time.
665 bool is_first_run_;
667 // A set of the extension ids currently being reloaded. We use this to
668 // avoid showing a "new install" notice for an extension reinstall.
669 std::set<std::string> extensions_being_reloaded_;
671 // A set of the extension ids currently being terminated. We use this to
672 // avoid trying to unload the same extension twice.
673 std::set<std::string> extensions_being_terminated_;
675 // The controller for the UI that alerts the user about any blacklisted
676 // extensions.
677 scoped_ptr<extensions::ExtensionErrorController> error_controller_;
679 // Sequenced task runner for extension related file operations.
680 scoped_refptr<base::SequencedTaskRunner> file_task_runner_;
682 #if defined(ENABLE_EXTENSIONS)
683 scoped_ptr<extensions::ExtensionActionStorageManager>
684 extension_action_storage_manager_;
685 #endif
686 scoped_ptr<extensions::ManagementPolicy::Provider>
687 shared_module_policy_provider_;
689 // The SharedModuleService used to check for import dependencies.
690 scoped_ptr<extensions::SharedModuleService> shared_module_service_;
692 ObserverList<extensions::UpdateObserver, true> update_observers_;
694 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
695 InstallAppsWithUnlimtedStorage);
696 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
697 InstallAppsAndCheckStorageProtection);
698 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest, SetUnsetBlacklistInPrefs);
699 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
700 BlacklistedExtensionWillNotInstall);
701 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
702 UnloadBlacklistedExtensionPolicy);
703 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
704 WillNotLoadBlacklistedExtensionsFromDirectory);
705 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
706 BlacklistedInPrefsFromStartup);
707 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
708 GreylistedExtensionDisabled);
709 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
710 GreylistDontEnableManuallyDisabled);
711 FRIEND_TEST_ALL_PREFIXES(ExtensionServiceTest,
712 GreylistUnknownDontChange);
713 DISALLOW_COPY_AND_ASSIGN(ExtensionService);
716 #endif // CHROME_BROWSER_EXTENSIONS_EXTENSION_SERVICE_H_