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

Side by Side Diff: chrome/browser/content_settings/content_settings_policy_provider.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/content_settings/content_settings_policy_provider.h" 5 #include "chrome/browser/content_settings/content_settings_policy_provider.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/json/json_reader.h" 10 #include "base/json/json_reader.h"
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 // } 296 // }
297 // } 297 // }
298 // } 298 // }
299 for (size_t j = 0; j < pattern_filter_str_list->GetSize(); ++j) { 299 for (size_t j = 0; j < pattern_filter_str_list->GetSize(); ++j) {
300 std::string pattern_filter_json; 300 std::string pattern_filter_json;
301 if (!pattern_filter_str_list->GetString(j, &pattern_filter_json)) { 301 if (!pattern_filter_str_list->GetString(j, &pattern_filter_json)) {
302 NOTREACHED(); 302 NOTREACHED();
303 continue; 303 continue;
304 } 304 }
305 305
306 scoped_ptr<base::Value> value( 306 scoped_ptr<base::Value> value(base::JSONReader::Read(pattern_filter_json,
307 base::JSONReader::Read(pattern_filter_json, true)); 307 base::JSON_ALLOW_TRAILING_COMMAS));
308 if (!value.get()) { 308 if (!value.get()) {
309 VLOG(1) << "Ignoring invalid certificate auto select setting. Reason:" 309 VLOG(1) << "Ignoring invalid certificate auto select setting. Reason:"
310 " Invalid JSON format: " << pattern_filter_json; 310 " Invalid JSON format: " << pattern_filter_json;
311 continue; 311 continue;
312 } 312 }
313 313
314 scoped_ptr<base::DictionaryValue> pattern_filter_pair( 314 scoped_ptr<base::DictionaryValue> pattern_filter_pair(
315 static_cast<base::DictionaryValue*>(value.release())); 315 static_cast<base::DictionaryValue*>(value.release()));
316 std::string pattern_str; 316 std::string pattern_str;
317 bool pattern_read = pattern_filter_pair->GetString("pattern", &pattern_str); 317 bool pattern_read = pattern_filter_pair->GetString("pattern", &pattern_str);
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 NOTREACHED() << "Unexpected notification"; 456 NOTREACHED() << "Unexpected notification";
457 return; 457 return;
458 } 458 }
459 NotifyObservers(ContentSettingsPattern(), 459 NotifyObservers(ContentSettingsPattern(),
460 ContentSettingsPattern(), 460 ContentSettingsPattern(),
461 CONTENT_SETTINGS_TYPE_DEFAULT, 461 CONTENT_SETTINGS_TYPE_DEFAULT,
462 std::string()); 462 std::string());
463 } 463 }
464 464
465 } // namespace content_settings 465 } // namespace content_settings
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698