Temporarily re-enabling SizeAfterPrefChange test with traces (this time for Linux...
[chromium-blink-merge.git] / chrome / browser / extensions / shared_module_service.h
blobc185afaac69f8e4686ee5c873210f5cbf58fc96c
1 // Copyright 2014 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_SHARED_MODULE_SERVICE_H_
6 #define CHROME_BROWSER_EXTENSIONS_SHARED_MODULE_SERVICE_H_
8 #include <list>
10 #include "chrome/browser/extensions/install_observer.h"
11 #include "extensions/common/manifest_handlers/shared_module_info.h"
13 namespace content {
14 class BrowserContext;
17 namespace extensions {
19 class Extension;
20 class ExtensionSet;
22 class SharedModuleService : public InstallObserver {
23 public:
24 enum ImportStatus {
25 // No imports needed.
26 IMPORT_STATUS_OK,
28 // Imports are needed, but can be satisfied (i.e., there are missing or
29 // outdated imports for a webstore extension).
30 IMPORT_STATUS_UNSATISFIED,
32 // Imports are needed, and can't be satisfied (i.e., missing or outdated
33 // imports for an extension not in the webstore).
34 IMPORT_STATUS_UNRECOVERABLE
37 explicit SharedModuleService(content::BrowserContext* context);
38 virtual ~SharedModuleService();
40 // Checks an extension's imports. Imports that are not installed are stored
41 // in |missing_modules|, and imports that are out of date are stored in
42 // |outdated_modules|.
43 ImportStatus CheckImports(
44 const extensions::Extension* extension,
45 std::list<SharedModuleInfo::ImportInfo>* missing_modules,
46 std::list<SharedModuleInfo::ImportInfo>* outdated_modules);
48 // Checks an extension's shared module imports to see if they are satisfied.
49 // If they are not, this function adds the dependencies to the pending install
50 // list if |extension| came from the webstore.
51 ImportStatus SatisfyImports(const extensions::Extension* extension);
53 private:
54 // Returns a set of extensions that import a given extension.
55 scoped_ptr<const ExtensionSet> GetDependentExtensions(
56 const Extension* extension);
58 // Uninstalls shared modules that were only referenced by |extension|.
59 void PruneSharedModulesOnUninstall(const Extension* extension);
61 // InstallObserver implementation:
62 virtual void OnExtensionUninstalled(const Extension* extension) OVERRIDE;
63 virtual void OnShutdown() OVERRIDE;
65 // The context associated with this SharedModuleService.
66 content::BrowserContext* context_;
68 // Whether or not we are actively observing installs.
69 bool observing_;
71 DISALLOW_COPY_AND_ASSIGN(SharedModuleService);
74 } // namespace extensions
76 #endif // CHROME_BROWSER_EXTENSIONS_SHARED_MODULE_SERVICE_H_