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 enum Reason { USER = 1 << 1, MANAGED = 1 << 2 }; | |
jam
2010/12/21 19:57:42
nit: we usually put each enum in a separate line
| |
35 | |
34 WebPluginInfo(); | 36 WebPluginInfo(); |
35 WebPluginInfo(const WebPluginInfo& rhs); | 37 WebPluginInfo(const WebPluginInfo& rhs); |
36 ~WebPluginInfo(); | 38 ~WebPluginInfo(); |
37 WebPluginInfo& operator=(const WebPluginInfo& rhs); | 39 WebPluginInfo& operator=(const WebPluginInfo& rhs); |
38 | 40 |
39 // Special constructor only used during unit testing: | 41 // Special constructor only used during unit testing: |
40 WebPluginInfo(const string16& fake_name, | 42 WebPluginInfo(const string16& fake_name, |
41 const FilePath& fake_path, | 43 const FilePath& fake_path, |
42 const string16& fake_version, | 44 const string16& fake_version, |
43 const string16& fake_desc); | 45 const string16& fake_desc); |
44 | 46 |
45 // The name of the plugin (i.e. Flash). | 47 // The name of the plugin (i.e. Flash). |
46 string16 name; | 48 string16 name; |
47 | 49 |
48 // The path to the plugin file (DLL/bundle/library). | 50 // The path to the plugin file (DLL/bundle/library). |
49 FilePath path; | 51 FilePath path; |
50 | 52 |
51 // The version number of the plugin file (may be OS-specific) | 53 // The version number of the plugin file (may be OS-specific) |
52 string16 version; | 54 string16 version; |
53 | 55 |
54 // A description of the plugin that we get from its version info. | 56 // A description of the plugin that we get from its version info. |
55 string16 desc; | 57 string16 desc; |
56 | 58 |
57 // A list of all the mime types that this plugin supports. | 59 // A list of all the mime types that this plugin supports. |
58 std::vector<WebPluginMimeType> mime_types; | 60 std::vector<WebPluginMimeType> mime_types; |
59 | 61 |
60 // Whether the plugin is enabled. | 62 // Whether the plugin is enabled. |
61 bool enabled; | 63 bool enabled; |
64 | |
65 // Reason for the plugin being either enabled or disabled. | |
66 int reason; | |
jam
2010/12/21 19:57:42
we don't need both an enabled boolean and a reason
pastarmovj
2010/12/21 20:31:19
Indeed we do. The reason why this enum is called "
| |
67 }; | |
68 | |
69 class WebPluginInfoUtils { | |
Bernhard Bauer
2010/12/21 19:07:39
Maybe move this to a separate class?
jam
2010/12/21 19:57:42
we already have too many plugin related classes, I
pastarmovj
2010/12/21 20:31:19
Separate file you mean?
pastarmovj
2010/12/21 20:31:19
Alright, I will move (possibly duplicate) any of t
Bernhard Bauer
2010/12/21 21:36:11
Uh, yes, but like John said, a namespace would pro
pastarmovj
2010/12/23 13:00:19
Moved to the respective user classes. Though I fin
| |
70 public: | |
71 // Enables the plugin if not already enabled and if policy allows it to. | |
72 // Returns true on success. | |
73 static bool Enable(WebPluginInfo* plugin, WebPluginInfo::Reason reason); | |
74 | |
75 // Disables the plugin if not already disabled and if policy allows it to. | |
76 // Returns true on success. | |
77 static bool Disable(WebPluginInfo* plugin, WebPluginInfo::Reason reason); | |
78 | |
79 static bool IsEnabled(const WebPluginInfo& plugin); | |
80 static bool IsManaged(const WebPluginInfo& plugin); | |
81 | |
82 // Returns true if the plugin supports |mime_type|. |mime_type| should be all | |
83 // lower case. | |
84 static bool SupportsType(const WebPluginInfo& plugin, | |
85 const std::string& mime_type, | |
jam
2010/12/21 19:57:42
nit: spacing is off
pastarmovj
2010/12/23 13:00:19
Done.
| |
86 bool allow_wildcard); | |
87 | |
88 // Returns true if the given plugin supports a given file extension. | |
89 // |extension| should be all lower case. If |mime_type| is not NULL, it will | |
90 // be set to the MIME type if found. The MIME type which corresponds to the | |
91 // extension is optionally returned back. | |
92 static bool SupportsExtension(const WebPluginInfo& plugin, | |
93 const std::string& extension, | |
jam
2010/12/21 19:57:42
nit: spacing
pastarmovj
2010/12/23 13:00:19
Done.
| |
94 std::string* actual_mime_type); | |
62 }; | 95 }; |
63 | 96 |
64 } // namespace npapi | 97 } // namespace npapi |
65 } // namespace webkit | 98 } // namespace webkit |
66 | 99 |
67 #endif // WEBKIT_PLUGINS_NPAPI_WEBPLUGININFO_H_ | 100 #endif // WEBKIT_PLUGINS_NPAPI_WEBPLUGININFO_H_ |
OLD | NEW |