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/string_util.h" | 7 #include "base/string_util.h" |
8 #include "base/utf_string_conversions.h" | 8 #include "base/utf_string_conversions.h" |
9 #include "chrome/browser/chrome_thread.h" | 9 #include "chrome/browser/chrome_thread.h" |
10 #include "chrome/browser/pref_service.h" | 10 #include "chrome/browser/pref_service.h" |
(...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 &setting); | 562 &setting); |
563 DCHECK(found); | 563 DCHECK(found); |
564 for (size_t type = 0; type < arraysize(kTypeNames); ++type) { | 564 for (size_t type = 0; type < arraysize(kTypeNames); ++type) { |
565 if ((kTypeNames[type] != NULL) && | 565 if ((kTypeNames[type] != NULL) && |
566 (std::wstring(kTypeNames[type]) == content_type)) { | 566 (std::wstring(kTypeNames[type]) == content_type)) { |
567 settings->settings[type] = IntToContentSetting(setting); | 567 settings->settings[type] = IntToContentSetting(setting); |
568 break; | 568 break; |
569 } | 569 } |
570 } | 570 } |
571 } | 571 } |
| 572 // Migrate obsolete cookie prompt mode. |
| 573 if (settings->settings[CONTENT_SETTINGS_TYPE_COOKIES] == CONTENT_SETTING_ASK) |
| 574 settings->settings[CONTENT_SETTINGS_TYPE_COOKIES] = CONTENT_SETTING_BLOCK; |
572 } | 575 } |
573 | 576 |
574 void HostContentSettingsMap::ForceDefaultsToBeExplicit() { | 577 void HostContentSettingsMap::ForceDefaultsToBeExplicit() { |
575 DCHECK_EQ(arraysize(kDefaultSettings), | 578 DCHECK_EQ(arraysize(kDefaultSettings), |
576 static_cast<size_t>(CONTENT_SETTINGS_NUM_TYPES)); | 579 static_cast<size_t>(CONTENT_SETTINGS_NUM_TYPES)); |
577 | 580 |
578 for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { | 581 for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { |
579 if (default_content_settings_.settings[i] == CONTENT_SETTING_DEFAULT) | 582 if (default_content_settings_.settings[i] == CONTENT_SETTING_DEFAULT) |
580 default_content_settings_.settings[i] = kDefaultSettings[i]; | 583 default_content_settings_.settings[i] = kDefaultSettings[i]; |
581 } | 584 } |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
640 if (!profile_) | 643 if (!profile_) |
641 return; | 644 return; |
642 PrefService* prefs = profile_->GetPrefs(); | 645 PrefService* prefs = profile_->GetPrefs(); |
643 prefs->RemovePrefObserver(prefs::kDefaultContentSettings, this); | 646 prefs->RemovePrefObserver(prefs::kDefaultContentSettings, this); |
644 prefs->RemovePrefObserver(prefs::kContentSettingsPatterns, this); | 647 prefs->RemovePrefObserver(prefs::kContentSettingsPatterns, this); |
645 prefs->RemovePrefObserver(prefs::kBlockThirdPartyCookies, this); | 648 prefs->RemovePrefObserver(prefs::kBlockThirdPartyCookies, this); |
646 notification_registrar_.Remove(this, NotificationType::PROFILE_DESTROYED, | 649 notification_registrar_.Remove(this, NotificationType::PROFILE_DESTROYED, |
647 Source<Profile>(profile_)); | 650 Source<Profile>(profile_)); |
648 profile_ = NULL; | 651 profile_ = NULL; |
649 } | 652 } |
OLD | NEW |