| OLD | NEW |
| 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_pref_provider.h" | 5 #include "chrome/browser/content_settings/content_settings_pref_provider.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 resource_identifier, &setting); | 354 resource_identifier, &setting); |
| 355 DCHECK_NE(CONTENT_SETTING_DEFAULT, setting); | 355 DCHECK_NE(CONTENT_SETTING_DEFAULT, setting); |
| 356 value_map_.SetValue(pattern_pair.first, | 356 value_map_.SetValue(pattern_pair.first, |
| 357 pattern_pair.second, | 357 pattern_pair.second, |
| 358 content_type, | 358 content_type, |
| 359 resource_identifier, | 359 resource_identifier, |
| 360 Value::CreateIntegerValue(setting)); | 360 Value::CreateIntegerValue(setting)); |
| 361 } | 361 } |
| 362 } | 362 } |
| 363 } | 363 } |
| 364 int setting = CONTENT_SETTING_DEFAULT; | 364 if (content_type == CONTENT_SETTINGS_TYPE_MEDIASTREAM) { |
| 365 if (settings_dictionary->GetIntegerWithoutPathExpansion( | 365 // MediaStream is using compound type as value. |
| 366 GetTypeName(ContentSettingsType(i)), &setting)) { | 366 Value* value; |
| 367 DCHECK_NE(CONTENT_SETTING_DEFAULT, setting); | 367 if (settings_dictionary->GetWithoutPathExpansion( |
| 368 setting = FixObsoleteCookiePromptMode(content_type, | 368 GetTypeName(ContentSettingsType(i)), &value)) { |
| 369 ContentSetting(setting)); | 369 if (value->IsType(Value::TYPE_DICTIONARY)) { |
| 370 value_map_.SetValue(pattern_pair.first, | 370 DictionaryValue* setting = NULL; |
| 371 pattern_pair.second, | 371 if (settings_dictionary->GetDictionaryWithoutPathExpansion( |
| 372 content_type, | 372 GetTypeName(ContentSettingsType(i)), &setting)) { |
| 373 ResourceIdentifier(""), | 373 DCHECK(!setting->empty()); |
| 374 Value::CreateIntegerValue(setting)); | 374 value_map_.SetValue(pattern_pair.first, |
| 375 pattern_pair.second, |
| 376 content_type, |
| 377 ResourceIdentifier(""), |
| 378 setting->DeepCopy()); |
| 379 } else { |
| 380 NOTREACHED(); |
| 381 } |
| 382 } |
| 383 } |
| 384 } else { |
| 385 int setting = CONTENT_SETTING_DEFAULT; |
| 386 if (settings_dictionary->GetIntegerWithoutPathExpansion( |
| 387 GetTypeName(ContentSettingsType(i)), &setting)) { |
| 388 DCHECK_NE(CONTENT_SETTING_DEFAULT, setting); |
| 389 setting = FixObsoleteCookiePromptMode(content_type, |
| 390 ContentSetting(setting)); |
| 391 value_map_.SetValue(pattern_pair.first, |
| 392 pattern_pair.second, |
| 393 content_type, |
| 394 ResourceIdentifier(""), |
| 395 Value::CreateIntegerValue(setting)); |
| 396 } |
| 375 } | 397 } |
| 376 } | 398 } |
| 377 } | 399 } |
| 378 } | 400 } |
| 379 | 401 |
| 380 void PrefProvider::UpdatePatternPairsSettings( | 402 void PrefProvider::UpdatePatternPairsSettings( |
| 381 const ContentSettingsPattern& primary_pattern, | 403 const ContentSettingsPattern& primary_pattern, |
| 382 const ContentSettingsPattern& secondary_pattern, | 404 const ContentSettingsPattern& secondary_pattern, |
| 383 ContentSettingsType content_type, | 405 ContentSettingsType content_type, |
| 384 const ResourceIdentifier& resource_identifier, | 406 const ResourceIdentifier& resource_identifier, |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 683 | 705 |
| 684 void PrefProvider::AssertLockNotHeld() const { | 706 void PrefProvider::AssertLockNotHeld() const { |
| 685 #if !defined(NDEBUG) | 707 #if !defined(NDEBUG) |
| 686 // |Lock::Acquire()| will assert if the lock is held by this thread. | 708 // |Lock::Acquire()| will assert if the lock is held by this thread. |
| 687 lock_.Acquire(); | 709 lock_.Acquire(); |
| 688 lock_.Release(); | 710 lock_.Release(); |
| 689 #endif | 711 #endif |
| 690 } | 712 } |
| 691 | 713 |
| 692 } // namespace content_settings | 714 } // namespace content_settings |
| OLD | NEW |