Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "extensions/renderer/renderer_extension_registry.h" | |
| 6 | |
| 7 #include "base/callback.h" | |
|
not at google - send to devlin
2015/08/17 20:43:05
(delete this)
annekao
2015/08/17 23:51:10
Done.
| |
| 8 #include "base/logging.h" | |
| 9 #include "base/stl_util.h" | |
| 10 #include "extensions/common/constants.h" | |
| 11 #include "extensions/common/extension.h" | |
| 12 #include "extensions/common/manifest_handlers/sandboxed_page_info.h" | |
| 13 | |
| 14 namespace extensions { | |
| 15 | |
| 16 static base::LazyInstance<RendererExtensionRegistry> | |
| 17 g_renderer_extension_registry = LAZY_INSTANCE_INITIALIZER; | |
|
not at google - send to devlin
2015/08/17 20:43:05
Put this in an anonymous namespace, not static.
annekao
2015/08/17 23:51:10
Done.
| |
| 18 | |
| 19 RendererExtensionRegistry::RendererExtensionRegistry() {} | |
| 20 | |
| 21 RendererExtensionRegistry::~RendererExtensionRegistry() {} | |
| 22 | |
| 23 // static | |
| 24 RendererExtensionRegistry* RendererExtensionRegistry::GetRegistry() { | |
| 25 return g_renderer_extension_registry.Pointer(); | |
| 26 } | |
| 27 | |
| 28 ExtensionSet* RendererExtensionRegistry::GetMainThreadExtensionSet() { | |
| 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::InsertAll(const ExtensionSet& extensions) { | |
| 56 base::AutoLock lock(lock_); | |
| 57 return extensions_.InsertAll(extensions); | |
| 58 } | |
| 59 | |
| 60 bool RendererExtensionRegistry::Remove(const std::string& id) { | |
| 61 base::AutoLock lock(lock_); | |
| 62 return extensions_.Remove(id); | |
| 63 } | |
| 64 | |
| 65 void RendererExtensionRegistry::Clear() { | |
| 66 base::AutoLock lock(lock_); | |
| 67 extensions_.Clear(); | |
| 68 } | |
| 69 | |
| 70 std::string RendererExtensionRegistry::GetExtensionOrAppIDByURL( | |
| 71 const GURL& url) const { | |
| 72 base::AutoLock lock(lock_); | |
| 73 return extensions_.GetExtensionOrAppIDByURL(url); | |
| 74 } | |
| 75 | |
| 76 const Extension* RendererExtensionRegistry::GetExtensionOrAppByURL( | |
| 77 const GURL& url) const { | |
| 78 base::AutoLock lock(lock_); | |
| 79 return extensions_.GetExtensionOrAppByURL(url); | |
| 80 } | |
| 81 | |
| 82 const Extension* RendererExtensionRegistry::GetAppByURL(const GURL& url) const { | |
| 83 base::AutoLock lock(lock_); | |
| 84 return extensions_.GetAppByURL(url); | |
| 85 } | |
| 86 | |
| 87 const Extension* RendererExtensionRegistry::GetHostedAppByURL( | |
| 88 const GURL& url) const { | |
| 89 base::AutoLock lock(lock_); | |
| 90 return extensions_.GetHostedAppByURL(url); | |
| 91 } | |
| 92 | |
| 93 const Extension* RendererExtensionRegistry::GetHostedAppByOverlappingWebExtent( | |
| 94 const URLPatternSet& extent) const { | |
| 95 base::AutoLock lock(lock_); | |
| 96 return extensions_.GetHostedAppByOverlappingWebExtent(extent); | |
| 97 } | |
| 98 | |
| 99 bool RendererExtensionRegistry::InSameExtent(const GURL& old_url, | |
| 100 const GURL& new_url) const { | |
| 101 base::AutoLock lock(lock_); | |
| 102 return extensions_.InSameExtent(old_url, new_url); | |
| 103 } | |
| 104 | |
| 105 const Extension* RendererExtensionRegistry::GetByID( | |
| 106 const std::string& id) const { | |
| 107 base::AutoLock lock(lock_); | |
| 108 return extensions_.GetByID(id); | |
| 109 } | |
| 110 | |
| 111 ExtensionIdSet RendererExtensionRegistry::GetIDs() const { | |
| 112 base::AutoLock lock(lock_); | |
| 113 return extensions_.GetIDs(); | |
| 114 } | |
| 115 | |
| 116 bool RendererExtensionRegistry::ExtensionBindingsAllowed( | |
| 117 const GURL& url) const { | |
| 118 base::AutoLock lock(lock_); | |
| 119 return extensions_.ExtensionBindingsAllowed(url); | |
| 120 } | |
| 121 | |
| 122 } // namespace extensions | |
| OLD | NEW |