OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 WEBKIT_PLUGINS_WEBPLUGININFO_H_ | 5 #ifndef WEBKIT_PLUGINS_WEBPLUGININFO_H_ |
6 #define WEBKIT_PLUGINS_WEBPLUGININFO_H_ | 6 #define WEBKIT_PLUGINS_WEBPLUGININFO_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 20 matching lines...) Expand all Loading... |
31 // Description of the mime type. | 31 // Description of the mime type. |
32 string16 description; | 32 string16 description; |
33 | 33 |
34 // Extra parameters to include when instantiating the plugin. | 34 // Extra parameters to include when instantiating the plugin. |
35 std::vector<string16> additional_param_names; | 35 std::vector<string16> additional_param_names; |
36 std::vector<string16> additional_param_values; | 36 std::vector<string16> additional_param_values; |
37 }; | 37 }; |
38 | 38 |
39 // Describes an available NPAPI or Pepper plugin. | 39 // Describes an available NPAPI or Pepper plugin. |
40 struct WebPluginInfo { | 40 struct WebPluginInfo { |
41 // Defines the possible enabled state a plugin can have. | |
42 // The enum values actually represent a 3-bit bitfield : | |
43 // |PE|PD|U| - where |PE|PD| is policy state and U is user state. | |
44 // PE == 1 means the plugin is forced to enabled state by policy | |
45 // PD == 1 means the plugin is forced to disabled by policy | |
46 // PE and PD CAN'T be both 1 but can be both 0 which mean no policy is set. | |
47 // U == 1 means the user has disabled the plugin. | |
48 // Because the plugin user state might have been changed before a policy was | |
49 // introduced the user state might contradict the policy state in which case | |
50 // the policy has precedence. | |
51 enum EnabledStates { | |
52 USER_ENABLED = 0, | |
53 USER_DISABLED = 1 << 0, | |
54 POLICY_DISABLED = 1 << 1, | |
55 POLICY_ENABLED = 1 << 2, | |
56 USER_ENABLED_POLICY_UNMANAGED = USER_ENABLED, | |
57 USER_ENABLED_POLICY_DISABLED = USER_ENABLED| POLICY_DISABLED, | |
58 USER_ENABLED_POLICY_ENABLED = USER_ENABLED | POLICY_ENABLED, | |
59 USER_DISABLED_POLICY_UNMANAGED = USER_DISABLED, | |
60 USER_DISABLED_POLICY_DISABLED = USER_DISABLED | POLICY_DISABLED, | |
61 USER_DISABLED_POLICY_ENABLED = USER_DISABLED | POLICY_ENABLED, | |
62 USER_MASK = USER_DISABLED, | |
63 MANAGED_MASK = POLICY_DISABLED | POLICY_ENABLED, | |
64 POLICY_UNMANAGED = -1 | |
65 }; | |
66 | |
67 enum PluginType { | 41 enum PluginType { |
68 PLUGIN_TYPE_NPAPI, | 42 PLUGIN_TYPE_NPAPI, |
69 PLUGIN_TYPE_PEPPER_IN_PROCESS, | 43 PLUGIN_TYPE_PEPPER_IN_PROCESS, |
70 PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS | 44 PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS |
71 }; | 45 }; |
72 | 46 |
73 WebPluginInfo(); | 47 WebPluginInfo(); |
74 WebPluginInfo(const WebPluginInfo& rhs); | 48 WebPluginInfo(const WebPluginInfo& rhs); |
75 ~WebPluginInfo(); | 49 ~WebPluginInfo(); |
76 WebPluginInfo& operator=(const WebPluginInfo& rhs); | 50 WebPluginInfo& operator=(const WebPluginInfo& rhs); |
(...skipping 12 matching lines...) Expand all Loading... |
89 | 63 |
90 // The version number of the plugin file (may be OS-specific) | 64 // The version number of the plugin file (may be OS-specific) |
91 string16 version; | 65 string16 version; |
92 | 66 |
93 // A description of the plugin that we get from its version info. | 67 // A description of the plugin that we get from its version info. |
94 string16 desc; | 68 string16 desc; |
95 | 69 |
96 // A list of all the mime types that this plugin supports. | 70 // A list of all the mime types that this plugin supports. |
97 std::vector<WebPluginMimeType> mime_types; | 71 std::vector<WebPluginMimeType> mime_types; |
98 | 72 |
99 // Enabled state of the plugin. See the EnabledStates enum. | |
100 int enabled; | |
101 | |
102 // Plugin type. See the PluginType enum. | 73 // Plugin type. See the PluginType enum. |
103 int type; | 74 int type; |
104 }; | 75 }; |
105 | 76 |
106 // Checks whether a plugin is enabled either by the user or by policy. | |
107 bool IsPluginEnabled(const WebPluginInfo& plugin); | |
108 | |
109 // Checks whether a plugin is a Pepper plugin, enabled or disabled. | 77 // Checks whether a plugin is a Pepper plugin, enabled or disabled. |
110 bool IsPepperPlugin(const WebPluginInfo& plugin); | 78 bool IsPepperPlugin(const WebPluginInfo& plugin); |
111 | 79 |
112 } // namespace webkit | 80 } // namespace webkit |
113 | 81 |
114 #endif // WEBKIT_PLUGINS_WEBPLUGININFO_H_ | 82 #endif // WEBKIT_PLUGINS_WEBPLUGININFO_H_ |
OLD | NEW |