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

Side by Side Diff: chrome/browser/plugin_prefs.h

Issue 10910168: Separate plugin_metadata from plugin_installer, thread-safe plugin_finder (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: .. Created 8 years, 3 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_BROWSER_PLUGIN_PREFS_H_ 5 #ifndef CHROME_BROWSER_PLUGIN_PREFS_H_
6 #define CHROME_BROWSER_PLUGIN_PREFS_H_ 6 #define CHROME_BROWSER_PLUGIN_PREFS_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 const std::set<string16>& disabled_exception_patterns, 112 const std::set<string16>& disabled_exception_patterns,
113 const std::set<string16>& enabled_patterns); 113 const std::set<string16>& enabled_patterns);
114 114
115 // Returns the plugin list to use, either the singleton or the override. 115 // Returns the plugin list to use, either the singleton or the override.
116 webkit::npapi::PluginList* GetPluginList() const; 116 webkit::npapi::PluginList* GetPluginList() const;
117 117
118 // Callback for after the plugin groups have been loaded. 118 // Callback for after the plugin groups have been loaded.
119 void EnablePluginGroupInternal( 119 void EnablePluginGroupInternal(
120 bool enabled, 120 bool enabled,
121 const string16& group_name, 121 const string16& group_name,
122 PluginFinder* plugin_finder,
123 const std::vector<webkit::WebPluginInfo>& plugins); 122 const std::vector<webkit::WebPluginInfo>& plugins);
124 void EnablePluginInternal( 123 void EnablePluginInternal(
125 bool enabled, 124 bool enabled,
126 const FilePath& path, 125 const FilePath& path,
127 PluginFinder* plugin_finder, 126 PluginFinder* plugin_finder,
128 const base::Callback<void(bool)>& callback, 127 const base::Callback<void(bool)>& callback,
129 const std::vector<webkit::WebPluginInfo>& plugins); 128 const std::vector<webkit::WebPluginInfo>& plugins);
130 129
131 // Called on the file thread to get the data necessary to update the saved 130 // Called on the file thread to get the data necessary to update the saved
132 // preferences. 131 // preferences.
133 void GetPreferencesDataOnFileThread(); 132 void GetPreferencesDataOnFileThread();
134 133
135 // Called on the UI thread with the plugin data to save the preferences. 134 // Called on the UI thread with the plugin data to save the preferences.
136 void OnUpdatePreferences(const std::vector<webkit::WebPluginInfo>& plugins, 135 void OnUpdatePreferences(const std::vector<webkit::WebPluginInfo>& plugins);
137 PluginFinder* finder);
138 136
139 // Sends the notification that plugin data has changed. 137 // Sends the notification that plugin data has changed.
140 void NotifyPluginStatusChanged(); 138 void NotifyPluginStatusChanged();
141 139
142 static void ListValueToStringSet(const base::ListValue* src, 140 static void ListValueToStringSet(const base::ListValue* src,
143 std::set<string16>* dest); 141 std::set<string16>* dest);
144 142
145 // Checks if |name| matches any of the patterns in |pattern_set|. 143 // Checks if |name| matches any of the patterns in |pattern_set|.
146 static bool IsStringMatchedInSet(const string16& name, 144 static bool IsStringMatchedInSet(const string16& name,
147 const std::set<string16>& pattern_set); 145 const std::set<string16>& pattern_set);
148 146
149 // Callback method called by 'EnablePlugin' method.
150 // It performs the logic to check if a plug-in can be enabled.
151 void EnablePluginIfPossibleCallback(
152 bool enabled, const FilePath& path,
153 const base::Callback<void(bool)>& canEnableCallback,
154 PluginFinder* finder);
155
156 // Callback method that takes in the asynchronously created
157 // plug-in finder instance. It is called by 'EnablePluginGroup'.
158 void GetPluginFinderForEnablePluginGroup(bool enabled,
159 const string16& group_name,
160 PluginFinder* finder);
161
162 // Callback method that takes in the asynchronously created plug-in finder
163 // instance. It is called by 'GetPreferencesDataOnFileThread'.
164 void GetPluginFinderForGetPreferencesDataOnFileThread(PluginFinder* finder);
165
166 // Guards access to the following data structures. 147 // Guards access to the following data structures.
167 mutable base::Lock lock_; 148 mutable base::Lock lock_;
168 149
169 std::map<FilePath, bool> plugin_state_; 150 std::map<FilePath, bool> plugin_state_;
170 std::map<string16, bool> plugin_group_state_; 151 std::map<string16, bool> plugin_group_state_;
171 152
172 std::set<string16> policy_disabled_plugin_patterns_; 153 std::set<string16> policy_disabled_plugin_patterns_;
173 std::set<string16> policy_disabled_plugin_exception_patterns_; 154 std::set<string16> policy_disabled_plugin_exception_patterns_;
174 std::set<string16> policy_enabled_plugin_patterns_; 155 std::set<string16> policy_enabled_plugin_patterns_;
175 156
176 // Weak pointer, owns us. Only used as a notification source. 157 // Weak pointer, owns us. Only used as a notification source.
177 Profile* profile_; 158 Profile* profile_;
178 159
179 // Weak pointer, owned by the profile. 160 // Weak pointer, owned by the profile.
180 PrefService* prefs_; 161 PrefService* prefs_;
181 162
182 // PluginList to use for testing. If this is NULL, defaults to the global 163 // PluginList to use for testing. If this is NULL, defaults to the global
183 // singleton. 164 // singleton.
184 webkit::npapi::PluginList* plugin_list_; 165 webkit::npapi::PluginList* plugin_list_;
185 166
186 PrefChangeRegistrar registrar_; 167 PrefChangeRegistrar registrar_;
187 168
188 DISALLOW_COPY_AND_ASSIGN(PluginPrefs); 169 DISALLOW_COPY_AND_ASSIGN(PluginPrefs);
189 }; 170 };
190 171
191 #endif // CHROME_BROWSER_PLUGIN_PREFS_H_ 172 #endif // CHROME_BROWSER_PLUGIN_PREFS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698