Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "extensions/renderer/renderer_extension_registry.h" | |
| 6 | |
| 7 #include "base/lazy_instance.h" | |
| 8 #include "base/logging.h" | |
| 9 | |
| 10 namespace extensions { | |
| 11 | |
| 12 namespace { | |
| 13 | |
| 14 base::LazyInstance<RendererExtensionRegistry> g_renderer_extension_registry = | |
| 15 LAZY_INSTANCE_INITIALIZER; | |
| 16 } | |
|
not at google - send to devlin
2015/08/18 18:42:50
Standard style is to have a blank line here, and e
annekao
2015/08/18 20:21:12
Done.
| |
| 17 | |
| 18 RendererExtensionRegistry::RendererExtensionRegistry() {} | |
| 19 | |
| 20 RendererExtensionRegistry::~RendererExtensionRegistry() {} | |
| 21 | |
| 22 // static | |
| 23 RendererExtensionRegistry* RendererExtensionRegistry::Get() { | |
| 24 return g_renderer_extension_registry.Pointer(); | |
| 25 } | |
| 26 | |
| 27 const ExtensionSet* RendererExtensionRegistry::GetMainThreadExtensionSet() | |
| 28 const { | |
|
not at google - send to devlin
2015/08/18 18:42:49
DCHECK(content::RenderThread::Get());
In fact, I'
annekao
2015/08/18 20:21:12
Done.
| |
| 29 base::AutoLock lock(lock_); | |
| 30 return &extensions_; | |
| 31 } | |
| 32 | |
| 33 size_t RendererExtensionRegistry::size() const { | |
| 34 base::AutoLock lock(lock_); | |
| 35 return extensions_.size(); | |
| 36 } | |
| 37 | |
| 38 bool RendererExtensionRegistry::is_empty() const { | |
| 39 base::AutoLock lock(lock_); | |
| 40 return extensions_.is_empty(); | |
| 41 } | |
| 42 | |
| 43 bool RendererExtensionRegistry::Contains( | |
| 44 const std::string& extension_id) const { | |
| 45 base::AutoLock lock(lock_); | |
| 46 return extensions_.Contains(extension_id); | |
| 47 } | |
| 48 | |
| 49 bool RendererExtensionRegistry::Insert( | |
| 50 const scoped_refptr<const Extension>& extension) { | |
| 51 base::AutoLock lock(lock_); | |
| 52 return extensions_.Insert(extension); | |
| 53 } | |
| 54 | |
| 55 bool RendererExtensionRegistry::Remove(const std::string& id) { | |
| 56 base::AutoLock lock(lock_); | |
| 57 return extensions_.Remove(id); | |
| 58 } | |
| 59 | |
| 60 std::string RendererExtensionRegistry::GetExtensionOrAppIDByURL( | |
| 61 const GURL& url) const { | |
| 62 base::AutoLock lock(lock_); | |
| 63 return extensions_.GetExtensionOrAppIDByURL(url); | |
| 64 } | |
| 65 | |
| 66 const Extension* RendererExtensionRegistry::GetExtensionOrAppByURL( | |
| 67 const GURL& url) const { | |
| 68 base::AutoLock lock(lock_); | |
| 69 return extensions_.GetExtensionOrAppByURL(url); | |
| 70 } | |
| 71 | |
| 72 const Extension* RendererExtensionRegistry::GetHostedAppByURL( | |
| 73 const GURL& url) const { | |
| 74 base::AutoLock lock(lock_); | |
| 75 return extensions_.GetHostedAppByURL(url); | |
| 76 } | |
| 77 | |
| 78 const Extension* RendererExtensionRegistry::GetByID( | |
| 79 const std::string& id) const { | |
| 80 base::AutoLock lock(lock_); | |
| 81 return extensions_.GetByID(id); | |
| 82 } | |
| 83 | |
| 84 ExtensionIdSet RendererExtensionRegistry::GetIDs() const { | |
| 85 base::AutoLock lock(lock_); | |
| 86 return extensions_.GetIDs(); | |
| 87 } | |
| 88 | |
| 89 bool RendererExtensionRegistry::ExtensionBindingsAllowed( | |
| 90 const GURL& url) const { | |
| 91 base::AutoLock lock(lock_); | |
| 92 return extensions_.ExtensionBindingsAllowed(url); | |
| 93 } | |
| 94 | |
| 95 } // namespace extensions | |
| OLD | NEW |