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 "base/version.h" |
14 #include "components/keyed_service/core/keyed_service.h" | 15 #include "components/keyed_service/core/keyed_service.h" |
15 #include "extensions/browser/uninstall_reason.h" | 16 #include "extensions/browser/uninstall_reason.h" |
16 #include "extensions/common/extension_set.h" | 17 #include "extensions/common/extension_set.h" |
17 #include "extensions/features/features.h" | 18 #include "extensions/features/features.h" |
18 | 19 |
19 #if !BUILDFLAG(ENABLE_EXTENSIONS) | 20 #if !BUILDFLAG(ENABLE_EXTENSIONS) |
20 #error "Extensions must be enabled" | 21 #error "Extensions must be enabled" |
21 #endif | 22 #endif |
22 | 23 |
23 namespace content { | 24 namespace content { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 76 |
76 // Returns a set of all extensions in the subsets specified by |include_mask|. | 77 // Returns a set of all extensions in the subsets specified by |include_mask|. |
77 // * enabled_extensions() --> ExtensionRegistry::ENABLED | 78 // * enabled_extensions() --> ExtensionRegistry::ENABLED |
78 // * disabled_extensions() --> ExtensionRegistry::DISABLED | 79 // * disabled_extensions() --> ExtensionRegistry::DISABLED |
79 // * terminated_extensions() --> ExtensionRegistry::TERMINATED | 80 // * terminated_extensions() --> ExtensionRegistry::TERMINATED |
80 // * blacklisted_extensions() --> ExtensionRegistry::BLACKLISTED | 81 // * blacklisted_extensions() --> ExtensionRegistry::BLACKLISTED |
81 // * blocked_extensions() --> ExtensionRegistry::BLOCKED | 82 // * blocked_extensions() --> ExtensionRegistry::BLOCKED |
82 std::unique_ptr<ExtensionSet> GenerateInstalledExtensionsSet( | 83 std::unique_ptr<ExtensionSet> GenerateInstalledExtensionsSet( |
83 int include_mask) const; | 84 int include_mask) const; |
84 | 85 |
| 86 // Returns the current version of the extension with the given |id|, if |
| 87 // one exists. |
| 88 // Note: If we are currently updating the extension, this returns the |
| 89 // version stored currently, rather than the in-progress update. |
| 90 // |
| 91 // TODO(lazyboy): Consider updating callers to directly retrieve version() |
| 92 // from either GetExtensionById() or querying ExtensionSet getters of this |
| 93 // class. |
| 94 base::Version GetStoredVersion(const ExtensionId& id) const; |
| 95 |
85 // The usual observer interface. | 96 // The usual observer interface. |
86 void AddObserver(ExtensionRegistryObserver* observer); | 97 void AddObserver(ExtensionRegistryObserver* observer); |
87 void RemoveObserver(ExtensionRegistryObserver* observer); | 98 void RemoveObserver(ExtensionRegistryObserver* observer); |
88 | 99 |
89 // Invokes the observer method OnExtensionLoaded(). The extension must be | 100 // Invokes the observer method OnExtensionLoaded(). The extension must be |
90 // enabled at the time of the call. | 101 // enabled at the time of the call. |
91 void TriggerOnLoaded(const Extension* extension); | 102 void TriggerOnLoaded(const Extension* extension); |
92 | 103 |
93 // Invokes the observer method OnExtensionReady(). This always follows | 104 // Invokes the observer method OnExtensionReady(). This always follows |
94 // an OnLoaded event, but is not called until it's safe to create the | 105 // 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_; | 207 base::ObserverList<ExtensionRegistryObserver> observers_; |
197 | 208 |
198 content::BrowserContext* const browser_context_; | 209 content::BrowserContext* const browser_context_; |
199 | 210 |
200 DISALLOW_COPY_AND_ASSIGN(ExtensionRegistry); | 211 DISALLOW_COPY_AND_ASSIGN(ExtensionRegistry); |
201 }; | 212 }; |
202 | 213 |
203 } // namespace extensions | 214 } // namespace extensions |
204 | 215 |
205 #endif // EXTENSIONS_BROWSER_EXTENSION_REGISTRY_H_ | 216 #endif // EXTENSIONS_BROWSER_EXTENSION_REGISTRY_H_ |
OLD | NEW |