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

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

Issue 5516004: Clean up PluginGroup and related code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: address comments 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/plugin_group.h
diff --git a/webkit/glue/plugins/plugin_group.h b/webkit/glue/plugins/plugin_group.h
index 228143757167ba035e05902fdda253e07dfe3b7e..a2d1aafe1d4ec4ef5512b4f40ebb2838d96b129d 100644
--- a/webkit/glue/plugins/plugin_group.h
+++ b/webkit/glue/plugins/plugin_group.h
@@ -8,6 +8,7 @@
#include <map>
#include <set>
+#include <string>
#include <vector>
#include "base/gtest_prod_util.h"
@@ -22,9 +23,9 @@ struct WebPluginInfo;
namespace NPAPI {
class PluginList;
};
-
-template <typename T>
-class linked_ptr;
+namespace plugin_test_internal {
+class PluginExceptionsTableModelTest;
+}
// Hard-coded definitions of plugin groups.
struct PluginGroupDefinition {
@@ -51,23 +52,11 @@ class PluginGroup {
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(const PluginGroup& other);
~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);
+ PluginGroup& operator=(const PluginGroup& other);
// Configures the set of plugin name patterns for disabling plugins via
// enterprise configuration management.
@@ -81,19 +70,6 @@ class PluginGroup {
// 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;
@@ -137,10 +113,28 @@ class PluginGroup {
void DisableOutdatedPlugins();
private:
- FRIEND_TEST_ALL_PREFIXES(PluginGroupTest, PluginGroupDefinition);
+ typedef std::map<std::string, PluginGroup*> PluginMap;
+
+ friend class NPAPI::PluginList;
+ friend class PluginGroupTest;
+ friend class TableModelArrayControllerTest;
+ friend class plugin_test_internal::PluginExceptionsTableModelTest;
- static const PluginGroupDefinition* GetPluginGroupDefinitions();
- static size_t GetPluginGroupDefinitionsSize();
+ // Generates the (short) identifier string for the given plugin.
+ static std::string GetIdentifier(const WebPluginInfo& wpi);
+
+ // Generates the long identifier (based on the full file path) for the given
+ // plugin, to be called when the short identifier is not unique.
+ static std::string GetLongIdentifier(const WebPluginInfo& wpi);
+
+ // Creates a PluginGroup from a PluginGroupDefinition. The caller takes
+ // ownership of the created PluginGroup.
+ static PluginGroup* FromPluginGroupDefinition(
+ const PluginGroupDefinition& definition);
+
+ // Creates a PluginGroup from a WebPluginInfo. The caller takes ownership of
+ // the created PluginGroup.
+ static PluginGroup* FromWebPluginInfo(const WebPluginInfo& wpi);
PluginGroup(const string16& group_name,
const string16& name_matcher,
@@ -150,6 +144,8 @@ class PluginGroup {
const std::string& update_url,
const std::string& identifier);
+ void InitFrom(const PluginGroup& other);
+
Version* CreateVersionFromString(const string16& version_string);
// Set the description and version for this plugin group from the
@@ -177,8 +173,6 @@ class PluginGroup {
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_

Powered by Google App Engine
This is Rietveld 408576698