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

Side by Side Diff: chrome/browser/dom_ui/plugins_ui.cc

Issue 5699005: Policy: Re-enabled plugin still disabled (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Make windows compiler even happier. Created 10 years 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 #include "chrome/browser/dom_ui/plugins_ui.h" 5 #include "chrome/browser/dom_ui/plugins_ui.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 NewCallback(this, &PluginsDOMHandler::HandleShowTermsOfServiceMessage)); 198 NewCallback(this, &PluginsDOMHandler::HandleShowTermsOfServiceMessage));
199 } 199 }
200 200
201 void PluginsDOMHandler::HandleRequestPluginsData(const ListValue* args) { 201 void PluginsDOMHandler::HandleRequestPluginsData(const ListValue* args) {
202 LoadPlugins(); 202 LoadPlugins();
203 } 203 }
204 204
205 void PluginsDOMHandler::HandleEnablePluginMessage(const ListValue* args) { 205 void PluginsDOMHandler::HandleEnablePluginMessage(const ListValue* args) {
206 // Be robust in accepting badness since plug-ins display HTML (hence 206 // Be robust in accepting badness since plug-ins display HTML (hence
207 // JavaScript). 207 // JavaScript).
208 if (args->GetSize() != 3) 208 if (args->GetSize() != 4)
209 return; 209 return;
210 210
211 std::string enable_str; 211 std::string enable_str;
212 std::string is_group_str; 212 std::string is_group_str;
213 if (!args->GetString(1, &enable_str) || !args->GetString(2, &is_group_str)) 213 if (!args->GetString(2, &enable_str) || !args->GetString(3, &is_group_str))
214 return; 214 return;
215 bool enable = enable_str == "true"; 215 bool enable = enable_str == "true";
216 216
217 PluginUpdater* plugin_updater = PluginUpdater::GetInstance(); 217 PluginUpdater* plugin_updater = PluginUpdater::GetInstance();
218 if (is_group_str == "true") { 218 if (is_group_str == "true") {
219 string16 group_name; 219 string16 group_name;
220 if (!args->GetString(0, &group_name)) 220 if (!args->GetString(0, &group_name))
221 return; 221 return;
222 222
223 plugin_updater->EnablePluginGroup(enable, group_name); 223 plugin_updater->EnablePluginGroup(enable, group_name);
224 if (enable) { 224 if (enable) {
225 // See http://crbug.com/50105 for background. 225 // See http://crbug.com/50105 for background.
226 string16 adobereader = ASCIIToUTF16(PluginGroup::kAdobeReaderGroupName); 226 string16 adobereader = ASCIIToUTF16(PluginGroup::kAdobeReaderGroupName);
227 string16 internalpdf = ASCIIToUTF16(PepperPluginRegistry::kPDFPluginName); 227 string16 internalpdf = ASCIIToUTF16(PepperPluginRegistry::kPDFPluginName);
228 if (group_name == adobereader) { 228 if (group_name == adobereader) {
229 plugin_updater->EnablePluginGroup(false, internalpdf); 229 plugin_updater->EnablePluginGroup(false, internalpdf);
230 } else if (group_name == internalpdf) { 230 } else if (group_name == internalpdf) {
231 plugin_updater->EnablePluginGroup(false, adobereader); 231 plugin_updater->EnablePluginGroup(false, adobereader);
232 } 232 }
233 } 233 }
234 } else { 234 } else {
235 string16 name;
235 FilePath::StringType file_path; 236 FilePath::StringType file_path;
236 if (!args->GetString(0, &file_path)) 237 if (!args->GetString(0, &file_path) || !args->GetString(1, &name))
237 return; 238 return;
238 239
239 plugin_updater->EnablePluginFile(enable, file_path); 240 plugin_updater->EnablePlugin(enable, file_path, name);
240 } 241 }
241 242
242 // TODO(viettrungluu): We might also want to ensure that the plugins 243 // TODO(viettrungluu): We might also want to ensure that the plugins
243 // list is always written to prefs even when the user hasn't disabled a 244 // list is always written to prefs even when the user hasn't disabled a
244 // plugin. <http://crbug.com/39101> 245 // plugin. <http://crbug.com/39101>
245 plugin_updater->UpdatePreferences(dom_ui_->GetProfile(), 0); 246 plugin_updater->UpdatePreferences(dom_ui_->GetProfile(), 0);
246 } 247 }
247 248
248 void PluginsDOMHandler::HandleShowTermsOfServiceMessage(const ListValue* args) { 249 void PluginsDOMHandler::HandleShowTermsOfServiceMessage(const ListValue* args) {
249 // Show it in a new browser window.... 250 // Show it in a new browser window....
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 void PluginsUI::RegisterUserPrefs(PrefService* prefs) { 331 void PluginsUI::RegisterUserPrefs(PrefService* prefs) {
331 FilePath internal_dir; 332 FilePath internal_dir;
332 PathService::Get(chrome::DIR_INTERNAL_PLUGINS, &internal_dir); 333 PathService::Get(chrome::DIR_INTERNAL_PLUGINS, &internal_dir);
333 prefs->RegisterFilePathPref(prefs::kPluginsLastInternalDirectory, 334 prefs->RegisterFilePathPref(prefs::kPluginsLastInternalDirectory,
334 internal_dir); 335 internal_dir);
335 336
336 prefs->RegisterListPref(prefs::kPluginsPluginsBlacklist); 337 prefs->RegisterListPref(prefs::kPluginsPluginsBlacklist);
337 prefs->RegisterListPref(prefs::kPluginsPluginsList); 338 prefs->RegisterListPref(prefs::kPluginsPluginsList);
338 prefs->RegisterBooleanPref(prefs::kPluginsEnabledInternalPDF, false); 339 prefs->RegisterBooleanPref(prefs::kPluginsEnabledInternalPDF, false);
339 } 340 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698