OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 EXTENSIONS_BROWSER_EXTENSION_REGISTRY_H_ | 5 #ifndef EXTENSIONS_BROWSER_EXTENSION_REGISTRY_H_ |
6 #define EXTENSIONS_BROWSER_EXTENSION_REGISTRY_H_ | 6 #define EXTENSIONS_BROWSER_EXTENSION_REGISTRY_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
14 #include "components/keyed_service/core/keyed_service.h" | 14 #include "components/keyed_service/core/keyed_service.h" |
15 #include "extensions/browser/uninstall_reason.h" | 15 #include "extensions/browser/uninstall_reason.h" |
16 #include "extensions/common/extension_set.h" | 16 #include "extensions/common/extension_set.h" |
17 #include "extensions/features/features.h" | 17 #include "extensions/features/features.h" |
18 | 18 |
19 #if !BUILDFLAG(ENABLE_EXTENSIONS) | 19 #if !BUILDFLAG(ENABLE_EXTENSIONS) |
20 #error "Extensions must be enabled" | 20 #error "Extensions must be enabled" |
21 #endif | 21 #endif |
22 | 22 |
| 23 namespace base { |
| 24 class Version; |
| 25 } |
| 26 |
23 namespace content { | 27 namespace content { |
24 class BrowserContext; | 28 class BrowserContext; |
25 } | 29 } |
26 | 30 |
27 namespace extensions { | 31 namespace extensions { |
28 class Extension; | 32 class Extension; |
29 class ExtensionRegistryObserver; | 33 class ExtensionRegistryObserver; |
30 | 34 |
31 // ExtensionRegistry holds sets of the installed extensions for a given | 35 // ExtensionRegistry holds sets of the installed extensions for a given |
32 // BrowserContext. An incognito browser context and its master browser context | 36 // BrowserContext. An incognito browser context and its master browser context |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 79 |
76 // Returns a set of all extensions in the subsets specified by |include_mask|. | 80 // Returns a set of all extensions in the subsets specified by |include_mask|. |
77 // * enabled_extensions() --> ExtensionRegistry::ENABLED | 81 // * enabled_extensions() --> ExtensionRegistry::ENABLED |
78 // * disabled_extensions() --> ExtensionRegistry::DISABLED | 82 // * disabled_extensions() --> ExtensionRegistry::DISABLED |
79 // * terminated_extensions() --> ExtensionRegistry::TERMINATED | 83 // * terminated_extensions() --> ExtensionRegistry::TERMINATED |
80 // * blacklisted_extensions() --> ExtensionRegistry::BLACKLISTED | 84 // * blacklisted_extensions() --> ExtensionRegistry::BLACKLISTED |
81 // * blocked_extensions() --> ExtensionRegistry::BLOCKED | 85 // * blocked_extensions() --> ExtensionRegistry::BLOCKED |
82 std::unique_ptr<ExtensionSet> GenerateInstalledExtensionsSet( | 86 std::unique_ptr<ExtensionSet> GenerateInstalledExtensionsSet( |
83 int include_mask) const; | 87 int include_mask) const; |
84 | 88 |
| 89 // Returns the current version of the extension. |
| 90 // Note that if we are in the process of updating the extension, this will |
| 91 // return the version before update. |
| 92 base::Version GetVersion(const Extension* extension) const; |
| 93 |
85 // The usual observer interface. | 94 // The usual observer interface. |
86 void AddObserver(ExtensionRegistryObserver* observer); | 95 void AddObserver(ExtensionRegistryObserver* observer); |
87 void RemoveObserver(ExtensionRegistryObserver* observer); | 96 void RemoveObserver(ExtensionRegistryObserver* observer); |
88 | 97 |
89 // Invokes the observer method OnExtensionLoaded(). The extension must be | 98 // Invokes the observer method OnExtensionLoaded(). The extension must be |
90 // enabled at the time of the call. | 99 // enabled at the time of the call. |
91 void TriggerOnLoaded(const Extension* extension); | 100 void TriggerOnLoaded(const Extension* extension); |
92 | 101 |
93 // Invokes the observer method OnExtensionReady(). This always follows | 102 // Invokes the observer method OnExtensionReady(). This always follows |
94 // an OnLoaded event, but is not called until it's safe to create the | 103 // an OnLoaded event, but is not called until it's safe to create the |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 base::ObserverList<ExtensionRegistryObserver> observers_; | 205 base::ObserverList<ExtensionRegistryObserver> observers_; |
197 | 206 |
198 content::BrowserContext* const browser_context_; | 207 content::BrowserContext* const browser_context_; |
199 | 208 |
200 DISALLOW_COPY_AND_ASSIGN(ExtensionRegistry); | 209 DISALLOW_COPY_AND_ASSIGN(ExtensionRegistry); |
201 }; | 210 }; |
202 | 211 |
203 } // namespace extensions | 212 } // namespace extensions |
204 | 213 |
205 #endif // EXTENSIONS_BROWSER_EXTENSION_REGISTRY_H_ | 214 #endif // EXTENSIONS_BROWSER_EXTENSION_REGISTRY_H_ |
OLD | NEW |