Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1109)

Unified Diff: webkit/plugins/npapi/webplugininfo.h

Issue 5699005: Policy: Re-enabled plugin still disabled (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleaned up WebPluginInfo and rebased on fixed PluginGroup::InitFrom. Created 10 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: webkit/plugins/npapi/webplugininfo.h
diff --git a/webkit/plugins/npapi/webplugininfo.h b/webkit/plugins/npapi/webplugininfo.h
index 859665c1963614f0aa6b4ca3cf88b28c4c0fb4a0..dd12b0012eb85d33076aefeb6c61d7b29a8faab7 100644
--- a/webkit/plugins/npapi/webplugininfo.h
+++ b/webkit/plugins/npapi/webplugininfo.h
@@ -31,6 +31,8 @@ struct WebPluginMimeType {
// Describes an available NPAPI plugin.
struct WebPluginInfo {
+ 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
+
WebPluginInfo();
WebPluginInfo(const WebPluginInfo& rhs);
~WebPluginInfo();
@@ -59,6 +61,37 @@ struct WebPluginInfo {
// Whether the plugin is enabled.
bool enabled;
+
+ // Reason for the plugin being either enabled or disabled.
+ 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 "
+};
+
+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
+ public:
+ // Enables the plugin if not already enabled and if policy allows it to.
+ // Returns true on success.
+ static bool Enable(WebPluginInfo* plugin, WebPluginInfo::Reason reason);
+
+ // Disables the plugin if not already disabled and if policy allows it to.
+ // Returns true on success.
+ static bool Disable(WebPluginInfo* plugin, WebPluginInfo::Reason reason);
+
+ static bool IsEnabled(const WebPluginInfo& plugin);
+ static bool IsManaged(const WebPluginInfo& plugin);
+
+ // Returns true if the plugin supports |mime_type|. |mime_type| should be all
+ // lower case.
+ static bool SupportsType(const WebPluginInfo& plugin,
+ const std::string& mime_type,
jam 2010/12/21 19:57:42 nit: spacing is off
pastarmovj 2010/12/23 13:00:19 Done.
+ bool allow_wildcard);
+
+ // Returns true if the given plugin supports a given file extension.
+ // |extension| should be all lower case. If |mime_type| is not NULL, it will
+ // be set to the MIME type if found. The MIME type which corresponds to the
+ // extension is optionally returned back.
+ static bool SupportsExtension(const WebPluginInfo& plugin,
+ const std::string& extension,
jam 2010/12/21 19:57:42 nit: spacing
pastarmovj 2010/12/23 13:00:19 Done.
+ std::string* actual_mime_type);
};
} // namespace npapi

Powered by Google App Engine
This is Rietveld 408576698