| 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/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "chrome/browser/chrome_thread.h" | 10 #include "chrome/browser/chrome_thread.h" |
| (...skipping 565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 576 &setting); | 576 &setting); |
| 577 DCHECK(found); | 577 DCHECK(found); |
| 578 for (size_t type = 0; type < arraysize(kTypeNames); ++type) { | 578 for (size_t type = 0; type < arraysize(kTypeNames); ++type) { |
| 579 if ((kTypeNames[type] != NULL) && | 579 if ((kTypeNames[type] != NULL) && |
| 580 (WideToUTF8(kTypeNames[type]) == content_type)) { | 580 (WideToUTF8(kTypeNames[type]) == content_type)) { |
| 581 settings->settings[type] = IntToContentSetting(setting); | 581 settings->settings[type] = IntToContentSetting(setting); |
| 582 break; | 582 break; |
| 583 } | 583 } |
| 584 } | 584 } |
| 585 } | 585 } |
| 586 if (CommandLine::ForCurrentProcess()->HasSwitch( | 586 if (!CommandLine::ForCurrentProcess()->HasSwitch( |
| 587 switches::kDisableCookiePrompt)) { | 587 switches::kEnableCookiePrompt)) { |
| 588 // Migrate obsolete cookie prompt mode. | 588 // Migrate obsolete cookie prompt mode. |
| 589 if (settings->settings[CONTENT_SETTINGS_TYPE_COOKIES] == | 589 if (settings->settings[CONTENT_SETTINGS_TYPE_COOKIES] == |
| 590 CONTENT_SETTING_ASK) | 590 CONTENT_SETTING_ASK) |
| 591 settings->settings[CONTENT_SETTINGS_TYPE_COOKIES] = CONTENT_SETTING_BLOCK; | 591 settings->settings[CONTENT_SETTINGS_TYPE_COOKIES] = CONTENT_SETTING_BLOCK; |
| 592 } | 592 } |
| 593 } | 593 } |
| 594 | 594 |
| 595 void HostContentSettingsMap::ForceDefaultsToBeExplicit() { | 595 void HostContentSettingsMap::ForceDefaultsToBeExplicit() { |
| 596 DCHECK_EQ(arraysize(kDefaultSettings), | 596 DCHECK_EQ(arraysize(kDefaultSettings), |
| 597 static_cast<size_t>(CONTENT_SETTINGS_NUM_TYPES)); | 597 static_cast<size_t>(CONTENT_SETTINGS_NUM_TYPES)); |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 661 if (!profile_) | 661 if (!profile_) |
| 662 return; | 662 return; |
| 663 PrefService* prefs = profile_->GetPrefs(); | 663 PrefService* prefs = profile_->GetPrefs(); |
| 664 prefs->RemovePrefObserver(prefs::kDefaultContentSettings, this); | 664 prefs->RemovePrefObserver(prefs::kDefaultContentSettings, this); |
| 665 prefs->RemovePrefObserver(prefs::kContentSettingsPatterns, this); | 665 prefs->RemovePrefObserver(prefs::kContentSettingsPatterns, this); |
| 666 prefs->RemovePrefObserver(prefs::kBlockThirdPartyCookies, this); | 666 prefs->RemovePrefObserver(prefs::kBlockThirdPartyCookies, this); |
| 667 notification_registrar_.Remove(this, NotificationType::PROFILE_DESTROYED, | 667 notification_registrar_.Remove(this, NotificationType::PROFILE_DESTROYED, |
| 668 Source<Profile>(profile_)); | 668 Source<Profile>(profile_)); |
| 669 profile_ = NULL; | 669 profile_ = NULL; |
| 670 } | 670 } |
| OLD | NEW |