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

Side by Side Diff: chrome/common/plugin_group.h

Issue 2967007: Disable outdated plugins, block non-sandboxed plugins. (Closed)
Patch Set: '' Created 10 years, 5 months 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 unified diff | Download patch
« no previous file with comments | « chrome/common/notification_type.h ('k') | chrome/common/render_messages.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 CHROME_COMMON_PLUGIN_GROUP_H_ 5 #ifndef CHROME_COMMON_PLUGIN_GROUP_H_
6 #define CHROME_COMMON_PLUGIN_GROUP_H_ 6 #define CHROME_COMMON_PLUGIN_GROUP_H_
7 7
8 #include <set> 8 #include <set>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/linked_ptr.h" 11 #include "base/linked_ptr.h"
12 #include "base/scoped_ptr.h" 12 #include "base/scoped_ptr.h"
13 #include "base/string16.h" 13 #include "base/string16.h"
14 #include "base/version.h" 14 #include "base/version.h"
15 #include "webkit/glue/plugins/webplugininfo.h" 15 #include "webkit/glue/plugins/webplugininfo.h"
16 16
17 class DictionaryValue; 17 class DictionaryValue;
18 18
19 // Hard-coded definitions of plugin groups. 19 // Hard-coded definitions of plugin groups.
20 struct PluginGroupDefinition { 20 struct PluginGroupDefinition {
21 const char* name; // Name of this group. 21 const char* name; // Name of this group.
22 const char* name_matcher; // Substring matcher for the plugin name. 22 const char* name_matcher; // Substring matcher for the plugin name.
23 const char* version_matcher_low; // Matchers for the plugin version. 23 const char* version_matcher_low; // Matchers for the plugin version.
24 const char* version_matcher_high; 24 const char* version_matcher_high;
25 const char* min_version; // Minimum secure version. 25 const char* min_version; // Minimum secure version.
26 const char* update_url; // Location of latest secure version. 26 const char* update_url; // Location of latest secure version.
27 }; 27 };
28 28
29 // A PluginGroup can match a range of versions of a specific plugin (as defined
30 // by matching a substring of its name).
31 // It contains all WebPluginInfo structs (at least one) matching its definition.
32 // In addition, it knows about a security "baseline", i.e. the minimum version
33 // of a plugin that is needed in order not to exhibit known security
34 // vulnerabilities.
29 35
30 // A PluginGroup contains at least one WebPluginInfo.
31 // In addition, it knows if the plugin is critically vulnerable.
32 class PluginGroup { 36 class PluginGroup {
33 public: 37 public:
34 // Creates a PluginGroup from a PluginGroupDefinition. 38 // Creates a PluginGroup from a PluginGroupDefinition.
35 static PluginGroup* FromPluginGroupDefinition( 39 static PluginGroup* FromPluginGroupDefinition(
36 const PluginGroupDefinition& definition); 40 const PluginGroupDefinition& definition);
37 41
38 // Creates a PluginGroup from a WebPluginInfo -- when no hard-coded 42 // Creates a PluginGroup from a WebPluginInfo -- when no hard-coded
39 // definition is found. 43 // definition is found.
40 static PluginGroup* FromWebPluginInfo(const WebPluginInfo& wpi); 44 static PluginGroup* FromWebPluginInfo(const WebPluginInfo& wpi);
41 45
42 // Find a plugin group matching |info| in the list of hardcoded plugins. 46 // Find a plugin group matching |info| in the list of hardcoded plugins and
47 // returns a copy of it if found, or a new group matching exactly this plugin
48 // otherwise.
43 static PluginGroup* FindHardcodedPluginGroup(const WebPluginInfo& info); 49 static PluginGroup* FindHardcodedPluginGroup(const WebPluginInfo& info);
44 50
45 // Configures the set of plugin names that are disabled by policy. 51 // Configures the set of plugin names that are disabled by policy.
46 static void SetPolicyDisabledPluginSet(const std::set<string16>& set); 52 static void SetPolicyDisabledPluginSet(const std::set<string16>& set);
47 53
48 // Tests to see if a plugin is on the blacklist using its name as 54 // Tests to see if a plugin is on the blacklist using its name as
49 // the lookup key. 55 // the lookup key.
50 static bool IsPluginNameDisabledByPolicy(const string16& plugin_name); 56 static bool IsPluginNameDisabledByPolicy(const string16& plugin_name);
51 57
52 // Tests to see if a plugin is on the blacklist using its path as 58 // Tests to see if a plugin is on the blacklist using its path as
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 std::string min_version_str_; 126 std::string min_version_str_;
121 scoped_ptr<Version> min_version_; 127 scoped_ptr<Version> min_version_;
122 scoped_ptr<Version> max_version_; 128 scoped_ptr<Version> max_version_;
123 std::vector<WebPluginInfo> web_plugin_infos_; 129 std::vector<WebPluginInfo> web_plugin_infos_;
124 std::vector<int> web_plugin_positions_; 130 std::vector<int> web_plugin_positions_;
125 131
126 DISALLOW_COPY_AND_ASSIGN(PluginGroup); 132 DISALLOW_COPY_AND_ASSIGN(PluginGroup);
127 }; 133 };
128 134
129 #endif // CHROME_COMMON_PLUGIN_GROUP_H_ 135 #endif // CHROME_COMMON_PLUGIN_GROUP_H_
OLDNEW
« no previous file with comments | « chrome/common/notification_type.h ('k') | chrome/common/render_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698