OLD | NEW |
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 #include "chrome/browser/ui/webui/plugins_ui.h" | 5 #include "chrome/browser/ui/webui/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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
231 } | 231 } |
232 | 232 |
233 std::string enable_str; | 233 std::string enable_str; |
234 std::string is_group_str; | 234 std::string is_group_str; |
235 if (!args->GetString(1, &enable_str) || !args->GetString(2, &is_group_str)) { | 235 if (!args->GetString(1, &enable_str) || !args->GetString(2, &is_group_str)) { |
236 NOTREACHED(); | 236 NOTREACHED(); |
237 return; | 237 return; |
238 } | 238 } |
239 bool enable = enable_str == "true"; | 239 bool enable = enable_str == "true"; |
240 | 240 |
241 PluginPrefs* plugin_prefs = PluginPrefs::GetForProfile(profile); | 241 PluginPrefs* plugin_prefs = PluginPrefs::GetForProfile(profile).get(); |
242 if (is_group_str == "true") { | 242 if (is_group_str == "true") { |
243 string16 group_name; | 243 string16 group_name; |
244 if (!args->GetString(0, &group_name)) { | 244 if (!args->GetString(0, &group_name)) { |
245 NOTREACHED(); | 245 NOTREACHED(); |
246 return; | 246 return; |
247 } | 247 } |
248 | 248 |
249 plugin_prefs->EnablePluginGroup(enable, group_name); | 249 plugin_prefs->EnablePluginGroup(enable, group_name); |
250 if (enable) { | 250 if (enable) { |
251 // See http://crbug.com/50105 for background. | 251 // See http://crbug.com/50105 for background. |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
324 return; | 324 return; |
325 | 325 |
326 PluginService::GetInstance()->GetPlugins( | 326 PluginService::GetInstance()->GetPlugins( |
327 base::Bind(&PluginsDOMHandler::PluginsLoaded, | 327 base::Bind(&PluginsDOMHandler::PluginsLoaded, |
328 weak_ptr_factory_.GetWeakPtr())); | 328 weak_ptr_factory_.GetWeakPtr())); |
329 } | 329 } |
330 | 330 |
331 void PluginsDOMHandler::PluginsLoaded( | 331 void PluginsDOMHandler::PluginsLoaded( |
332 const std::vector<webkit::WebPluginInfo>& plugins) { | 332 const std::vector<webkit::WebPluginInfo>& plugins) { |
333 Profile* profile = Profile::FromWebUI(web_ui()); | 333 Profile* profile = Profile::FromWebUI(web_ui()); |
334 PluginPrefs* plugin_prefs = PluginPrefs::GetForProfile(profile); | 334 PluginPrefs* plugin_prefs = PluginPrefs::GetForProfile(profile).get(); |
335 | 335 |
336 ContentSettingsPattern wildcard = ContentSettingsPattern::Wildcard(); | 336 ContentSettingsPattern wildcard = ContentSettingsPattern::Wildcard(); |
337 | 337 |
338 PluginFinder* plugin_finder = PluginFinder::GetInstance(); | 338 PluginFinder* plugin_finder = PluginFinder::GetInstance(); |
339 // Group plug-ins by identifier. This is done to be able to display | 339 // Group plug-ins by identifier. This is done to be able to display |
340 // the plug-ins in UI in a grouped fashion. | 340 // the plug-ins in UI in a grouped fashion. |
341 PluginGroups groups; | 341 PluginGroups groups; |
342 for (size_t i = 0; i < plugins.size(); ++i) { | 342 for (size_t i = 0; i < plugins.size(); ++i) { |
343 scoped_ptr<PluginMetadata> plugin( | 343 scoped_ptr<PluginMetadata> plugin( |
344 plugin_finder->GetPluginMetadata(plugins[i])); | 344 plugin_finder->GetPluginMetadata(plugins[i])); |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 // static | 493 // static |
494 void PluginsUI::RegisterUserPrefs(user_prefs::PrefRegistrySyncable* registry) { | 494 void PluginsUI::RegisterUserPrefs(user_prefs::PrefRegistrySyncable* registry) { |
495 registry->RegisterBooleanPref( | 495 registry->RegisterBooleanPref( |
496 prefs::kPluginsShowDetails, | 496 prefs::kPluginsShowDetails, |
497 false, | 497 false, |
498 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); | 498 user_prefs::PrefRegistrySyncable::UNSYNCABLE_PREF); |
499 registry->RegisterDictionaryPref( | 499 registry->RegisterDictionaryPref( |
500 prefs::kContentSettingsPluginWhitelist, | 500 prefs::kContentSettingsPluginWhitelist, |
501 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); | 501 user_prefs::PrefRegistrySyncable::SYNCABLE_PREF); |
502 } | 502 } |
OLD | NEW |