Chromium Code Reviews| 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/plugins/plugin_prefs.h" | 5 #include "chrome/browser/plugins/plugin_prefs.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 129 ListPrefUpdate update(prefs_, prefs::kPluginsPluginsList); | 129 ListPrefUpdate update(prefs_, prefs::kPluginsPluginsList); |
| 130 base::ListValue* saved_plugins_list = update.Get(); | 130 base::ListValue* saved_plugins_list = update.Get(); |
| 131 if (saved_plugins_list && !saved_plugins_list->empty()) { | 131 if (saved_plugins_list && !saved_plugins_list->empty()) { |
| 132 for (auto& plugin_value : *saved_plugins_list) { | 132 for (auto& plugin_value : *saved_plugins_list) { |
| 133 base::DictionaryValue* plugin; | 133 base::DictionaryValue* plugin; |
| 134 if (!plugin_value.GetAsDictionary(&plugin)) { | 134 if (!plugin_value.GetAsDictionary(&plugin)) { |
| 135 LOG(WARNING) << "Invalid entry in " << prefs::kPluginsPluginsList; | 135 LOG(WARNING) << "Invalid entry in " << prefs::kPluginsPluginsList; |
| 136 continue; // Oops, don't know what to do with this item. | 136 continue; // Oops, don't know what to do with this item. |
| 137 } | 137 } |
| 138 | 138 |
| 139 bool enabled; | 139 bool enabled; |
|
Bernhard Bauer
2017/04/25 14:15:37
I would simplify this to:
bool enabled = true;
pastarmovj
2017/04/26 07:26:38
Done.
| |
| 140 if (!plugin->GetBoolean("enabled", &enabled)) | 140 if (!plugin->GetBoolean("enabled", &enabled)) |
| 141 enabled = true; | 141 enabled = true; |
| 142 else | |
| 143 plugin->Remove("enabled", nullptr); | |
| 142 | 144 |
| 143 // Migrate disabled plugins and re-enable them all internally. | 145 // Migrate disabled plugins and re-enable them all internally. |
| 144 // TODO(http://crbug.com/662006): Remove migration eventually. | 146 // TODO(http://crbug.com/662006): Remove migration eventually. |
| 145 if (!enabled) { | 147 if (!enabled) { |
| 146 base::string16 name; | 148 base::string16 name; |
| 147 plugin->GetString("name", &name); | 149 plugin->GetString("name", &name); |
| 148 if (IsPDFViewerPlugin(name)) | 150 if (IsPDFViewerPlugin(name)) |
| 149 prefs->SetBoolean(prefs::kPluginsAlwaysOpenPdfExternally, true); | 151 prefs->SetBoolean(prefs::kPluginsAlwaysOpenPdfExternally, true); |
| 150 if (IsAdobeFlashPlayerPlugin(name)) { | 152 if (IsAdobeFlashPlayerPlugin(name)) { |
| 151 HostContentSettingsMapFactory::GetForProfile(profile_) | 153 HostContentSettingsMapFactory::GetForProfile(profile_) |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 282 } | 284 } |
| 283 } | 285 } |
| 284 | 286 |
| 285 void PluginPrefs::NotifyPluginStatusChanged() { | 287 void PluginPrefs::NotifyPluginStatusChanged() { |
| 286 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 288 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 287 content::NotificationService::current()->Notify( | 289 content::NotificationService::current()->Notify( |
| 288 chrome::NOTIFICATION_PLUGIN_ENABLE_STATUS_CHANGED, | 290 chrome::NOTIFICATION_PLUGIN_ENABLE_STATUS_CHANGED, |
| 289 content::Source<Profile>(profile_), | 291 content::Source<Profile>(profile_), |
| 290 content::NotificationService::NoDetails()); | 292 content::NotificationService::NoDetails()); |
| 291 } | 293 } |
| OLD | NEW |