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

Side by Side Diff: chrome/browser/plugins/plugin_prefs.cc

Issue 2000803003: Use std::unique_ptr for base::DictionaryValue and base::ListValue's internal store. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More fixes Created 4 years, 6 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 #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 315 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 cur_internal_dir != last_internal_dir) { 326 cur_internal_dir != last_internal_dir) {
327 update_internal_dir = true; 327 update_internal_dir = true;
328 prefs_->SetFilePath( 328 prefs_->SetFilePath(
329 prefs::kPluginsLastInternalDirectory, cur_internal_dir); 329 prefs::kPluginsLastInternalDirectory, cur_internal_dir);
330 } 330 }
331 331
332 { // Scoped update of prefs::kPluginsPluginsList. 332 { // Scoped update of prefs::kPluginsPluginsList.
333 ListPrefUpdate update(prefs_, prefs::kPluginsPluginsList); 333 ListPrefUpdate update(prefs_, prefs::kPluginsPluginsList);
334 base::ListValue* saved_plugins_list = update.Get(); 334 base::ListValue* saved_plugins_list = update.Get();
335 if (saved_plugins_list && !saved_plugins_list->empty()) { 335 if (saved_plugins_list && !saved_plugins_list->empty()) {
336 for (base::Value* plugin_value : *saved_plugins_list) { 336 for (const auto& plugin_value : *saved_plugins_list) {
337 if (!plugin_value->IsType(base::Value::TYPE_DICTIONARY)) { 337 base::DictionaryValue* plugin;
338 if (!plugin_value->GetAsDictionary(&plugin)) {
338 LOG(WARNING) << "Invalid entry in " << prefs::kPluginsPluginsList; 339 LOG(WARNING) << "Invalid entry in " << prefs::kPluginsPluginsList;
339 continue; // Oops, don't know what to do with this item. 340 continue; // Oops, don't know what to do with this item.
340 } 341 }
341 342
342 base::DictionaryValue* plugin =
343 static_cast<base::DictionaryValue*>(plugin_value);
344 base::string16 group_name; 343 base::string16 group_name;
345 bool enabled; 344 bool enabled;
346 if (!plugin->GetBoolean("enabled", &enabled)) 345 if (!plugin->GetBoolean("enabled", &enabled))
347 enabled = true; 346 enabled = true;
348 347
349 base::FilePath::StringType path; 348 base::FilePath::StringType path;
350 // The plugin list constains all the plugin files in addition to the 349 // The plugin list constains all the plugin files in addition to the
351 // plugin groups. 350 // plugin groups.
352 if (plugin->GetString("path", &path)) { 351 if (plugin->GetString("path", &path)) {
353 // Files have a path attribute, groups don't. 352 // Files have a path attribute, groups don't.
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 } 511 }
513 } 512 }
514 513
515 void PluginPrefs::NotifyPluginStatusChanged() { 514 void PluginPrefs::NotifyPluginStatusChanged() {
516 DCHECK_CURRENTLY_ON(BrowserThread::UI); 515 DCHECK_CURRENTLY_ON(BrowserThread::UI);
517 content::NotificationService::current()->Notify( 516 content::NotificationService::current()->Notify(
518 chrome::NOTIFICATION_PLUGIN_ENABLE_STATUS_CHANGED, 517 chrome::NOTIFICATION_PLUGIN_ENABLE_STATUS_CHANGED,
519 content::Source<Profile>(profile_), 518 content::Source<Profile>(profile_),
520 content::NotificationService::NoDetails()); 519 content::NotificationService::NoDetails());
521 } 520 }
OLDNEW
« no previous file with comments | « chrome/browser/permissions/chooser_context_base.cc ('k') | chrome/browser/policy/managed_bookmarks_policy_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698