OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/profile_resetter/profile_resetter.h" | 5 #include "chrome/browser/profile_resetter/profile_resetter.h" |
6 | 6 |
7 #include "base/json/json_string_value_serializer.h" | 7 #include "base/json/json_string_value_serializer.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/prefs/pref_service.h" | 9 #include "base/prefs/pref_service.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
508 } | 508 } |
509 ContentSetting default_setting = | 509 ContentSetting default_setting = |
510 host_content_settings_map->GetDefaultContentSetting(content_type, NULL); | 510 host_content_settings_map->GetDefaultContentSetting(content_type, NULL); |
511 default_settings[content_type] = default_setting; | 511 default_settings[content_type] = default_setting; |
512 ContentSetting wildcard_setting = default_setting == CONTENT_SETTING_BLOCK | 512 ContentSetting wildcard_setting = default_setting == CONTENT_SETTING_BLOCK |
513 ? CONTENT_SETTING_ALLOW | 513 ? CONTENT_SETTING_ALLOW |
514 : CONTENT_SETTING_BLOCK; | 514 : CONTENT_SETTING_BLOCK; |
515 ContentSetting site_setting = default_setting == CONTENT_SETTING_ALLOW | 515 ContentSetting site_setting = default_setting == CONTENT_SETTING_ALLOW |
516 ? CONTENT_SETTING_ALLOW | 516 ? CONTENT_SETTING_ALLOW |
517 : CONTENT_SETTING_BLOCK; | 517 : CONTENT_SETTING_BLOCK; |
518 if (HostContentSettingsMap::IsSettingAllowedForType( | 518 if (info->IsSettingValid(wildcard_setting)) { |
519 profile()->GetPrefs(), wildcard_setting, content_type)) { | |
520 host_content_settings_map->SetDefaultContentSetting(content_type, | 519 host_content_settings_map->SetDefaultContentSetting(content_type, |
521 wildcard_setting); | 520 wildcard_setting); |
522 } | 521 } |
523 if (HostContentSettingsMap::IsSettingAllowedForType( | 522 if (info->IsSettingValid(site_setting)) { |
524 profile()->GetPrefs(), site_setting, content_type)) { | |
525 host_content_settings_map->SetContentSetting( | 523 host_content_settings_map->SetContentSetting( |
526 pattern, ContentSettingsPattern::Wildcard(), content_type, | 524 pattern, ContentSettingsPattern::Wildcard(), content_type, |
527 std::string(), site_setting); | 525 std::string(), site_setting); |
528 ContentSettingsForOneType host_settings; | 526 ContentSettingsForOneType host_settings; |
529 host_content_settings_map->GetSettingsForOneType( | 527 host_content_settings_map->GetSettingsForOneType( |
530 content_type, std::string(), &host_settings); | 528 content_type, std::string(), &host_settings); |
531 EXPECT_EQ(2U, host_settings.size()); | 529 EXPECT_EQ(2U, host_settings.size()); |
532 } | 530 } |
533 } | 531 } |
534 | 532 |
(...skipping 536 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1071 new ResettableSettingsSnapshot(profile())); | 1069 new ResettableSettingsSnapshot(profile())); |
1072 deleted_snapshot->RequestShortcuts(base::Bind(&FeedbackCapture::Fail, | 1070 deleted_snapshot->RequestShortcuts(base::Bind(&FeedbackCapture::Fail, |
1073 base::Unretained(&capture))); | 1071 base::Unretained(&capture))); |
1074 deleted_snapshot.reset(); | 1072 deleted_snapshot.reset(); |
1075 // Running remaining tasks shouldn't trigger the callback to be called as | 1073 // Running remaining tasks shouldn't trigger the callback to be called as |
1076 // |deleted_snapshot| was deleted before it could run. | 1074 // |deleted_snapshot| was deleted before it could run. |
1077 base::MessageLoop::current()->RunUntilIdle(); | 1075 base::MessageLoop::current()->RunUntilIdle(); |
1078 } | 1076 } |
1079 | 1077 |
1080 } // namespace | 1078 } // namespace |
OLD | NEW |