Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(79)

Side by Side Diff: chrome/browser/extensions/shared_module_service.h

Issue 323763002: Remove InstallTracker's extension installed, uninstalled observers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix clang error Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "chrome/browser/extensions/install_observer.h" 10 #include "base/scoped_observer.h"
11 #include "extensions/browser/extension_registry_observer.h"
11 #include "extensions/common/manifest_handlers/shared_module_info.h" 12 #include "extensions/common/manifest_handlers/shared_module_info.h"
12 13
13 namespace content { 14 namespace content {
14 class BrowserContext; 15 class BrowserContext;
15 } 16 }
16 17
17 namespace extensions { 18 namespace extensions {
18
19 class Extension; 19 class Extension;
20 class ExtensionSet; 20 class ExtensionSet;
21 class ExtensionRegistry;
21 22
22 class SharedModuleService : public InstallObserver { 23 class SharedModuleService : public ExtensionRegistryObserver {
23 public: 24 public:
24 enum ImportStatus { 25 enum ImportStatus {
25 // No imports needed. 26 // No imports needed.
26 IMPORT_STATUS_OK, 27 IMPORT_STATUS_OK,
27 28
28 // 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
29 // outdated imports for a webstore extension). 30 // outdated imports for a webstore extension).
30 IMPORT_STATUS_UNSATISFIED, 31 IMPORT_STATUS_UNSATISFIED,
31 32
32 // 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
33 // imports for an extension not in the webstore). 34 // imports for an extension not in the webstore).
34 IMPORT_STATUS_UNRECOVERABLE 35 IMPORT_STATUS_UNRECOVERABLE
35 }; 36 };
36 37
37 explicit SharedModuleService(content::BrowserContext* context); 38 explicit SharedModuleService(content::BrowserContext* context);
38 virtual ~SharedModuleService(); 39 virtual ~SharedModuleService();
39 40
40 // 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
41 // 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
42 // |outdated_modules|. 43 // |outdated_modules|.
43 ImportStatus CheckImports( 44 ImportStatus CheckImports(
44 const extensions::Extension* extension, 45 const Extension* extension,
45 std::list<SharedModuleInfo::ImportInfo>* missing_modules, 46 std::list<SharedModuleInfo::ImportInfo>* missing_modules,
46 std::list<SharedModuleInfo::ImportInfo>* outdated_modules); 47 std::list<SharedModuleInfo::ImportInfo>* outdated_modules);
47 48
48 // 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.
49 // 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
50 // list if |extension| came from the webstore. 51 // list if |extension| came from the webstore.
51 ImportStatus SatisfyImports(const extensions::Extension* extension); 52 ImportStatus SatisfyImports(const Extension* extension);
52 53
53 private: 54 private:
54 // Returns a set of extensions that import a given extension. 55 // Returns a set of extensions that import a given extension.
55 scoped_ptr<const ExtensionSet> GetDependentExtensions( 56 scoped_ptr<const ExtensionSet> GetDependentExtensions(
56 const Extension* extension); 57 const Extension* extension);
57 58
58 // Uninstalls shared modules that were only referenced by |extension|. 59 // ExtensionRegistryObserver implementation.
59 void PruneSharedModulesOnUninstall(const Extension* extension); 60 virtual void OnExtensionUninstalled(content::BrowserContext* browser_context,
61 const Extension* extension) OVERRIDE;
60 62
61 // InstallObserver implementation: 63 ScopedObserver<ExtensionRegistry, ExtensionRegistryObserver>
62 virtual void OnExtensionUninstalled(const Extension* extension) OVERRIDE; 64 extension_registry_observer_;
63 virtual void OnShutdown() OVERRIDE;
64 65
65 // The context associated with this SharedModuleService. 66 // The context associated with this SharedModuleService.
66 content::BrowserContext* context_; 67 content::BrowserContext* browser_context_;
67
68 // Whether or not we are actively observing installs.
69 bool observing_;
70 68
71 DISALLOW_COPY_AND_ASSIGN(SharedModuleService); 69 DISALLOW_COPY_AND_ASSIGN(SharedModuleService);
72 }; 70 };
73 71
74 } // namespace extensions 72 } // namespace extensions
75 73
76 #endif // CHROME_BROWSER_EXTENSIONS_SHARED_MODULE_SERVICE_H_ 74 #endif // CHROME_BROWSER_EXTENSIONS_SHARED_MODULE_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/extensions/install_tracker.cc ('k') | chrome/browser/extensions/shared_module_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698