OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_EXTENSIONS_SHARED_MODULE_SERVICE_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_SHARED_MODULE_SERVICE_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_SHARED_MODULE_SERVICE_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_SHARED_MODULE_SERVICE_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 | 9 |
10 #include "base/scoped_observer.h" | 10 #include "base/scoped_observer.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 // Imports are needed, but can be satisfied (i.e., there are missing or | 29 // Imports are needed, but can be satisfied (i.e., there are missing or |
30 // outdated imports for a webstore extension). | 30 // outdated imports for a webstore extension). |
31 IMPORT_STATUS_UNSATISFIED, | 31 IMPORT_STATUS_UNSATISFIED, |
32 | 32 |
33 // Imports are needed, and can't be satisfied (i.e., missing or outdated | 33 // Imports are needed, and can't be satisfied (i.e., missing or outdated |
34 // imports for an extension not in the webstore). | 34 // imports for an extension not in the webstore). |
35 IMPORT_STATUS_UNRECOVERABLE | 35 IMPORT_STATUS_UNRECOVERABLE |
36 }; | 36 }; |
37 | 37 |
38 explicit SharedModuleService(content::BrowserContext* context); | 38 explicit SharedModuleService(content::BrowserContext* context); |
39 virtual ~SharedModuleService(); | 39 ~SharedModuleService() override; |
40 | 40 |
41 // Checks an extension's imports. Imports that are not installed are stored | 41 // Checks an extension's imports. Imports that are not installed are stored |
42 // in |missing_modules|, and imports that are out of date are stored in | 42 // in |missing_modules|, and imports that are out of date are stored in |
43 // |outdated_modules|. | 43 // |outdated_modules|. |
44 ImportStatus CheckImports( | 44 ImportStatus CheckImports( |
45 const Extension* extension, | 45 const Extension* extension, |
46 std::list<SharedModuleInfo::ImportInfo>* missing_modules, | 46 std::list<SharedModuleInfo::ImportInfo>* missing_modules, |
47 std::list<SharedModuleInfo::ImportInfo>* outdated_modules); | 47 std::list<SharedModuleInfo::ImportInfo>* outdated_modules); |
48 | 48 |
49 // Checks an extension's shared module imports to see if they are satisfied. | 49 // Checks an extension's shared module imports to see if they are satisfied. |
50 // If they are not, this function adds the dependencies to the pending install | 50 // If they are not, this function adds the dependencies to the pending install |
51 // list if |extension| came from the webstore. | 51 // list if |extension| came from the webstore. |
52 ImportStatus SatisfyImports(const Extension* extension); | 52 ImportStatus SatisfyImports(const Extension* extension); |
53 | 53 |
54 // Returns a set of extensions that import a given extension. | 54 // Returns a set of extensions that import a given extension. |
55 scoped_ptr<ExtensionSet> GetDependentExtensions(const Extension* extension); | 55 scoped_ptr<ExtensionSet> GetDependentExtensions(const Extension* extension); |
56 | 56 |
57 private: | 57 private: |
58 // Uninstall shared modules which are not used by other extensions. | 58 // Uninstall shared modules which are not used by other extensions. |
59 void PruneSharedModules(); | 59 void PruneSharedModules(); |
60 | 60 |
61 // ExtensionRegistryObserver implementation. | 61 // ExtensionRegistryObserver implementation. |
62 virtual void OnExtensionInstalled(content::BrowserContext* browser_context, | 62 void OnExtensionInstalled(content::BrowserContext* browser_context, |
63 const Extension* extension, | 63 const Extension* extension, |
64 bool is_update) override; | 64 bool is_update) override; |
65 virtual void OnExtensionUninstalled( | 65 void OnExtensionUninstalled(content::BrowserContext* browser_context, |
66 content::BrowserContext* browser_context, | 66 const Extension* extension, |
67 const Extension* extension, | 67 extensions::UninstallReason reason) override; |
68 extensions::UninstallReason reason) override; | |
69 | 68 |
70 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> | 69 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver> |
71 extension_registry_observer_; | 70 extension_registry_observer_; |
72 | 71 |
73 // The context associated with this SharedModuleService. | 72 // The context associated with this SharedModuleService. |
74 content::BrowserContext* browser_context_; | 73 content::BrowserContext* browser_context_; |
75 | 74 |
76 DISALLOW_COPY_AND_ASSIGN(SharedModuleService); | 75 DISALLOW_COPY_AND_ASSIGN(SharedModuleService); |
77 }; | 76 }; |
78 | 77 |
79 } // namespace extensions | 78 } // namespace extensions |
80 | 79 |
81 #endif // CHROME_BROWSER_EXTENSIONS_SHARED_MODULE_SERVICE_H_ | 80 #endif // CHROME_BROWSER_EXTENSIONS_SHARED_MODULE_SERVICE_H_ |
OLD | NEW |