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_GLUE_WEBPLUGININFO_H_ | 5 #ifndef WEBKIT_GLUE_PLUGINS_WEBPLUGININFO_H_ |
6 #define WEBKIT_GLUE_WEBPLUGININFO_H_ | 6 #define WEBKIT_GLUE_PLUGINS_WEBPLUGININFO_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
13 | 13 |
14 // Describes a mime type entry for a plugin. | 14 // Describes a mime type entry for a plugin. |
15 struct WebPluginMimeType { | 15 struct WebPluginMimeType { |
16 WebPluginMimeType(); | 16 WebPluginMimeType(); |
17 ~WebPluginMimeType(); | 17 ~WebPluginMimeType(); |
18 | 18 |
19 // The name of the mime type (e.g., "application/x-shockwave-flash"). | 19 // The name of the mime type (e.g., "application/x-shockwave-flash"). |
20 std::string mime_type; | 20 std::string mime_type; |
21 | 21 |
22 // A list of all the file extensions for this mime type. | 22 // A list of all the file extensions for this mime type. |
23 std::vector<std::string> file_extensions; | 23 std::vector<std::string> file_extensions; |
24 | 24 |
25 // Description of the mime type. | 25 // Description of the mime type. |
26 string16 description; | 26 string16 description; |
27 }; | 27 }; |
28 | 28 |
29 // Describes an available NPAPI plugin. | 29 // Describes an available NPAPI plugin. |
30 struct WebPluginInfo { | 30 struct WebPluginInfo { |
jam
2010/12/17 19:14:45
note that per the style guide, if this has methods
pastarmovj
2010/12/20 19:57:37
I don't think that we should do this (at least not
jam
2010/12/20 20:56:59
The issue is that the coding guidelines are pretty
pastarmovj
2010/12/20 21:47:22
Would you agree on having these as global function
jam
2010/12/21 19:57:42
Is the only place that uses them in PluginGroup?
| |
31 WebPluginInfo(); | 31 WebPluginInfo(); |
32 WebPluginInfo(const WebPluginInfo& rhs); | 32 WebPluginInfo(const WebPluginInfo& rhs); |
33 ~WebPluginInfo(); | 33 ~WebPluginInfo(); |
34 WebPluginInfo& operator=(const WebPluginInfo& rhs); | 34 WebPluginInfo& operator=(const WebPluginInfo& rhs); |
35 | 35 |
36 // Special constructor only used during unit testing: | 36 // Special constructor only used during unit testing: |
37 WebPluginInfo(const string16& fake_name, | 37 WebPluginInfo(const string16& fake_name, |
38 const FilePath& fake_path, | |
38 const string16& fake_version, | 39 const string16& fake_version, |
39 const string16& fake_desc); | 40 const string16& fake_desc); |
40 | 41 |
42 | |
43 // Enables the plugin if not already enabled and if policy allows it to. | |
44 // Returns true on success. | |
45 bool Enable(int reason); | |
jam
2010/12/17 19:14:45
please use an enum instead of a reason, that way y
pastarmovj
2010/12/20 19:57:37
Done.
| |
46 | |
47 // Disables the plugin if not already disabled and if policy allows it to. | |
48 // Returns true on success. | |
49 bool Disable(int reason); | |
50 | |
51 bool IsEnabled() const { return enabled; } | |
52 static bool IsManaged(int reason) { return (reason & MANAGED) != 0; } | |
53 bool HasVersion() const { return version.length() != 0; } | |
54 | |
55 // Returns true if the plugin supports "mime-type". |mime_type| should be all | |
Bernhard Bauer
2010/12/17 18:50:59
Nit: Why the quotes?
pastarmovj
2010/12/20 19:57:37
Done.
| |
56 // lower case. | |
57 bool SupportsType(const std::string& mime_type, bool allow_wildcard) const; | |
58 | |
59 // Returns true if the given plugin supports a given file extension. | |
60 // |extension| should be all lower case. If |mime_type| is not NULL, it will | |
61 // be set to the mime type if found. The mime type which corresponds to the | |
Bernhard Bauer
2010/12/17 18:50:59
Mini-nit: "MIME type" is usually written in caps,
pastarmovj
2010/12/20 19:57:37
Done.
| |
62 // extension is optionally returned back. | |
63 bool SupportsExtension(const std::string& extension, | |
64 std::string* actual_mime_type) const; | |
65 | |
41 // The name of the plugin (i.e. Flash). | 66 // The name of the plugin (i.e. Flash). |
42 string16 name; | 67 string16 name; |
43 | 68 |
44 // The path to the plugin file (DLL/bundle/library). | 69 // The path to the plugin file (DLL/bundle/library). |
45 FilePath path; | 70 FilePath path; |
46 | 71 |
47 // The version number of the plugin file (may be OS-specific) | 72 // The version number of the plugin file (may be OS-specific) |
48 string16 version; | 73 string16 version; |
49 | 74 |
50 // A description of the plugin that we get from its version info. | 75 // A description of the plugin that we get from its version info. |
51 string16 desc; | 76 string16 desc; |
52 | 77 |
53 // A list of all the mime types that this plugin supports. | 78 // A list of all the mime types that this plugin supports. |
54 std::vector<WebPluginMimeType> mime_types; | 79 std::vector<WebPluginMimeType> mime_types; |
55 | 80 |
56 // Whether the plugin is enabled. | 81 // Whether the plugin is enabled. |
57 bool enabled; | 82 bool enabled; |
83 | |
84 // Reason for the plugin being either enabled or disabled. | |
85 int reason; | |
Bernhard Bauer
2010/12/17 18:50:59
If you add a new field to WebPluginInfo, you shoul
pastarmovj
2010/12/20 19:57:37
Done.
| |
86 | |
87 // Constants definig bit fields in the reason member. | |
Bernhard Bauer
2010/12/17 18:50:59
Nit: defining
pastarmovj
2010/12/20 19:57:37
Removed anyhow
| |
88 static const int USER; | |
89 static const int MANAGED; | |
jam
2010/12/17 19:14:45
nit: the meaning of managed is a little cryptic.
pastarmovj
2010/12/20 19:57:37
Managed is the name used in the policy world to id
| |
90 | |
91 // Priority of the plugin (obsolete?) | |
Bernhard Bauer
2010/12/17 18:50:59
At least it shouldn't be here. The priority is not
| |
92 int priority; | |
jam
2010/12/17 19:14:45
i think the order of plugins in a plugin group sho
Bernhard Bauer
2010/12/17 19:26:40
The order inside a group is probably not sufficien
pastarmovj
2010/12/20 19:57:37
We could only think of one synthetic case where or
jam
2010/12/20 20:56:59
I'm really against having this concept of order be
jam
2010/12/20 21:01:42
one more thing: if you add a is_placeholder, then
pastarmovj
2010/12/20 21:47:22
The order the array of plugins that existed before
jam
2010/12/21 19:57:42
why is this needed in PluginGroup? I really don't
| |
58 }; | 93 }; |
59 | 94 |
60 #endif // WEBKIT_GLUE_WEBPLUGININFO_H_ | 95 #endif // WEBKIT_GLUE_PLUGINS_WEBPLUGININFO_H_ |
OLD | NEW |