OLD | NEW |
1 // Copyright (c) 2011 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 |
11 #include "base/auto_reset.h" | 11 #include "base/auto_reset.h" |
(...skipping 401 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 res_dictionary_path, &resource_dictionary)) { | 413 res_dictionary_path, &resource_dictionary)) { |
414 for (DictionaryValue::key_iterator j( | 414 for (DictionaryValue::key_iterator j( |
415 resource_dictionary->begin_keys()); | 415 resource_dictionary->begin_keys()); |
416 j != resource_dictionary->end_keys(); | 416 j != resource_dictionary->end_keys(); |
417 ++j) { | 417 ++j) { |
418 const std::string& resource_identifier(*j); | 418 const std::string& resource_identifier(*j); |
419 int setting = CONTENT_SETTING_DEFAULT; | 419 int setting = CONTENT_SETTING_DEFAULT; |
420 found = resource_dictionary->GetIntegerWithoutPathExpansion( | 420 found = resource_dictionary->GetIntegerWithoutPathExpansion( |
421 resource_identifier, &setting); | 421 resource_identifier, &setting); |
422 DCHECK_NE(CONTENT_SETTING_DEFAULT, setting); | 422 DCHECK_NE(CONTENT_SETTING_DEFAULT, setting); |
423 setting = ClickToPlayFixup(content_type, | |
424 ContentSetting(setting)); | |
425 value_map_.SetValue(pattern_pair.first, | 423 value_map_.SetValue(pattern_pair.first, |
426 pattern_pair.second, | 424 pattern_pair.second, |
427 content_type, | 425 content_type, |
428 resource_identifier, | 426 resource_identifier, |
429 Value::CreateIntegerValue(setting)); | 427 Value::CreateIntegerValue(setting)); |
430 } | 428 } |
431 } | 429 } |
432 } else { | 430 } else { |
433 int setting = CONTENT_SETTING_DEFAULT; | 431 int setting = CONTENT_SETTING_DEFAULT; |
434 if (settings_dictionary->GetIntegerWithoutPathExpansion( | 432 if (settings_dictionary->GetIntegerWithoutPathExpansion( |
435 GetTypeName(ContentSettingsType(i)), &setting)) { | 433 GetTypeName(ContentSettingsType(i)), &setting)) { |
436 DCHECK_NE(CONTENT_SETTING_DEFAULT, setting); | 434 DCHECK_NE(CONTENT_SETTING_DEFAULT, setting); |
437 setting = FixObsoleteCookiePromptMode(content_type, | 435 setting = FixObsoleteCookiePromptMode(content_type, |
438 ContentSetting(setting)); | 436 ContentSetting(setting)); |
439 setting = ClickToPlayFixup(content_type, | |
440 ContentSetting(setting)); | |
441 value_map_.SetValue(pattern_pair.first, | 437 value_map_.SetValue(pattern_pair.first, |
442 pattern_pair.second, | 438 pattern_pair.second, |
443 content_type, | 439 content_type, |
444 ResourceIdentifier(""), | 440 ResourceIdentifier(""), |
445 Value::CreateIntegerValue(setting)); | 441 Value::CreateIntegerValue(setting)); |
446 } | 442 } |
447 } | 443 } |
448 } | 444 } |
449 } | 445 } |
450 } | 446 } |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
736 | 732 |
737 for (size_t i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { | 733 for (size_t i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { |
738 ContentSettingsType content_type = static_cast<ContentSettingsType>(i); | 734 ContentSettingsType content_type = static_cast<ContentSettingsType>(i); |
739 | 735 |
740 int setting_int_value = CONTENT_SETTING_DEFAULT; | 736 int setting_int_value = CONTENT_SETTING_DEFAULT; |
741 if (host_settings_dictionary->GetIntegerWithoutPathExpansion( | 737 if (host_settings_dictionary->GetIntegerWithoutPathExpansion( |
742 GetTypeName(content_type), &setting_int_value)) { | 738 GetTypeName(content_type), &setting_int_value)) { |
743 ContentSetting setting = IntToContentSetting(setting_int_value); | 739 ContentSetting setting = IntToContentSetting(setting_int_value); |
744 | 740 |
745 setting = FixObsoleteCookiePromptMode(content_type, setting); | 741 setting = FixObsoleteCookiePromptMode(content_type, setting); |
746 setting = ClickToPlayFixup(content_type, setting); | |
747 | 742 |
748 if (setting != CONTENT_SETTING_DEFAULT) { | 743 if (setting != CONTENT_SETTING_DEFAULT) { |
749 SetWebsiteSetting( | 744 SetWebsiteSetting( |
750 pattern, | 745 pattern, |
751 pattern, | 746 pattern, |
752 content_type, | 747 content_type, |
753 "", | 748 "", |
754 Value::CreateIntegerValue(setting)); | 749 Value::CreateIntegerValue(setting)); |
755 } | 750 } |
756 } | 751 } |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1108 | 1103 |
1109 void PrefProvider::AssertLockNotHeld() const { | 1104 void PrefProvider::AssertLockNotHeld() const { |
1110 #if !defined(NDEBUG) | 1105 #if !defined(NDEBUG) |
1111 // |Lock::Acquire()| will assert if the lock is held by this thread. | 1106 // |Lock::Acquire()| will assert if the lock is held by this thread. |
1112 lock_.Acquire(); | 1107 lock_.Acquire(); |
1113 lock_.Release(); | 1108 lock_.Release(); |
1114 #endif | 1109 #endif |
1115 } | 1110 } |
1116 | 1111 |
1117 } // namespace content_settings | 1112 } // namespace content_settings |
OLD | NEW |