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