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 #ifndef EXTENSIONS_RENDERER_RENDERER_EXTENSION_REGISTRY_H_ | |
6 #define EXTENSIONS_RENDERER_RENDERER_EXTENSION_REGISTRY_H_ | |
7 | |
8 #include <iterator> | |
9 #include <string> | |
10 | |
11 #include "base/synchronization/lock.h" | |
12 #include "extensions/common/extension.h" | |
13 #include "extensions/common/extension_set.h" | |
14 #include "url/gurl.h" | |
15 | |
16 namespace extensions { | |
17 | |
18 // Thread safe container for all loaded extensions in this process, | |
19 // essentially the renderer counterpart to ExtensionRegistry. | |
20 class RendererExtensionRegistry { | |
21 public: | |
22 RendererExtensionRegistry(); | |
23 ~RendererExtensionRegistry(); | |
24 | |
25 static RendererExtensionRegistry* Get(); | |
26 | |
27 // Should only be used if using the RendererExtensionRegistry is not | |
28 // an option. | |
29 // TODO: Remove. | |
not at google - send to devlin
2015/08/18 18:42:50
I'd reword this:
// Returns the ExtensionSet that
annekao
2015/08/18 20:21:12
Done.
| |
30 const ExtensionSet* GetMainThreadExtensionSet() const; | |
not at google - send to devlin
2015/08/18 18:42:50
All my comments relating to thread safety aside, I
| |
31 | |
32 size_t size() const; | |
33 bool is_empty() const; | |
34 | |
35 // Forwards to the ExtensionSet methods by the same name. | |
36 bool Contains(const std::string& id) const; | |
37 | |
38 bool Insert(const scoped_refptr<const Extension>& extension); | |
39 | |
40 bool Remove(const std::string& id); | |
41 | |
42 std::string GetExtensionOrAppIDByURL(const GURL& url) const; | |
43 | |
44 const Extension* GetExtensionOrAppByURL(const GURL& url) const; | |
45 | |
46 const Extension* GetHostedAppByURL(const GURL& url) const; | |
47 | |
48 const Extension* GetByID(const std::string& id) const; | |
49 | |
50 ExtensionIdSet GetIDs() const; | |
51 | |
52 bool ExtensionBindingsAllowed(const GURL& url) const; | |
53 | |
54 private: | |
55 ExtensionSet extensions_; | |
56 | |
57 mutable base::Lock lock_; | |
58 | |
59 DISALLOW_COPY_AND_ASSIGN(RendererExtensionRegistry); | |
60 }; | |
61 | |
62 } // namespace extensions | |
63 | |
64 #endif // EXTENSIONS_RENDERER_RENDERER_EXTENSION_REGISTRY_H_ | |
OLD | NEW |