Chromium Code Reviews| 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 { |
| 31 enum Reason { USER = 1 << 1, MANAGED = 1 << 2 }; | |
| 32 | |
| 31 WebPluginInfo(); | 33 WebPluginInfo(); |
| 32 WebPluginInfo(const WebPluginInfo& rhs); | 34 WebPluginInfo(const WebPluginInfo& rhs); |
| 33 ~WebPluginInfo(); | 35 ~WebPluginInfo(); |
| 34 WebPluginInfo& operator=(const WebPluginInfo& rhs); | 36 WebPluginInfo& operator=(const WebPluginInfo& rhs); |
| 35 | 37 |
| 36 // Special constructor only used during unit testing: | 38 // Special constructor only used during unit testing: |
| 37 WebPluginInfo(const string16& fake_name, | 39 WebPluginInfo(const string16& fake_name, |
| 40 const FilePath& fake_path, | |
| 38 const string16& fake_version, | 41 const string16& fake_version, |
| 39 const string16& fake_desc); | 42 const string16& fake_desc); |
| 40 | 43 |
| 44 | |
| 45 // Enables the plugin if not already enabled and if policy allows it to. | |
| 46 // Returns true on success. | |
| 47 bool Enable(Reason reason); | |
| 48 | |
| 49 // Disables the plugin if not already disabled and if policy allows it to. | |
| 50 // Returns true on success. | |
| 51 bool Disable(Reason reason); | |
| 52 | |
| 53 bool IsEnabled() const { return enabled; } | |
| 54 static bool IsManaged(int reason) { return (reason & MANAGED) != 0; } | |
| 55 bool HasVersion() const { return version.length() != 0; } | |
| 56 | |
| 57 // Returns true if the plugin supports |mime-type|. |mime_type| should be all | |
|
Bernhard Bauer
2010/12/20 22:30:28
Mini-nit: |mime_type| with an underscore.
pastarmovj
2010/12/21 16:53:02
Done.
| |
| 58 // lower case. | |
| 59 bool SupportsType(const std::string& mime_type, bool allow_wildcard) const; | |
| 60 | |
| 61 // Returns true if the given plugin supports a given file extension. | |
| 62 // |extension| should be all lower case. If |mime_type| is not NULL, it will | |
| 63 // be set to the MIME type if found. The mime type which corresponds to the | |
|
Bernhard Bauer
2010/12/20 22:30:28
And please for the second instance as well :)
pastarmovj
2010/12/21 16:53:02
Done.
| |
| 64 // extension is optionally returned back. | |
| 65 bool SupportsExtension(const std::string& extension, | |
| 66 std::string* actual_mime_type) const; | |
| 67 | |
| 41 // The name of the plugin (i.e. Flash). | 68 // The name of the plugin (i.e. Flash). |
| 42 string16 name; | 69 string16 name; |
| 43 | 70 |
| 44 // The path to the plugin file (DLL/bundle/library). | 71 // The path to the plugin file (DLL/bundle/library). |
| 45 FilePath path; | 72 FilePath path; |
| 46 | 73 |
| 47 // The version number of the plugin file (may be OS-specific) | 74 // The version number of the plugin file (may be OS-specific) |
| 48 string16 version; | 75 string16 version; |
| 49 | 76 |
| 50 // A description of the plugin that we get from its version info. | 77 // A description of the plugin that we get from its version info. |
| 51 string16 desc; | 78 string16 desc; |
| 52 | 79 |
| 53 // A list of all the mime types that this plugin supports. | 80 // A list of all the mime types that this plugin supports. |
| 54 std::vector<WebPluginMimeType> mime_types; | 81 std::vector<WebPluginMimeType> mime_types; |
| 55 | 82 |
| 56 // Whether the plugin is enabled. | 83 // Whether the plugin is enabled. |
| 57 bool enabled; | 84 bool enabled; |
| 85 | |
| 86 // Reason for the plugin being either enabled or disabled. | |
| 87 int reason; | |
| 88 | |
| 89 // Priority of the plugin (obsolete?) | |
| 90 int priority; | |
| 58 }; | 91 }; |
| 59 | 92 |
| 60 #endif // WEBKIT_GLUE_WEBPLUGININFO_H_ | 93 #endif // WEBKIT_GLUE_PLUGINS_WEBPLUGININFO_H_ |
| OLD | NEW |