Chromium Code Reviews| 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; | |
|
Devlin
2017/05/19 02:04:01
nit: Since we return a non-pointer for base::Versi
lazyboy
2017/05/19 18:24:55
Yes, fixed.
| |
| 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 // | |
| 93 // TODO(lazyboy): Consider updating callers to directly retrieve version() | |
| 94 // from either GetExtensionById() or querying ExtensionSet getters of this | |
| 95 // class. | |
| 96 base::Version GetVersion(const Extension* extension) const; | |
|
Devlin
2017/05/19 02:04:00
Without the context of this patch, it's *very* why
lazyboy
2017/05/19 18:24:55
GetStoredVersion is definitely better than GetVers
| |
| 97 | |
| 85 // The usual observer interface. | 98 // The usual observer interface. |
| 86 void AddObserver(ExtensionRegistryObserver* observer); | 99 void AddObserver(ExtensionRegistryObserver* observer); |
| 87 void RemoveObserver(ExtensionRegistryObserver* observer); | 100 void RemoveObserver(ExtensionRegistryObserver* observer); |
| 88 | 101 |
| 89 // Invokes the observer method OnExtensionLoaded(). The extension must be | 102 // Invokes the observer method OnExtensionLoaded(). The extension must be |
| 90 // enabled at the time of the call. | 103 // enabled at the time of the call. |
| 91 void TriggerOnLoaded(const Extension* extension); | 104 void TriggerOnLoaded(const Extension* extension); |
| 92 | 105 |
| 93 // Invokes the observer method OnExtensionReady(). This always follows | 106 // Invokes the observer method OnExtensionReady(). This always follows |
| 94 // an OnLoaded event, but is not called until it's safe to create the | 107 // 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_; | 209 base::ObserverList<ExtensionRegistryObserver> observers_; |
| 197 | 210 |
| 198 content::BrowserContext* const browser_context_; | 211 content::BrowserContext* const browser_context_; |
| 199 | 212 |
| 200 DISALLOW_COPY_AND_ASSIGN(ExtensionRegistry); | 213 DISALLOW_COPY_AND_ASSIGN(ExtensionRegistry); |
| 201 }; | 214 }; |
| 202 | 215 |
| 203 } // namespace extensions | 216 } // namespace extensions |
| 204 | 217 |
| 205 #endif // EXTENSIONS_BROWSER_EXTENSION_REGISTRY_H_ | 218 #endif // EXTENSIONS_BROWSER_EXTENSION_REGISTRY_H_ |
| OLD | NEW |