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

Side by Side Diff: webkit/plugins/npapi/plugin_group.h

Issue 6350010: Put some plug-ins behind an infobar, where they have:... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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 | Annotate | Revision Log
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 WEBKIT_PLUGINS_NPAPI_PLUGIN_GROUP_H_ 5 #ifndef WEBKIT_PLUGINS_NPAPI_PLUGIN_GROUP_H_
6 #define WEBKIT_PLUGINS_NPAPI_PLUGIN_GROUP_H_ 6 #define WEBKIT_PLUGINS_NPAPI_PLUGIN_GROUP_H_
7 #pragma once 7 #pragma once
8 8
9 #include <map> 9 #include <map>
10 #include <set> 10 #include <set>
(...skipping 20 matching lines...) Expand all
31 } 31 }
32 // Hard-coded version ranges for plugin groups. 32 // Hard-coded version ranges for plugin groups.
33 struct VersionRangeDefinition { 33 struct VersionRangeDefinition {
34 // Matcher for lowest version matched by this range (inclusive). May be empty 34 // Matcher for lowest version matched by this range (inclusive). May be empty
35 // to match everything iff |version_matcher_high| is also empty. 35 // to match everything iff |version_matcher_high| is also empty.
36 const char* version_matcher_low; 36 const char* version_matcher_low;
37 // Matcher for highest version matched by this range (exclusive). May be empty 37 // Matcher for highest version matched by this range (exclusive). May be empty
38 // to match anything higher than |version_matcher_low|. 38 // to match anything higher than |version_matcher_low|.
39 const char* version_matcher_high; 39 const char* version_matcher_high;
40 const char* min_version; // Minimum secure version. 40 const char* min_version; // Minimum secure version.
41 bool requires_authorization; // If this range needs user permission to run.
41 }; 42 };
42 43
43 // Hard-coded definitions of plugin groups. 44 // Hard-coded definitions of plugin groups.
44 struct PluginGroupDefinition { 45 struct PluginGroupDefinition {
45 const char* identifier; // Unique identifier for this group. 46 const char* identifier; // Unique identifier for this group.
46 const char* name; // Name of this group. 47 const char* name; // Name of this group.
47 const char* name_matcher; // Substring matcher for the plugin name. 48 const char* name_matcher; // Substring matcher for the plugin name.
48 const VersionRangeDefinition* versions; // List of version ranges. 49 const VersionRangeDefinition* versions; // List of version ranges.
49 const size_t num_versions; // Size of the array |versions| points to. 50 const size_t num_versions; // Size of the array |versions| points to.
50 const char* update_url; // Location of latest secure version. 51 const char* update_url; // Location of latest secure version.
51 }; 52 };
52 53
53 // Run-time structure to hold version range information. 54 // Run-time structure to hold version range information.
54 struct VersionRange { 55 struct VersionRange {
55 public: 56 public:
56 explicit VersionRange(VersionRangeDefinition definition); 57 explicit VersionRange(VersionRangeDefinition definition);
57 VersionRange(const VersionRange& other); 58 VersionRange(const VersionRange& other);
58 VersionRange& operator=(const VersionRange& other); 59 VersionRange& operator=(const VersionRange& other);
59 ~VersionRange(); 60 ~VersionRange();
60 61
61 std::string low_str; 62 std::string low_str;
62 std::string high_str; 63 std::string high_str;
63 std::string min_str; 64 std::string min_str;
64 scoped_ptr<Version> low; 65 scoped_ptr<Version> low;
65 scoped_ptr<Version> high; 66 scoped_ptr<Version> high;
66 scoped_ptr<Version> min; 67 scoped_ptr<Version> min;
68 bool requires_authorization;
67 private: 69 private:
68 void InitFrom(const VersionRange& other); 70 void InitFrom(const VersionRange& other);
69 }; 71 };
70 72
71 // A PluginGroup can match a range of versions of a specific plugin (as defined 73 // A PluginGroup can match a range of versions of a specific plugin (as defined
72 // by matching a substring of its name). 74 // by matching a substring of its name).
73 // It contains all WebPluginInfo structs (at least one) matching its definition. 75 // It contains all WebPluginInfo structs (at least one) matching its definition.
74 // In addition, it knows about a security "baseline", i.e. the minimum version 76 // In addition, it knows about a security "baseline", i.e. the minimum version
75 // of a plugin that is needed in order not to exhibit known security 77 // of a plugin that is needed in order not to exhibit known security
76 // vulnerabilities. 78 // vulnerabilities.
77 79
78 class PluginGroup { 80 class PluginGroup {
79 public: 81 public:
80 // Used by about:plugins to disable Reader plugin when internal PDF viewer is 82 // Used by about:plugins to disable Reader plugin when internal PDF viewer is
81 // enabled. 83 // enabled.
82 static const char* kAdobeReaderGroupName; 84 static const char* kAdobeReaderGroupName;
83 static const char* kAdobeReaderUpdateURL; 85 static const char* kAdobeReaderUpdateURL;
86 static const char* kJavaGroupName;
87 static const char* kQuickTimeGroupName;
88 static const char* kShockwaveGroupName;
84 89
85 PluginGroup(const PluginGroup& other); 90 PluginGroup(const PluginGroup& other);
86 91
87 ~PluginGroup(); 92 ~PluginGroup();
88 93
89 PluginGroup& operator=(const PluginGroup& other); 94 PluginGroup& operator=(const PluginGroup& other);
90 95
91 // Configures the set of plugin name patterns for disabling plugins via 96 // Configures the set of plugin name patterns for disabling plugins via
92 // enterprise configuration management. 97 // enterprise configuration management.
93 static void SetPolicyDisabledPluginPatterns(const std::set<string16>& set); 98 static void SetPolicyDisabledPluginPatterns(const std::set<string16>& set);
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 // Returns a DictionaryValue with data to save in the preferences. 158 // Returns a DictionaryValue with data to save in the preferences.
154 DictionaryValue* GetSummary() const; 159 DictionaryValue* GetSummary() const;
155 160
156 // Returns the update URL. 161 // Returns the update URL.
157 std::string GetUpdateURL() const { return update_url_; } 162 std::string GetUpdateURL() const { return update_url_; }
158 163
159 // Returns true if the highest-priority plugin in this group has known 164 // Returns true if the highest-priority plugin in this group has known
160 // security problems. 165 // security problems.
161 bool IsVulnerable() const; 166 bool IsVulnerable() const;
162 167
168 // Returns true if this plug-in group always requires user authorization
169 // to run.
170 bool RequiresAuthorization() const;
171
163 // Check if the group has no plugins. Could happen after a reload if the plug- 172 // Check if the group has no plugins. Could happen after a reload if the plug-
164 // in has disappeared from the pc (or in the process of updating). 173 // in has disappeared from the pc (or in the process of updating).
165 bool IsEmpty() const; 174 bool IsEmpty() const;
166 175
167 // Disables all plugins in this group that are older than the 176 // Disables all plugins in this group that are older than the
168 // minimum version. 177 // minimum version.
169 void DisableOutdatedPlugins(); 178 void DisableOutdatedPlugins();
170 179
171 // Parse a version string as used by a plug-in. This method is more lenient 180 // Parse a version string as used by a plug-in. This method is more lenient
172 // in accepting weird version strings than Version::GetFromString(). 181 // in accepting weird version strings than Version::GetFromString().
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 bool enabled_; 258 bool enabled_;
250 std::vector<VersionRange> version_ranges_; 259 std::vector<VersionRange> version_ranges_;
251 scoped_ptr<Version> version_; 260 scoped_ptr<Version> version_;
252 std::vector<WebPluginInfo> web_plugin_infos_; 261 std::vector<WebPluginInfo> web_plugin_infos_;
253 }; 262 };
254 263
255 } // namespace npapi 264 } // namespace npapi
256 } // namespace webkit 265 } // namespace webkit
257 266
258 #endif // WEBKIT_PLUGINS_NPAPI_PLUGIN_GROUP_H_ 267 #endif // WEBKIT_PLUGINS_NPAPI_PLUGIN_GROUP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698