summaryrefslogtreecommitdiffstats
path: root/webkit/glue/plugins/plugin_group.h
diff options
context:
space:
mode:
authorKristian Monsen <kristianm@google.com>2011-05-11 20:53:37 +0100
committerKristian Monsen <kristianm@google.com>2011-05-16 13:54:48 +0100
commit21d179b334e59e9a3bfcaed4c4430bef1bc5759d (patch)
tree64e2bb6da27af6a5c93ca34f6051584aafbfcb9e /webkit/glue/plugins/plugin_group.h
parent0c63f00edd6ed0482fd5cbcea937ca088baf7858 (diff)
downloadexternal_chromium-21d179b334e59e9a3bfcaed4c4430bef1bc5759d.zip
external_chromium-21d179b334e59e9a3bfcaed4c4430bef1bc5759d.tar.gz
external_chromium-21d179b334e59e9a3bfcaed4c4430bef1bc5759d.tar.bz2
Merge Chromium at 10.0.621.0: Initial merge by git.
Change-Id: I070cc91c608dfa4a968a5a54c173260765ac8097
Diffstat (limited to 'webkit/glue/plugins/plugin_group.h')
-rw-r--r--webkit/glue/plugins/plugin_group.h184
1 files changed, 0 insertions, 184 deletions
diff --git a/webkit/glue/plugins/plugin_group.h b/webkit/glue/plugins/plugin_group.h
deleted file mode 100644
index 2281437..0000000
--- a/webkit/glue/plugins/plugin_group.h
+++ /dev/null
@@ -1,184 +0,0 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef WEBKIT_GLUE_PLUGINS_PLUGIN_GROUP_H_
-#define WEBKIT_GLUE_PLUGINS_PLUGIN_GROUP_H_
-#pragma once
-
-#include <map>
-#include <set>
-#include <vector>
-
-#include "base/gtest_prod_util.h"
-#include "base/scoped_ptr.h"
-#include "base/string16.h"
-
-class DictionaryValue;
-class FilePath;
-class Version;
-struct WebPluginInfo;
-
-namespace NPAPI {
- class PluginList;
-};
-
-template <typename T>
-class linked_ptr;
-
-// Hard-coded definitions of plugin groups.
-struct PluginGroupDefinition {
- const char* identifier; // Unique identifier for this group.
- const char* name; // Name of this group.
- const char* name_matcher; // Substring matcher for the plugin name.
- const char* version_matcher_low; // Matchers for the plugin version.
- const char* version_matcher_high;
- const char* min_version; // Minimum secure version.
- const char* update_url; // Location of latest secure version.
-};
-
-// A PluginGroup can match a range of versions of a specific plugin (as defined
-// by matching a substring of its name).
-// It contains all WebPluginInfo structs (at least one) matching its definition.
-// In addition, it knows about a security "baseline", i.e. the minimum version
-// of a plugin that is needed in order not to exhibit known security
-// vulnerabilities.
-
-class PluginGroup {
- public:
- // Used by about:plugins to disable Reader plugin when internal PDF viewer is
- // enabled.
- static const char* kAdobeReader8GroupName;
- static const char* kAdobeReader9GroupName;
-
- typedef std::map<std::string, linked_ptr<PluginGroup> > PluginMap;
-
- // Creates a PluginGroup from a PluginGroupDefinition.
- static PluginGroup* FromPluginGroupDefinition(
- const PluginGroupDefinition& definition);
-
- ~PluginGroup();
-
- // Creates a PluginGroup from a WebPluginInfo -- when no hard-coded
- // definition is found.
- static PluginGroup* FromWebPluginInfo(const WebPluginInfo& wpi);
-
- // Find a plugin group matching |info| in the list of hardcoded plugins and
- // returns a copy of it if found, or a new group matching exactly this plugin
- // otherwise.
- // The caller should take ownership of the return PluginGroup.
- static PluginGroup* CopyOrCreatePluginGroup(const WebPluginInfo& info);
-
- // Configures the set of plugin name patterns for disabling plugins via
- // enterprise configuration management.
- static void SetPolicyDisabledPluginPatterns(const std::set<string16>& set);
-
- // Tests to see if a plugin is on the blacklist using its name as
- // the lookup key.
- static bool IsPluginNameDisabledByPolicy(const string16& plugin_name);
-
- // Tests to see if a plugin is on the blacklist using its path as
- // the lookup key.
- static bool IsPluginPathDisabledByPolicy(const FilePath& plugin_path);
-
- // Find the PluginGroup matching a Plugin in a list of plugin groups. Returns
- // NULL if no matching PluginGroup is found.
- static PluginGroup* FindGroupMatchingPlugin(
- const std::map<std::string, linked_ptr<PluginGroup> >& plugin_groups,
- const WebPluginInfo& plugin);
-
- // Creates a copy of this plugin group.
- PluginGroup* Copy() {
- return new PluginGroup(group_name_, name_matcher_, version_range_low_str_,
- version_range_high_str_, min_version_str_,
- update_url_, identifier_);
- }
-
- // Returns true if the given plugin matches this group.
- bool Match(const WebPluginInfo& plugin) const;
-
- // Adds the given plugin to this group. Provide the position of the
- // plugin as given by PluginList so we can display its priority.
- void AddPlugin(const WebPluginInfo& plugin, int position);
-
- // Enables/disables this group. This enables/disables all plugins in the
- // group.
- void Enable(bool enable);
-
- // Returns whether the plugin group is enabled or not.
- bool Enabled() const { return enabled_; }
-
- // Returns a unique identifier for this group, if one is defined, or the empty
- // string otherwise.
- const std::string& identifier() const { return identifier_; }
-
- // Returns this group's name, or the filename without extension if the name
- // is empty.
- string16 GetGroupName() const;
-
- // Returns the description of the highest-priority plug-in in the group.
- const string16& description() const { return description_; }
-
- // Returns a DictionaryValue with data to display in the UI.
- DictionaryValue* GetDataForUI() const;
-
- // Returns a DictionaryValue with data to save in the preferences.
- DictionaryValue* GetSummary() const;
-
- // Returns the update URL.
- std::string GetUpdateURL() const { return update_url_; }
-
- // Returns true if the highest-priority plugin in this group has known
- // security problems.
- bool IsVulnerable() const;
-
- // Disables all plugins in this group that are older than the
- // minimum version.
- void DisableOutdatedPlugins();
-
- private:
- FRIEND_TEST_ALL_PREFIXES(PluginGroupTest, PluginGroupDefinition);
-
- static const PluginGroupDefinition* GetPluginGroupDefinitions();
- static size_t GetPluginGroupDefinitionsSize();
-
- PluginGroup(const string16& group_name,
- const string16& name_matcher,
- const std::string& version_range_low,
- const std::string& version_range_high,
- const std::string& min_version,
- const std::string& update_url,
- const std::string& identifier);
-
- Version* CreateVersionFromString(const string16& version_string);
-
- // Set the description and version for this plugin group from the
- // given plug-in.
- void UpdateDescriptionAndVersion(const WebPluginInfo& plugin);
-
- // Updates the active plugin in the group. The active plugin is the first
- // enabled one, or if all plugins are disabled, simply the first one.
- void UpdateActivePlugin(const WebPluginInfo& plugin);
-
- static std::set<string16>* policy_disabled_plugin_patterns_;
-
- std::string identifier_;
- string16 group_name_;
- string16 name_matcher_;
- std::string version_range_low_str_;
- std::string version_range_high_str_;
- scoped_ptr<Version> version_range_low_;
- scoped_ptr<Version> version_range_high_;
- string16 description_;
- std::string update_url_;
- bool enabled_;
- std::string min_version_str_;
- scoped_ptr<Version> min_version_;
- scoped_ptr<Version> version_;
- std::vector<WebPluginInfo> web_plugin_infos_;
- std::vector<int> web_plugin_positions_;
-
- DISALLOW_COPY_AND_ASSIGN(PluginGroup);
-};
-
-#endif // WEBKIT_GLUE_PLUGINS_PLUGIN_GROUP_H_