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 |
41 enum PluginType { | 67 enum PluginType { |
42 PLUGIN_TYPE_NPAPI, | 68 PLUGIN_TYPE_NPAPI, |
43 PLUGIN_TYPE_PEPPER_IN_PROCESS, | 69 PLUGIN_TYPE_PEPPER_IN_PROCESS, |
44 PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS | 70 PLUGIN_TYPE_PEPPER_OUT_OF_PROCESS |
45 }; | 71 }; |
46 | 72 |
47 WebPluginInfo(); | 73 WebPluginInfo(); |
48 WebPluginInfo(const WebPluginInfo& rhs); | 74 WebPluginInfo(const WebPluginInfo& rhs); |
49 ~WebPluginInfo(); | 75 ~WebPluginInfo(); |
50 WebPluginInfo& operator=(const WebPluginInfo& rhs); | 76 WebPluginInfo& operator=(const WebPluginInfo& rhs); |
(...skipping 12 matching lines...) Expand all Loading... |
63 | 89 |
64 // The version number of the plugin file (may be OS-specific) | 90 // The version number of the plugin file (may be OS-specific) |
65 string16 version; | 91 string16 version; |
66 | 92 |
67 // A description of the plugin that we get from its version info. | 93 // A description of the plugin that we get from its version info. |
68 string16 desc; | 94 string16 desc; |
69 | 95 |
70 // A list of all the mime types that this plugin supports. | 96 // A list of all the mime types that this plugin supports. |
71 std::vector<WebPluginMimeType> mime_types; | 97 std::vector<WebPluginMimeType> mime_types; |
72 | 98 |
| 99 // Enabled state of the plugin. See the EnabledStates enum. |
| 100 int enabled; |
| 101 |
73 // Plugin type. See the PluginType enum. | 102 // Plugin type. See the PluginType enum. |
74 int type; | 103 int type; |
75 }; | 104 }; |
76 | 105 |
| 106 // Checks whether a plugin is enabled either by the user or by policy. |
| 107 bool IsPluginEnabled(const WebPluginInfo& plugin); |
| 108 |
77 // Checks whether a plugin is a Pepper plugin, enabled or disabled. | 109 // Checks whether a plugin is a Pepper plugin, enabled or disabled. |
78 bool IsPepperPlugin(const WebPluginInfo& plugin); | 110 bool IsPepperPlugin(const WebPluginInfo& plugin); |
79 | 111 |
80 } // namespace webkit | 112 } // namespace webkit |
81 | 113 |
82 #endif // WEBKIT_PLUGINS_WEBPLUGININFO_H_ | 114 #endif // WEBKIT_PLUGINS_WEBPLUGININFO_H_ |
OLD | NEW |