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 #include "extensions/browser/extension_registry.h" | 5 #include "extensions/browser/extension_registry.h" |
6 | 6 |
7 #include "base/strings/string_util.h" | 7 #include "base/strings/string_util.h" |
8 #include "base/version.h" | |
Devlin
2017/05/19 02:04:00
(see header comment)
lazyboy
2017/05/19 18:24:55
Removed.
| |
8 #include "extensions/browser/extension_registry_factory.h" | 9 #include "extensions/browser/extension_registry_factory.h" |
9 #include "extensions/browser/extension_registry_observer.h" | 10 #include "extensions/browser/extension_registry_observer.h" |
10 | 11 |
11 namespace extensions { | 12 namespace extensions { |
12 | 13 |
13 ExtensionRegistry::ExtensionRegistry(content::BrowserContext* browser_context) | 14 ExtensionRegistry::ExtensionRegistry(content::BrowserContext* browser_context) |
14 : browser_context_(browser_context) {} | 15 : browser_context_(browser_context) {} |
15 ExtensionRegistry::~ExtensionRegistry() {} | 16 ExtensionRegistry::~ExtensionRegistry() {} |
16 | 17 |
17 // static | 18 // static |
(...skipping 15 matching lines...) Expand all Loading... | |
33 installed_extensions->InsertAll(disabled_extensions_); | 34 installed_extensions->InsertAll(disabled_extensions_); |
34 if (include_mask & IncludeFlag::TERMINATED) | 35 if (include_mask & IncludeFlag::TERMINATED) |
35 installed_extensions->InsertAll(terminated_extensions_); | 36 installed_extensions->InsertAll(terminated_extensions_); |
36 if (include_mask & IncludeFlag::BLACKLISTED) | 37 if (include_mask & IncludeFlag::BLACKLISTED) |
37 installed_extensions->InsertAll(blacklisted_extensions_); | 38 installed_extensions->InsertAll(blacklisted_extensions_); |
38 if (include_mask & IncludeFlag::BLOCKED) | 39 if (include_mask & IncludeFlag::BLOCKED) |
39 installed_extensions->InsertAll(blocked_extensions_); | 40 installed_extensions->InsertAll(blocked_extensions_); |
40 return installed_extensions; | 41 return installed_extensions; |
41 } | 42 } |
42 | 43 |
44 base::Version ExtensionRegistry::GetVersion(const Extension* extension) const { | |
45 // TODO(lazyboy): Why not TERMINATED? | |
46 int include_mask = ExtensionRegistry::ENABLED | ExtensionRegistry::DISABLED | | |
47 ExtensionRegistry::BLACKLISTED | | |
48 ExtensionRegistry::BLOCKED; | |
49 const Extension* current = GetExtensionById(extension->id(), include_mask); | |
50 return current ? *current->version() : base::Version(); | |
Devlin
2017/05/19 02:04:00
maybe s/current/extension? |current| to me still
lazyboy
2017/05/19 18:24:55
named registry_extension cause it collides with pa
| |
51 } | |
52 | |
43 void ExtensionRegistry::AddObserver(ExtensionRegistryObserver* observer) { | 53 void ExtensionRegistry::AddObserver(ExtensionRegistryObserver* observer) { |
44 observers_.AddObserver(observer); | 54 observers_.AddObserver(observer); |
45 } | 55 } |
46 | 56 |
47 void ExtensionRegistry::RemoveObserver(ExtensionRegistryObserver* observer) { | 57 void ExtensionRegistry::RemoveObserver(ExtensionRegistryObserver* observer) { |
48 observers_.RemoveObserver(observer); | 58 observers_.RemoveObserver(observer); |
49 } | 59 } |
50 | 60 |
51 void ExtensionRegistry::TriggerOnLoaded(const Extension* extension) { | 61 void ExtensionRegistry::TriggerOnLoaded(const Extension* extension) { |
52 CHECK(extension); | 62 CHECK(extension); |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
202 } | 212 } |
203 | 213 |
204 void ExtensionRegistry::Shutdown() { | 214 void ExtensionRegistry::Shutdown() { |
205 // Release references to all Extension objects in the sets. | 215 // Release references to all Extension objects in the sets. |
206 ClearAll(); | 216 ClearAll(); |
207 for (auto& observer : observers_) | 217 for (auto& observer : observers_) |
208 observer.OnShutdown(this); | 218 observer.OnShutdown(this); |
209 } | 219 } |
210 | 220 |
211 } // namespace extensions | 221 } // namespace extensions |
OLD | NEW |