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> |
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 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 93 |
93 // Tests to see if a plugin is on the blacklist using its path as | 94 // Tests to see if a plugin is on the blacklist using its path as |
94 // the lookup key. | 95 // the lookup key. |
95 static bool IsPluginPathDisabledByPolicy(const FilePath& plugin_path); | 96 static bool IsPluginPathDisabledByPolicy(const FilePath& plugin_path); |
96 | 97 |
97 // Returns true if the given plugin matches this group. | 98 // Returns true if the given plugin matches this group. |
98 bool Match(const WebPluginInfo& plugin) const; | 99 bool Match(const WebPluginInfo& plugin) const; |
99 | 100 |
100 // Adds the given plugin to this group. Provide the position of the | 101 // Adds the given plugin to this group. Provide the position of the |
101 // plugin as given by PluginList so we can display its priority. | 102 // plugin as given by PluginList so we can display its priority. |
102 void AddPlugin(const WebPluginInfo& plugin, int position); | 103 // Retuns true if plugin has been added and false if it was already added. |
| 104 WebPluginInfo* AddPlugin(const WebPluginInfo& plugin, int position); |
| 105 |
| 106 // Returns a poitner to the plugin at the end of the |web_plugin_infos_| |
| 107 // array. |
| 108 std::list<WebPluginInfo>& GetPlugins(); |
| 109 |
| 110 // Returns the positions of the plugins in the group. |
| 111 std::vector<int>& GetPluginPositions(); |
103 | 112 |
104 // Enables/disables this group. This enables/disables all plugins in the | 113 // Enables/disables this group. This enables/disables all plugins in the |
105 // group. | 114 // group. |
106 void Enable(bool enable); | 115 void Enable(bool enable); |
107 | 116 |
| 117 // Refreshes the enabled flag based on the state of its plugins. |
| 118 void RefreshEnabledState(); |
| 119 |
108 // Returns whether the plugin group is enabled or not. | 120 // Returns whether the plugin group is enabled or not. |
109 bool Enabled() const { return enabled_; } | 121 bool Enabled() const { return enabled_; } |
110 | 122 |
111 // Returns a unique identifier for this group, if one is defined, or the empty | 123 // Returns a unique identifier for this group, if one is defined, or the empty |
112 // string otherwise. | 124 // string otherwise. |
113 const std::string& identifier() const { return identifier_; } | 125 const std::string& identifier() const { return identifier_; } |
114 | 126 |
115 // Returns this group's name, or the filename without extension if the name | 127 // Returns this group's name, or the filename without extension if the name |
116 // is empty. | 128 // is empty. |
117 string16 GetGroupName() const; | 129 string16 GetGroupName() const; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 static std::set<string16>* policy_disabled_plugin_patterns_; | 201 static std::set<string16>* policy_disabled_plugin_patterns_; |
190 | 202 |
191 std::string identifier_; | 203 std::string identifier_; |
192 string16 group_name_; | 204 string16 group_name_; |
193 string16 name_matcher_; | 205 string16 name_matcher_; |
194 string16 description_; | 206 string16 description_; |
195 std::string update_url_; | 207 std::string update_url_; |
196 bool enabled_; | 208 bool enabled_; |
197 std::vector<VersionRange> version_ranges_; | 209 std::vector<VersionRange> version_ranges_; |
198 scoped_ptr<Version> version_; | 210 scoped_ptr<Version> version_; |
199 std::vector<WebPluginInfo> web_plugin_infos_; | 211 std::list<WebPluginInfo> web_plugin_infos_; |
200 std::vector<int> web_plugin_positions_; | 212 std::vector<int> web_plugin_positions_; |
201 }; | 213 }; |
202 | 214 |
203 #endif // WEBKIT_GLUE_PLUGINS_PLUGIN_GROUP_H_ | 215 #endif // WEBKIT_GLUE_PLUGINS_PLUGIN_GROUP_H_ |
OLD | NEW |