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

Side by Side Diff: chrome/browser/content_settings/content_settings_policy_provider.cc

Issue 21030009: Make element removal methods in DictionaryValue and ListValue take scoped_ptr's as outparams. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 7 years, 4 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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 if (!value || !value->IsType(base::Value::TYPE_DICTIONARY)) { 342 if (!value || !value->IsType(base::Value::TYPE_DICTIONARY)) {
343 VLOG(1) << "Ignoring invalid certificate auto select setting. Reason:" 343 VLOG(1) << "Ignoring invalid certificate auto select setting. Reason:"
344 " Invalid JSON object: " << pattern_filter_json; 344 " Invalid JSON object: " << pattern_filter_json;
345 continue; 345 continue;
346 } 346 }
347 347
348 scoped_ptr<base::DictionaryValue> pattern_filter_pair( 348 scoped_ptr<base::DictionaryValue> pattern_filter_pair(
349 static_cast<base::DictionaryValue*>(value.release())); 349 static_cast<base::DictionaryValue*>(value.release()));
350 std::string pattern_str; 350 std::string pattern_str;
351 bool pattern_read = pattern_filter_pair->GetString("pattern", &pattern_str); 351 bool pattern_read = pattern_filter_pair->GetString("pattern", &pattern_str);
352 base::Value* cert_filter_ptr = NULL; 352 scoped_ptr<base::Value> cert_filter;
353 bool filter_read = pattern_filter_pair->Remove("filter", &cert_filter_ptr); 353 bool filter_read = pattern_filter_pair->Remove("filter", &cert_filter);
354 scoped_ptr<base::Value> cert_filter(cert_filter_ptr);
355 if (!pattern_read || !filter_read || 354 if (!pattern_read || !filter_read ||
356 !cert_filter->IsType(base::Value::TYPE_DICTIONARY)) { 355 !cert_filter->IsType(base::Value::TYPE_DICTIONARY)) {
357 VLOG(1) << "Ignoring invalid certificate auto select setting. Reason:" 356 VLOG(1) << "Ignoring invalid certificate auto select setting. Reason:"
358 " Missing pattern or filter."; 357 " Missing pattern or filter.";
359 continue; 358 continue;
360 } 359 }
361 360
362 ContentSettingsPattern pattern = 361 ContentSettingsPattern pattern =
363 ContentSettingsPattern::FromString(pattern_str); 362 ContentSettingsPattern::FromString(pattern_str);
364 // Ignore invalid patterns. 363 // Ignore invalid patterns.
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 ReadManagedDefaultSettings(); 483 ReadManagedDefaultSettings();
485 } 484 }
486 485
487 NotifyObservers(ContentSettingsPattern(), 486 NotifyObservers(ContentSettingsPattern(),
488 ContentSettingsPattern(), 487 ContentSettingsPattern(),
489 CONTENT_SETTINGS_TYPE_DEFAULT, 488 CONTENT_SETTINGS_TYPE_DEFAULT,
490 std::string()); 489 std::string());
491 } 490 }
492 491
493 } // namespace content_settings 492 } // namespace content_settings
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698