OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_NPAPI_WEBPLUGININFO_H_ | 5 #ifndef WEBKIT_PLUGINS_NPAPI_WEBPLUGININFO_H_ |
6 #define WEBKIT_PLUGINS_NPAPI_WEBPLUGININFO_H_ | 6 #define WEBKIT_PLUGINS_NPAPI_WEBPLUGININFO_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 13 matching lines...) Expand all Loading... |
24 | 24 |
25 // A list of all the file extensions for this mime type. | 25 // A list of all the file extensions for this mime type. |
26 std::vector<std::string> file_extensions; | 26 std::vector<std::string> file_extensions; |
27 | 27 |
28 // Description of the mime type. | 28 // Description of the mime type. |
29 string16 description; | 29 string16 description; |
30 }; | 30 }; |
31 | 31 |
32 // Describes an available NPAPI plugin. | 32 // Describes an available NPAPI plugin. |
33 struct WebPluginInfo { | 33 struct WebPluginInfo { |
| 34 // Defines the possible enabled state a plugin can have. |
| 35 // The enum values actually represent a 3-bit bitfield : |
| 36 // |PE|PD|U| - where |PE|PD| is policy state and U is user state. |
| 37 // PE == 1 means the plugin is forced to enabled state by policy |
| 38 // PD == 1 means the plugin is forced to disabled by policy |
| 39 // PE and PD CAN'T be both 1 but can be both 0 which mean no policy is set. |
| 40 // U == 1 means the user has disabled the plugin. |
| 41 // Because the plugin user state might have been changed before a policy was |
| 42 // introduced the user state might contradict the policy state in which case |
| 43 // the policy has precedence. |
| 44 enum EnabledStates { |
| 45 USER_ENABLED = 0, |
| 46 USER_DISABLED = 1 << 0, |
| 47 POLICY_DISABLED = 1 << 1, |
| 48 POLICY_ENABLED = 1 << 2, |
| 49 USER_ENABLED_POLICY_UNMANAGED = USER_ENABLED, |
| 50 USER_ENABLED_POLICY_DISABLED = USER_ENABLED| POLICY_DISABLED, |
| 51 USER_ENABLED_POLICY_ENABLED = USER_ENABLED | POLICY_ENABLED, |
| 52 USER_DISABLED_POLICY_UNMANAGED = USER_DISABLED, |
| 53 USER_DISABLED_POLICY_DISABLED = USER_DISABLED | POLICY_DISABLED, |
| 54 USER_DISABLED_POLICY_ENABLED = USER_DISABLED | POLICY_ENABLED, |
| 55 USER_MASK = USER_DISABLED, |
| 56 MANAGED_MASK = POLICY_DISABLED | POLICY_ENABLED, |
| 57 POLICY_UNMANAGED = -1 |
| 58 }; |
| 59 |
34 WebPluginInfo(); | 60 WebPluginInfo(); |
35 WebPluginInfo(const WebPluginInfo& rhs); | 61 WebPluginInfo(const WebPluginInfo& rhs); |
36 ~WebPluginInfo(); | 62 ~WebPluginInfo(); |
37 WebPluginInfo& operator=(const WebPluginInfo& rhs); | 63 WebPluginInfo& operator=(const WebPluginInfo& rhs); |
38 | 64 |
39 // Special constructor only used during unit testing: | 65 // Special constructor only used during unit testing: |
40 WebPluginInfo(const string16& fake_name, | 66 WebPluginInfo(const string16& fake_name, |
41 const FilePath& fake_path, | 67 const FilePath& fake_path, |
42 const string16& fake_version, | 68 const string16& fake_version, |
43 const string16& fake_desc); | 69 const string16& fake_desc); |
44 | 70 |
45 // The name of the plugin (i.e. Flash). | 71 // The name of the plugin (i.e. Flash). |
46 string16 name; | 72 string16 name; |
47 | 73 |
48 // The path to the plugin file (DLL/bundle/library). | 74 // The path to the plugin file (DLL/bundle/library). |
49 FilePath path; | 75 FilePath path; |
50 | 76 |
51 // The version number of the plugin file (may be OS-specific) | 77 // The version number of the plugin file (may be OS-specific) |
52 string16 version; | 78 string16 version; |
53 | 79 |
54 // A description of the plugin that we get from its version info. | 80 // A description of the plugin that we get from its version info. |
55 string16 desc; | 81 string16 desc; |
56 | 82 |
57 // A list of all the mime types that this plugin supports. | 83 // A list of all the mime types that this plugin supports. |
58 std::vector<WebPluginMimeType> mime_types; | 84 std::vector<WebPluginMimeType> mime_types; |
59 | 85 |
60 // Whether the plugin is enabled. | 86 // Enabled state of the plugin. See the EnabledStates enum. |
61 bool enabled; | 87 int enabled; |
62 }; | 88 }; |
63 | 89 |
| 90 // Checks wheter a plugin is enabled either by the user or by policy. |
| 91 bool IsPluginEnabled(const WebPluginInfo& plugin); |
| 92 |
64 } // namespace npapi | 93 } // namespace npapi |
65 } // namespace webkit | 94 } // namespace webkit |
66 | 95 |
67 #endif // WEBKIT_PLUGINS_NPAPI_WEBPLUGININFO_H_ | 96 #endif // WEBKIT_PLUGINS_NPAPI_WEBPLUGININFO_H_ |
OLD | NEW |