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> | |
Devlin
2015/08/18 20:26:40
not needed.
annekao
2015/08/18 20:44:02
Done.
| |
9 #include <string> | |
10 | |
11 #include "base/synchronization/lock.h" | |
12 #include "extensions/common/extension.h" | |
Devlin
2015/08/18 20:26:40
not needed.
annekao
2015/08/18 20:44:02
Done.
| |
13 #include "extensions/common/extension_set.h" | |
14 #include "url/gurl.h" | |
Devlin
2015/08/18 20:26:40
Use a forward declaration.
annekao
2015/08/18 20:44:02
Done.
| |
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 // Returns the ExtensionSet that underlies this RenderExtensionRegistry. | |
28 // | |
29 // This is not thread-safe and must only be called on the RenderThread, but | |
30 // even so, it's not thread safe because other threads may decide to | |
31 // modify this. Don't persist a reference to this. | |
32 // | |
33 // TODO(annekao): remove or make thread-safe and callback-based. | |
34 const ExtensionSet* GetMainThreadExtensionSet() const; | |
35 | |
36 size_t size() const; | |
37 bool is_empty() const; | |
38 | |
39 // Forwards to the ExtensionSet methods by the same name. | |
40 bool Contains(const std::string& id) const; | |
41 | |
Devlin
2015/08/18 20:26:40
nit: Take out the newlines here so that it's clear
annekao
2015/08/18 20:44:02
Done.
| |
42 bool Insert(const scoped_refptr<const Extension>& extension); | |
43 | |
44 bool Remove(const std::string& id); | |
45 | |
46 std::string GetExtensionOrAppIDByURL(const GURL& url) const; | |
47 | |
48 const Extension* GetExtensionOrAppByURL(const GURL& url) const; | |
49 | |
50 const Extension* GetHostedAppByURL(const GURL& url) const; | |
51 | |
52 const Extension* GetByID(const std::string& id) const; | |
53 | |
54 ExtensionIdSet GetIDs() const; | |
55 | |
56 bool ExtensionBindingsAllowed(const GURL& url) const; | |
57 | |
58 private: | |
59 ExtensionSet extensions_; | |
60 | |
61 mutable base::Lock lock_; | |
62 | |
63 DISALLOW_COPY_AND_ASSIGN(RendererExtensionRegistry); | |
64 }; | |
65 | |
66 } // namespace extensions | |
67 | |
68 #endif // EXTENSIONS_RENDERER_RENDERER_EXTENSION_REGISTRY_H_ | |
OLD | NEW |