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

Side by Side Diff: chrome/browser/ui/webui/options2/core_options_handler2.cc

Issue 9960077: Modify the base::JSONReader interface to take a set of options rather than a boolean flag. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 8 years, 8 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 | Annotate | Revision Log
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/options2/core_options_handler2.h" 5 #include "chrome/browser/ui/webui/options2/core_options_handler2.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/json/json_reader.h" 9 #include "base/json/json_reader.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 GURL fixed = URLFixerUpper::FixupURL(original, std::string()); 409 GURL fixed = URLFixerUpper::FixupURL(original, std::string());
410 temp_value.reset(base::Value::CreateStringValue(fixed.spec())); 410 temp_value.reset(base::Value::CreateStringValue(fixed.spec()));
411 value = temp_value.get(); 411 value = temp_value.get();
412 break; 412 break;
413 } 413 }
414 case TYPE_LIST: { 414 case TYPE_LIST: {
415 // In case we have a List pref we got a JSON string. 415 // In case we have a List pref we got a JSON string.
416 std::string json_string; 416 std::string json_string;
417 CHECK(value->GetAsString(&json_string)); 417 CHECK(value->GetAsString(&json_string));
418 temp_value.reset( 418 temp_value.reset(
419 base::JSONReader().JsonToValue(json_string, 419 base::JSONReader::Read(json_string));
420 false, // no check_root
421 false)); // no trailing comma
422 value = temp_value.get(); 420 value = temp_value.get();
423 CHECK_EQ(base::Value::TYPE_LIST, value->GetType()); 421 CHECK_EQ(base::Value::TYPE_LIST, value->GetType());
424 break; 422 break;
425 } 423 }
426 default: 424 default:
427 NOTREACHED(); 425 NOTREACHED();
428 } 426 }
429 427
430 std::string metric; 428 std::string metric;
431 if (args->GetSize() > 2 && !args->GetString(2, &metric)) 429 if (args->GetSize() > 2 && !args->GetString(2, &metric))
(...skipping 25 matching lines...) Expand all
457 455
458 void CoreOptionsHandler::UpdateClearPluginLSOData() { 456 void CoreOptionsHandler::UpdateClearPluginLSOData() {
459 scoped_ptr<base::Value> enabled( 457 scoped_ptr<base::Value> enabled(
460 base::Value::CreateBooleanValue( 458 base::Value::CreateBooleanValue(
461 clear_plugin_lso_data_enabled_.GetValue())); 459 clear_plugin_lso_data_enabled_.GetValue()));
462 web_ui()->CallJavascriptFunction( 460 web_ui()->CallJavascriptFunction(
463 "OptionsPage.setClearPluginLSODataEnabled", *enabled); 461 "OptionsPage.setClearPluginLSODataEnabled", *enabled);
464 } 462 }
465 463
466 } // namespace options2 464 } // namespace options2
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698