OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/ui/webui/options/content_settings_handler.h" | 5 #include "chrome/browser/ui/webui/options/content_settings_handler.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <map> | 10 #include <map> |
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 for (ContentSettingsForOneType::iterator i = all_settings.begin(); | 831 for (ContentSettingsForOneType::iterator i = all_settings.begin(); |
832 i != all_settings.end(); ++i) { | 832 i != all_settings.end(); ++i) { |
833 // Don't add default settings. | 833 // Don't add default settings. |
834 if (i->primary_pattern == ContentSettingsPattern::Wildcard() && | 834 if (i->primary_pattern == ContentSettingsPattern::Wildcard() && |
835 i->secondary_pattern == ContentSettingsPattern::Wildcard() && | 835 i->secondary_pattern == ContentSettingsPattern::Wildcard() && |
836 i | 836 i |
837 ->source != site_settings::kPreferencesSource) { | 837 ->source != site_settings::kPreferencesSource) { |
838 continue; | 838 continue; |
839 } | 839 } |
840 all_patterns_settings[std::make_pair(i->primary_pattern, i->source)] | 840 all_patterns_settings[std::make_pair(i->primary_pattern, i->source)] |
841 [i->secondary_pattern] = i->setting; | 841 [i->secondary_pattern] = i->GetContentSetting(); |
842 } | 842 } |
843 | 843 |
844 base::ListValue exceptions; | 844 base::ListValue exceptions; |
845 AddExceptionsGrantedByHostedApps( | 845 AddExceptionsGrantedByHostedApps( |
846 profile, | 846 profile, |
847 HostedAppHasPermission<APIPermission::kGeolocation>, | 847 HostedAppHasPermission<APIPermission::kGeolocation>, |
848 &exceptions); | 848 &exceptions); |
849 | 849 |
850 for (site_settings::AllPatternsSettings::iterator i = | 850 for (site_settings::AllPatternsSettings::iterator i = |
851 all_patterns_settings.begin(); i != all_patterns_settings.end(); ++i) { | 851 all_patterns_settings.begin(); i != all_patterns_settings.end(); ++i) { |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
902 i != settings.end(); | 902 i != settings.end(); |
903 ++i) { | 903 ++i) { |
904 // Don't add default settings. | 904 // Don't add default settings. |
905 if (i->primary_pattern == ContentSettingsPattern::Wildcard() && | 905 if (i->primary_pattern == ContentSettingsPattern::Wildcard() && |
906 i->secondary_pattern == ContentSettingsPattern::Wildcard() && | 906 i->secondary_pattern == ContentSettingsPattern::Wildcard() && |
907 i | 907 i |
908 ->source != site_settings::kPreferencesSource) { | 908 ->source != site_settings::kPreferencesSource) { |
909 continue; | 909 continue; |
910 } | 910 } |
911 | 911 |
912 exceptions.Append( | 912 exceptions.Append(GetNotificationExceptionForPage( |
913 GetNotificationExceptionForPage(i->primary_pattern, | 913 i->primary_pattern, i->secondary_pattern, i->GetContentSetting(), |
914 i->secondary_pattern, | 914 i->source)); |
915 i->setting, | |
916 i->source)); | |
917 } | 915 } |
918 | 916 |
919 base::Value type_string(site_settings::ContentSettingsTypeToGroupName( | 917 base::Value type_string(site_settings::ContentSettingsTypeToGroupName( |
920 CONTENT_SETTINGS_TYPE_NOTIFICATIONS)); | 918 CONTENT_SETTINGS_TYPE_NOTIFICATIONS)); |
921 web_ui()->CallJavascriptFunctionUnsafe("ContentSettings.setExceptions", | 919 web_ui()->CallJavascriptFunctionUnsafe("ContentSettings.setExceptions", |
922 type_string, exceptions); | 920 type_string, exceptions); |
923 | 921 |
924 // This is mainly here to keep this function ideologically parallel to | 922 // This is mainly here to keep this function ideologically parallel to |
925 // UpdateExceptionsViewFromHostContentSettingsMap(). | 923 // UpdateExceptionsViewFromHostContentSettingsMap(). |
926 UpdateSettingDefaultFromModel(CONTENT_SETTINGS_TYPE_NOTIFICATIONS); | 924 UpdateSettingDefaultFromModel(CONTENT_SETTINGS_TYPE_NOTIFICATIONS); |
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1485 | 1483 |
1486 // Exceptions apply only when the feature is enabled. | 1484 // Exceptions apply only when the feature is enabled. |
1487 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); | 1485 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); |
1488 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); | 1486 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); |
1489 web_ui()->CallJavascriptFunctionUnsafe( | 1487 web_ui()->CallJavascriptFunctionUnsafe( |
1490 "ContentSettings.enableProtectedContentExceptions", | 1488 "ContentSettings.enableProtectedContentExceptions", |
1491 base::Value(enable_exceptions)); | 1489 base::Value(enable_exceptions)); |
1492 } | 1490 } |
1493 | 1491 |
1494 } // namespace options | 1492 } // namespace options |
OLD | NEW |