Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(297)

Side by Side Diff: chrome/common/pepper_plugin_registry.h

Issue 3031011: Linux: bit hacky way to ensure Pepper plugins get loaded by zygote. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Rebased ToT. Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/zygote_main_linux.cc ('k') | chrome/common/pepper_plugin_registry.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 CHROME_COMMON_PEPPER_PLUGIN_REGISTRY_H_ 5 #ifndef CHROME_COMMON_PEPPER_PLUGIN_REGISTRY_H_
6 #define CHROME_COMMON_PEPPER_PLUGIN_REGISTRY_H_ 6 #define CHROME_COMMON_PEPPER_PLUGIN_REGISTRY_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 #include <map> 10 #include <map>
11 #include <vector> 11 #include <vector>
12 12
13 #include "webkit/glue/plugins/pepper_plugin_module.h" 13 #include "webkit/glue/plugins/pepper_plugin_module.h"
14 14
15 struct PepperPluginInfo { 15 struct PepperPluginInfo {
16 FilePath path; // Internal plugins are of the form "internal-[name]". 16 PepperPluginInfo(); // Needed to initialize |is_internal|.
17
18 bool is_internal; // Defaults to false (see constructor).
19 FilePath path; // Internal plugins have "internal-[name]" as path.
17 std::vector<std::string> mime_types; 20 std::vector<std::string> mime_types;
18 std::string name; 21 std::string name;
19 std::string description; 22 std::string description;
20 std::string file_extensions; 23 std::string file_extensions;
21 std::string type_descriptions; 24 std::string type_descriptions;
22 }; 25 };
23 26
24 // This class holds references to all of the known pepper plugin modules. 27 // This class holds references to all of the known pepper plugin modules.
25 class PepperPluginRegistry { 28 class PepperPluginRegistry {
26 public: 29 public:
27 static PepperPluginRegistry* GetInstance(); 30 static PepperPluginRegistry* GetInstance();
28 31
29 // Returns the list of known pepper plugins. This method is static so that 32 // Returns the list of known pepper plugins. This method is static so that
30 // it can be used by the browser process, which has no need to load the 33 // it can be used by the browser process, which has no need to load the
31 // pepper plugin modules. 34 // pepper plugin modules.
32 static void GetList(std::vector<PepperPluginInfo>* plugins); 35 static void GetList(std::vector<PepperPluginInfo>* plugins);
33 36
37 // Loads the (native) libraries but does not initialize them (i.e., does not
38 // call PPP_InitializeModule). This is needed by the zygote on Linux to get
39 // access to the plugins before entering the sandbox.
40 static void PreloadModules();
41
34 pepper::PluginModule* GetModule(const FilePath& path) const; 42 pepper::PluginModule* GetModule(const FilePath& path) const;
35 43
36 private: 44 private:
37 static void GetPluginInfoFromSwitch(std::vector<PepperPluginInfo>* plugins); 45 static void GetPluginInfoFromSwitch(std::vector<PepperPluginInfo>* plugins);
38 static void GetExtraPlugins(std::vector<PepperPluginInfo>* plugins); 46 static void GetExtraPlugins(std::vector<PepperPluginInfo>* plugins);
39 47
40 struct InternalPluginInfo : public PepperPluginInfo { 48 struct InternalPluginInfo : public PepperPluginInfo {
49 InternalPluginInfo(); // Sets |is_internal|.
41 pepper::PluginModule::EntryPoints entry_points; 50 pepper::PluginModule::EntryPoints entry_points;
42 }; 51 };
43 typedef std::vector<InternalPluginInfo> InternalPluginInfoList; 52 typedef std::vector<InternalPluginInfo> InternalPluginInfoList;
44 static void GetInternalPluginInfo(InternalPluginInfoList* plugin_info); 53 static void GetInternalPluginInfo(InternalPluginInfoList* plugin_info);
45 54
46 PepperPluginRegistry(); 55 PepperPluginRegistry();
47 56
48 typedef scoped_refptr<pepper::PluginModule> ModuleHandle; 57 typedef scoped_refptr<pepper::PluginModule> ModuleHandle;
49 typedef std::map<FilePath, ModuleHandle> ModuleMap; 58 typedef std::map<FilePath, ModuleHandle> ModuleMap;
50 ModuleMap modules_; 59 ModuleMap modules_;
51 }; 60 };
52 61
53 #endif // CHROME_COMMON_PEPPER_PLUGIN_REGISTRY_H_ 62 #endif // CHROME_COMMON_PEPPER_PLUGIN_REGISTRY_H_
OLDNEW
« no previous file with comments | « chrome/browser/zygote_main_linux.cc ('k') | chrome/common/pepper_plugin_registry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698