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

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

Issue 5699005: Policy: Re-enabled plugin still disabled (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More fixes and cleanups. 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/glue/plugins/webplugininfo.h
diff --git a/webkit/glue/plugins/webplugininfo.h b/webkit/glue/plugins/webplugininfo.h
index 34eff3d5ae9d2ae6910d7104e95438547e3c4fa8..a69076e5423c773eda20ce5d2abdb9b00a5f39dd 100644
--- a/webkit/glue/plugins/webplugininfo.h
+++ b/webkit/glue/plugins/webplugininfo.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef WEBKIT_GLUE_WEBPLUGININFO_H_
-#define WEBKIT_GLUE_WEBPLUGININFO_H_
+#ifndef WEBKIT_GLUE_PLUGINS_WEBPLUGININFO_H_
+#define WEBKIT_GLUE_PLUGINS_WEBPLUGININFO_H_
#include <string>
#include <vector>
@@ -28,6 +28,8 @@ struct WebPluginMimeType {
// Describes an available NPAPI plugin.
struct WebPluginInfo {
+ enum Reason { USER = 1 << 1, MANAGED = 1 << 2 };
+
WebPluginInfo();
WebPluginInfo(const WebPluginInfo& rhs);
~WebPluginInfo();
@@ -35,9 +37,34 @@ struct WebPluginInfo {
// Special constructor only used during unit testing:
WebPluginInfo(const string16& fake_name,
+ const FilePath& fake_path,
const string16& fake_version,
const string16& fake_desc);
+
+ // Enables the plugin if not already enabled and if policy allows it to.
+ // Returns true on success.
+ bool Enable(Reason reason);
+
+ // Disables the plugin if not already disabled and if policy allows it to.
+ // Returns true on success.
+ bool Disable(Reason reason);
+
+ bool IsEnabled() const { return enabled; }
+ static bool IsManaged(int reason) { return (reason & MANAGED) != 0; }
+ bool HasVersion() const { return version.length() != 0; }
+
+ // 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.
+ // lower case.
+ bool SupportsType(const std::string& mime_type, bool allow_wildcard) const;
+
+ // 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
Bernhard Bauer 2010/12/20 22:30:28 And please for the second instance as well :)
pastarmovj 2010/12/21 16:53:02 Done.
+ // extension is optionally returned back.
+ bool SupportsExtension(const std::string& extension,
+ std::string* actual_mime_type) const;
+
// The name of the plugin (i.e. Flash).
string16 name;
@@ -55,6 +82,12 @@ struct WebPluginInfo {
// Whether the plugin is enabled.
bool enabled;
+
+ // Reason for the plugin being either enabled or disabled.
+ int reason;
+
+ // Priority of the plugin (obsolete?)
+ int priority;
};
-#endif // WEBKIT_GLUE_WEBPLUGININFO_H_
+#endif // WEBKIT_GLUE_PLUGINS_WEBPLUGININFO_H_

Powered by Google App Engine
This is Rietveld 408576698