OLD | NEW |
---|---|
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_GLUE_PLUGINS_PLUGIN_GROUP_H_ | 5 #ifndef WEBKIT_GLUE_PLUGINS_PLUGIN_GROUP_H_ |
6 #define WEBKIT_GLUE_PLUGINS_PLUGIN_GROUP_H_ | 6 #define WEBKIT_GLUE_PLUGINS_PLUGIN_GROUP_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <list> | |
jam
2010/12/17 19:14:45
not needed?
pastarmovj
2010/12/20 19:57:37
Done.
| |
9 #include <map> | 10 #include <map> |
10 #include <set> | 11 #include <set> |
11 #include <string> | 12 #include <string> |
12 #include <vector> | 13 #include <vector> |
13 | 14 |
14 #include "base/gtest_prod_util.h" | 15 #include "base/gtest_prod_util.h" |
15 #include "base/scoped_ptr.h" | 16 #include "base/scoped_ptr.h" |
16 #include "base/string16.h" | 17 #include "base/string16.h" |
17 | 18 |
18 class DictionaryValue; | 19 class DictionaryValue; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
83 PluginGroup& operator=(const PluginGroup& other); | 84 PluginGroup& operator=(const PluginGroup& other); |
84 | 85 |
85 // Configures the set of plugin name patterns for disabling plugins via | 86 // Configures the set of plugin name patterns for disabling plugins via |
86 // enterprise configuration management. | 87 // enterprise configuration management. |
87 static void SetPolicyDisabledPluginPatterns(const std::set<string16>& set); | 88 static void SetPolicyDisabledPluginPatterns(const std::set<string16>& set); |
88 | 89 |
89 // Tests to see if a plugin is on the blacklist using its name as | 90 // Tests to see if a plugin is on the blacklist using its name as |
90 // the lookup key. | 91 // the lookup key. |
91 static bool IsPluginNameDisabledByPolicy(const string16& plugin_name); | 92 static bool IsPluginNameDisabledByPolicy(const string16& plugin_name); |
92 | 93 |
93 // Tests to see if a plugin is on the blacklist using its path as | |
94 // the lookup key. | |
95 static bool IsPluginPathDisabledByPolicy(const FilePath& plugin_path); | |
96 | |
97 // Returns true if the given plugin matches this group. | 94 // Returns true if the given plugin matches this group. |
98 bool Match(const WebPluginInfo& plugin) const; | 95 bool Match(const WebPluginInfo& plugin) const; |
99 | 96 |
100 // Adds the given plugin to this group. Provide the position of the | 97 // Adds the given plugin to this group. |
101 // plugin as given by PluginList so we can display its priority. | 98 // Retuns true if plugin has been added and false if it was already added. |
Bernhard Bauer
2010/12/17 18:50:59
Nit: "Returns true if the plugin has been added an
pastarmovj
2010/12/20 19:57:37
Done.
| |
102 void AddPlugin(const WebPluginInfo& plugin, int position); | 99 bool AddPlugin(const WebPluginInfo& plugin, int priority); |
jam
2010/12/17 19:14:45
can you document what priority is? although i don
| |
100 | |
101 bool EnablePlugin(const FilePath& filename); | |
jam
2010/12/17 19:14:45
comments please
pastarmovj
2010/12/20 19:57:37
Done.
| |
102 bool DisablePlugin(const FilePath& filename); | |
103 | 103 |
104 // Enables/disables this group. This enables/disables all plugins in the | 104 // Enables/disables this group. This enables/disables all plugins in the |
105 // group. | 105 // group. |
106 void Enable(bool enable); | 106 bool Enable(bool enable); |
jam
2010/12/17 19:14:45
nit: perhaps call this EnabledGroup to make it cle
pastarmovj
2010/12/20 19:57:37
Done.
| |
107 | |
108 // Refreshes the enabled flag based on the state of its plugins. | |
109 void RefreshEnabledState(); | |
Bernhard Bauer
2010/12/17 18:50:59
Can we make this private?
pastarmovj
2010/12/20 19:57:37
Done.
| |
107 | 110 |
108 // Returns whether the plugin group is enabled or not. | 111 // Returns whether the plugin group is enabled or not. |
109 bool Enabled() const { return enabled_; } | 112 bool Enabled() const { return enabled_; } |
110 | 113 |
111 // Returns a unique identifier for this group, if one is defined, or the empty | 114 // Returns a unique identifier for this group, if one is defined, or the empty |
112 // string otherwise. | 115 // string otherwise. |
113 const std::string& identifier() const { return identifier_; } | 116 const std::string& identifier() const { return identifier_; } |
114 | 117 |
115 // Returns this group's name, or the filename without extension if the name | 118 // Returns this group's name, or the filename without extension if the name |
116 // is empty. | 119 // is empty. |
117 string16 GetGroupName() const; | 120 string16 GetGroupName() const; |
118 | 121 |
122 const std::vector<WebPluginInfo>& GetPlugins() const; | |
123 | |
124 bool HasPlugin(const FilePath& path) const; | |
Bernhard Bauer
2010/12/17 18:50:59
Nit: Maybe ContainsPlugin?
pastarmovj
2010/12/20 19:57:37
Done.
| |
125 | |
119 // Returns the description of the highest-priority plug-in in the group. | 126 // Returns the description of the highest-priority plug-in in the group. |
120 const string16& description() const { return description_; } | 127 const string16& description() const { return description_; } |
121 | 128 |
122 // Returns a DictionaryValue with data to display in the UI. | 129 // Returns a DictionaryValue with data to display in the UI. |
123 DictionaryValue* GetDataForUI() const; | 130 DictionaryValue* GetDataForUI() const; |
124 | 131 |
125 // Returns a DictionaryValue with data to save in the preferences. | 132 // Returns a DictionaryValue with data to save in the preferences. |
126 DictionaryValue* GetSummary() const; | 133 DictionaryValue* GetSummary() const; |
127 | 134 |
128 // Returns the update URL. | 135 // Returns the update URL. |
(...skipping 28 matching lines...) Expand all Loading... | |
157 | 164 |
158 // Creates a PluginGroup from a PluginGroupDefinition. The caller takes | 165 // Creates a PluginGroup from a PluginGroupDefinition. The caller takes |
159 // ownership of the created PluginGroup. | 166 // ownership of the created PluginGroup. |
160 static PluginGroup* FromPluginGroupDefinition( | 167 static PluginGroup* FromPluginGroupDefinition( |
161 const PluginGroupDefinition& definition); | 168 const PluginGroupDefinition& definition); |
162 | 169 |
163 // Creates a PluginGroup from a WebPluginInfo. The caller takes ownership of | 170 // Creates a PluginGroup from a WebPluginInfo. The caller takes ownership of |
164 // the created PluginGroup. | 171 // the created PluginGroup. |
165 static PluginGroup* FromWebPluginInfo(const WebPluginInfo& wpi); | 172 static PluginGroup* FromWebPluginInfo(const WebPluginInfo& wpi); |
166 | 173 |
174 // Creates an empty PluginGroup from a given name. The caller takes | |
175 // ownership of the created PluginGroup. | |
176 static PluginGroup* CreateEmptyGroup(const string16& name); | |
177 | |
167 // Returns |true| if |version| is contained in [low, high) of |range|. | 178 // Returns |true| if |version| is contained in [low, high) of |range|. |
168 static bool IsVersionInRange(const Version& version, | 179 static bool IsVersionInRange(const Version& version, |
169 const VersionRange& range); | 180 const VersionRange& range); |
170 | 181 |
171 // Returns |true| iff |plugin_version| is both contained in |version_range| | 182 // Returns |true| iff |plugin_version| is both contained in |version_range| |
172 // and declared outdated (== vulnerable) by it. | 183 // and declared outdated (== vulnerable) by it. |
173 static bool IsPluginOutdated(const Version& plugin_version, | 184 static bool IsPluginOutdated(const Version& plugin_version, |
174 const VersionRange& version_range); | 185 const VersionRange& version_range); |
175 | 186 |
176 PluginGroup(const string16& group_name, | 187 PluginGroup(const string16& group_name, |
(...skipping 15 matching lines...) Expand all Loading... | |
192 | 203 |
193 std::string identifier_; | 204 std::string identifier_; |
194 string16 group_name_; | 205 string16 group_name_; |
195 string16 name_matcher_; | 206 string16 name_matcher_; |
196 string16 description_; | 207 string16 description_; |
197 std::string update_url_; | 208 std::string update_url_; |
198 bool enabled_; | 209 bool enabled_; |
199 std::vector<VersionRange> version_ranges_; | 210 std::vector<VersionRange> version_ranges_; |
200 scoped_ptr<Version> version_; | 211 scoped_ptr<Version> version_; |
201 std::vector<WebPluginInfo> web_plugin_infos_; | 212 std::vector<WebPluginInfo> web_plugin_infos_; |
202 std::vector<int> web_plugin_positions_; | |
203 }; | 213 }; |
204 | 214 |
205 #endif // WEBKIT_GLUE_PLUGINS_PLUGIN_GROUP_H_ | 215 #endif // WEBKIT_GLUE_PLUGINS_PLUGIN_GROUP_H_ |
OLD | NEW |