| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/host_content_settings_map.h" | 5 #include "chrome/browser/host_content_settings_map.h" |
| 6 | 6 |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/chrome_thread.h" | 8 #include "chrome/browser/chrome_thread.h" |
| 9 #include "chrome/browser/pref_service.h" | 9 #include "chrome/browser/pref_service.h" |
| 10 #include "chrome/browser/profile.h" | 10 #include "chrome/browser/profile.h" |
| (...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 345 ContentSettings* settings) { | 345 ContentSettings* settings) { |
| 346 for (DictionaryValue::key_iterator i(dictionary->begin_keys()); | 346 for (DictionaryValue::key_iterator i(dictionary->begin_keys()); |
| 347 i != dictionary->end_keys(); ++i) { | 347 i != dictionary->end_keys(); ++i) { |
| 348 std::wstring content_type(*i); | 348 std::wstring content_type(*i); |
| 349 int setting = CONTENT_SETTING_DEFAULT; | 349 int setting = CONTENT_SETTING_DEFAULT; |
| 350 bool found = dictionary->GetIntegerWithoutPathExpansion(content_type, | 350 bool found = dictionary->GetIntegerWithoutPathExpansion(content_type, |
| 351 &setting); | 351 &setting); |
| 352 DCHECK(found); | 352 DCHECK(found); |
| 353 for (size_t type = 0; type < arraysize(kTypeNames); ++type) { | 353 for (size_t type = 0; type < arraysize(kTypeNames); ++type) { |
| 354 if (std::wstring(kTypeNames[type]) == content_type) { | 354 if (std::wstring(kTypeNames[type]) == content_type) { |
| 355 settings->settings[type] = static_cast<ContentSetting>(setting); | 355 settings->settings[type] = IntToContentSetting(setting); |
| 356 break; | 356 break; |
| 357 } | 357 } |
| 358 } | 358 } |
| 359 } | 359 } |
| 360 } | 360 } |
| 361 | 361 |
| 362 void HostContentSettingsMap::ForceDefaultsToBeExplicit() { | 362 void HostContentSettingsMap::ForceDefaultsToBeExplicit() { |
| 363 DCHECK_EQ(arraysize(kDefaultSettings), | 363 DCHECK_EQ(arraysize(kDefaultSettings), |
| 364 static_cast<size_t>(CONTENT_SETTINGS_NUM_TYPES)); | 364 static_cast<size_t>(CONTENT_SETTINGS_NUM_TYPES)); |
| 365 | 365 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 377 return true; | 377 return true; |
| 378 } | 378 } |
| 379 | 379 |
| 380 void HostContentSettingsMap::NotifyObservers(const std::string& host) { | 380 void HostContentSettingsMap::NotifyObservers(const std::string& host) { |
| 381 ContentSettingsDetails details(host); | 381 ContentSettingsDetails details(host); |
| 382 NotificationService::current()->Notify( | 382 NotificationService::current()->Notify( |
| 383 NotificationType::CONTENT_SETTINGS_CHANGED, | 383 NotificationType::CONTENT_SETTINGS_CHANGED, |
| 384 Source<HostContentSettingsMap>(this), | 384 Source<HostContentSettingsMap>(this), |
| 385 Details<ContentSettingsDetails>(&details)); | 385 Details<ContentSettingsDetails>(&details)); |
| 386 } | 386 } |
| OLD | NEW |