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

Side by Side Diff: components/content_settings/core/browser/content_settings_pref.cc

Issue 2853983002: Ensure settings returned from Content Settings providers are valid (Closed)
Patch Set: Ensure settings returned from Content Settings providers are valid Created 3 years, 7 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 "components/content_settings/core/browser/content_settings_pref.h" 5 #include "components/content_settings/core/browser/content_settings_pref.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/auto_reset.h" 9 #include "base/auto_reset.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 kPerResourceIdentifierPrefName, &resource_dictionary)) { 246 kPerResourceIdentifierPrefName, &resource_dictionary)) {
247 for (base::DictionaryValue::Iterator j(*resource_dictionary); 247 for (base::DictionaryValue::Iterator j(*resource_dictionary);
248 !j.IsAtEnd(); 248 !j.IsAtEnd();
249 j.Advance()) { 249 j.Advance()) {
250 const std::string& resource_identifier(j.key()); 250 const std::string& resource_identifier(j.key());
251 int setting = CONTENT_SETTING_DEFAULT; 251 int setting = CONTENT_SETTING_DEFAULT;
252 bool is_integer = j.value().GetAsInteger(&setting); 252 bool is_integer = j.value().GetAsInteger(&setting);
253 DCHECK(is_integer); 253 DCHECK(is_integer);
254 DCHECK_NE(CONTENT_SETTING_DEFAULT, setting); 254 DCHECK_NE(CONTENT_SETTING_DEFAULT, setting);
255 std::unique_ptr<base::Value> setting_ptr(new base::Value(setting)); 255 std::unique_ptr<base::Value> setting_ptr(new base::Value(setting));
256 DCHECK(IsValueAllowedForType(setting_ptr.get(), content_type_));
msramek 2017/05/03 20:05:42 I'm slightly uncomfortable about this, since the u
raymes 2017/05/04 05:49:15 I agree - it could just be an annoyance. But we we
256 value_map_.SetValue(pattern_pair.first, 257 value_map_.SetValue(pattern_pair.first,
257 pattern_pair.second, 258 pattern_pair.second,
258 content_type_, 259 content_type_,
259 resource_identifier, 260 resource_identifier,
260 setting_ptr->DeepCopy()); 261 setting_ptr->DeepCopy());
261 } 262 }
262 } 263 }
263 } 264 }
264 265
265 const base::Value* value = nullptr; 266 const base::Value* value = nullptr;
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 446
446 void ContentSettingsPref::AssertLockNotHeld() const { 447 void ContentSettingsPref::AssertLockNotHeld() const {
447 #if !defined(NDEBUG) 448 #if !defined(NDEBUG)
448 // |Lock::Acquire()| will assert if the lock is held by this thread. 449 // |Lock::Acquire()| will assert if the lock is held by this thread.
449 lock_.Acquire(); 450 lock_.Acquire();
450 lock_.Release(); 451 lock_.Release();
451 #endif 452 #endif
452 } 453 }
453 454
454 } // namespace content_settings 455 } // namespace content_settings
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698