OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CONTENT_COMMON_PEPPER_PLUGIN_REGISTRY_H_ | 5 #ifndef CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_REGISTRY_H_ |
6 #define CONTENT_COMMON_PEPPER_PLUGIN_REGISTRY_H_ | 6 #define CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_REGISTRY_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <map> | 9 #include <map> |
10 | 10 |
| 11 #include "base/memory/ref_counted.h" |
11 #include "content/public/common/pepper_plugin_info.h" | 12 #include "content/public/common/pepper_plugin_info.h" |
12 | 13 |
13 // TODO(jam): refactor | 14 namespace webkit { |
14 #include "content/renderer/pepper/plugin_module.h" | 15 namespace ppapi { |
| 16 class PluginModule; |
| 17 } |
| 18 } |
15 | 19 |
16 namespace content { | 20 namespace content { |
17 | 21 |
18 // Constructs a PepperPluginInfo from a WebPluginInfo. Returns false if | |
19 // the operation is not possible, in particular the WebPluginInfo::type | |
20 // must be one of the pepper types. | |
21 bool MakePepperPluginInfo(const WebPluginInfo& webplugin_info, | |
22 PepperPluginInfo* pepper_info); | |
23 | |
24 // This class holds references to all of the known pepper plugin modules. | 22 // This class holds references to all of the known pepper plugin modules. |
25 // | 23 // |
26 // It keeps two lists. One list of preloaded in-process modules, and one list | 24 // It keeps two lists. One list of preloaded in-process modules, and one list |
27 // is a list of all live modules (some of which may be out-of-process and hence | 25 // is a list of all live modules (some of which may be out-of-process and hence |
28 // not preloaded). | 26 // not preloaded). |
29 class PepperPluginRegistry { | 27 class PepperPluginRegistry { |
30 public: | 28 public: |
31 ~PepperPluginRegistry(); | 29 ~PepperPluginRegistry(); |
32 | 30 |
33 static PepperPluginRegistry* GetInstance(); | 31 static PepperPluginRegistry* GetInstance(); |
34 | 32 |
35 // Computes the list of known pepper plugins. | |
36 // | |
37 // This method is static so that it can be used by the browser process, which | |
38 // has no need to load the pepper plugin modules. It will re-compute the | |
39 // plugin list every time it is called. Generally, code in the registry should | |
40 // be using the cached plugin_list_ instead. | |
41 CONTENT_EXPORT static void ComputeList( | |
42 std::vector<PepperPluginInfo>* plugins); | |
43 | |
44 // Loads the (native) libraries but does not initialize them (i.e., does not | |
45 // call PPP_InitializeModule). This is needed by the zygote on Linux to get | |
46 // access to the plugins before entering the sandbox. | |
47 static void PreloadModules(); | |
48 | |
49 // Retrieves the information associated with the given plugin info. The | 33 // Retrieves the information associated with the given plugin info. The |
50 // return value will be NULL if there is no such plugin. | 34 // return value will be NULL if there is no such plugin. |
51 // | 35 // |
52 // The returned pointer is owned by the PluginRegistry. | 36 // The returned pointer is owned by the PluginRegistry. |
53 const PepperPluginInfo* GetInfoForPlugin(const WebPluginInfo& info); | 37 const PepperPluginInfo* GetInfoForPlugin(const WebPluginInfo& info); |
54 | 38 |
55 // Returns an existing loaded module for the given path. It will search for | 39 // Returns an existing loaded module for the given path. It will search for |
56 // both preloaded in-process or currently active (non crashed) out-of-process | 40 // both preloaded in-process or currently active (non crashed) out-of-process |
57 // plugins matching the given name. Returns NULL if the plugin hasn't been | 41 // plugins matching the given name. Returns NULL if the plugin hasn't been |
58 // loaded. | 42 // loaded. |
(...skipping 29 matching lines...) Expand all Loading... |
88 // appear in this list. | 72 // appear in this list. |
89 typedef std::map<base::FilePath, webkit::ppapi::PluginModule*> | 73 typedef std::map<base::FilePath, webkit::ppapi::PluginModule*> |
90 NonOwningModuleMap; | 74 NonOwningModuleMap; |
91 NonOwningModuleMap live_modules_; | 75 NonOwningModuleMap live_modules_; |
92 | 76 |
93 DISALLOW_COPY_AND_ASSIGN(PepperPluginRegistry); | 77 DISALLOW_COPY_AND_ASSIGN(PepperPluginRegistry); |
94 }; | 78 }; |
95 | 79 |
96 } // namespace content | 80 } // namespace content |
97 | 81 |
98 #endif // CONTENT_COMMON_PEPPER_PLUGIN_REGISTRY_H_ | 82 #endif // CONTENT_RENDERER_PEPPER_PEPPER_PLUGIN_REGISTRY_H_ |
OLD | NEW |