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

Side by Side Diff: chrome/browser/ui/webui/options/core_options_handler.cc

Issue 2051663003: base::ListValue::Append cleanup: pass unique_ptr instead of the released pointer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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/ui/webui/options/core_options_handler.h" 5 #include "chrome/browser/ui/webui/options/core_options_handler.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 } 351 }
352 352
353 void CoreOptionsHandler::DispatchPrefChangeNotification( 353 void CoreOptionsHandler::DispatchPrefChangeNotification(
354 const std::string& name, 354 const std::string& name,
355 std::unique_ptr<base::Value> value) { 355 std::unique_ptr<base::Value> value) {
356 std::pair<PreferenceCallbackMap::const_iterator, 356 std::pair<PreferenceCallbackMap::const_iterator,
357 PreferenceCallbackMap::const_iterator> range = 357 PreferenceCallbackMap::const_iterator> range =
358 pref_callback_map_.equal_range(name); 358 pref_callback_map_.equal_range(name);
359 base::ListValue result_value; 359 base::ListValue result_value;
360 result_value.AppendString(name); 360 result_value.AppendString(name);
361 result_value.Append(value.release()); 361 result_value.Append(std::move(value));
362 for (PreferenceCallbackMap::const_iterator iter = range.first; 362 for (PreferenceCallbackMap::const_iterator iter = range.first;
363 iter != range.second; ++iter) { 363 iter != range.second; ++iter) {
364 const std::string& callback_function = iter->second; 364 const std::string& callback_function = iter->second;
365 web_ui()->CallJavascriptFunctionUnsafe(callback_function, result_value); 365 web_ui()->CallJavascriptFunctionUnsafe(callback_function, result_value);
366 } 366 }
367 } 367 }
368 368
369 base::Value* CoreOptionsHandler::CreateValueForPref( 369 base::Value* CoreOptionsHandler::CreateValueForPref(
370 const std::string& pref_name, 370 const std::string& pref_name,
371 const std::string& controlling_pref_name) { 371 const std::string& controlling_pref_name) {
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 plugin_status_pref_setter_.IsPepperFlashSettingsEnabled()); 657 plugin_status_pref_setter_.IsPepperFlashSettingsEnabled());
658 web_ui()->CallJavascriptFunctionUnsafe( 658 web_ui()->CallJavascriptFunctionUnsafe(
659 "options.OptionsPage.setPepperFlashSettingsEnabled", enabled); 659 "options.OptionsPage.setPepperFlashSettingsEnabled", enabled);
660 } 660 }
661 661
662 bool CoreOptionsHandler::IsUserUnsupervised(const base::Value* to_value) { 662 bool CoreOptionsHandler::IsUserUnsupervised(const base::Value* to_value) {
663 return !Profile::FromWebUI(web_ui())->IsSupervised(); 663 return !Profile::FromWebUI(web_ui())->IsSupervised();
664 } 664 }
665 665
666 } // namespace options 666 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698