Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(100)

Side by Side Diff: chrome/browser/ui/webui/options2/content_settings_handler2.cc

Issue 10537099: add "always allow" option to the mediastream infobar and allow user to allow/not allow acces to devi (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed comments from joaodasilva and bauerb, added support to Incognito mode. Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/options2/content_settings_handler2.h" 5 #include "chrome/browser/ui/webui/options2/content_settings_handler2.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 {CONTENT_SETTINGS_TYPE_JAVASCRIPT, "javascript"}, 331 {CONTENT_SETTINGS_TYPE_JAVASCRIPT, "javascript"},
332 {CONTENT_SETTINGS_TYPE_PLUGINS, "plugins"}, 332 {CONTENT_SETTINGS_TYPE_PLUGINS, "plugins"},
333 {CONTENT_SETTINGS_TYPE_POPUPS, "popups"}, 333 {CONTENT_SETTINGS_TYPE_POPUPS, "popups"},
334 {CONTENT_SETTINGS_TYPE_GEOLOCATION, "location"}, 334 {CONTENT_SETTINGS_TYPE_GEOLOCATION, "location"},
335 {CONTENT_SETTINGS_TYPE_NOTIFICATIONS, "notifications"}, 335 {CONTENT_SETTINGS_TYPE_NOTIFICATIONS, "notifications"},
336 {CONTENT_SETTINGS_TYPE_INTENTS, "intents"}, 336 {CONTENT_SETTINGS_TYPE_INTENTS, "intents"},
337 {CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, "auto-select-certificate"}, 337 {CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, "auto-select-certificate"},
338 {CONTENT_SETTINGS_TYPE_FULLSCREEN, "fullscreen"}, 338 {CONTENT_SETTINGS_TYPE_FULLSCREEN, "fullscreen"},
339 {CONTENT_SETTINGS_TYPE_MOUSELOCK, "mouselock"}, 339 {CONTENT_SETTINGS_TYPE_MOUSELOCK, "mouselock"},
340 {EX_CONTENT_SETTINGS_TYPE_PEPPER_FLASH_CAMERAMIC, "pepper-flash-cameramic"}, 340 {EX_CONTENT_SETTINGS_TYPE_PEPPER_FLASH_CAMERAMIC, "pepper-flash-cameramic"},
341 {CONTENT_SETTINGS_TYPE_MEDIASTREAM, "media-stream"},
341 }; 342 };
342 343
343 ContentSettingsHandler::ContentSettingsHandler() { 344 ContentSettingsHandler::ContentSettingsHandler() {
344 } 345 }
345 346
346 ContentSettingsHandler::~ContentSettingsHandler() { 347 ContentSettingsHandler::~ContentSettingsHandler() {
347 } 348 }
348 349
349 void ContentSettingsHandler::GetLocalizedValues( 350 void ContentSettingsHandler::GetLocalizedValues(
350 DictionaryValue* localized_strings) { 351 DictionaryValue* localized_strings) {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 // The header has to be named as <content_type_name>_header. 426 // The header has to be named as <content_type_name>_header.
426 { "pepper-flash-cameramic_header", IDS_PEPPER_FLASH_CAMERAMIC_HEADER }, 427 { "pepper-flash-cameramic_header", IDS_PEPPER_FLASH_CAMERAMIC_HEADER },
427 { "pepperFlashCameramicAsk", IDS_PEPPER_FLASH_CAMERAMIC_ASK_RADIO }, 428 { "pepperFlashCameramicAsk", IDS_PEPPER_FLASH_CAMERAMIC_ASK_RADIO },
428 { "pepperFlashCameramicBlock", IDS_PEPPER_FLASH_CAMERAMIC_BLOCK_RADIO }, 429 { "pepperFlashCameramicBlock", IDS_PEPPER_FLASH_CAMERAMIC_BLOCK_RADIO },
429 #if defined(OS_CHROMEOS) 430 #if defined(OS_CHROMEOS)
430 // Protected Content filter 431 // Protected Content filter
431 { "protectedContentTabLabel", IDS_PROTECTED_CONTENT_TAB_LABEL }, 432 { "protectedContentTabLabel", IDS_PROTECTED_CONTENT_TAB_LABEL },
432 { "protectedContentInfo", IDS_PROTECTED_CONTENT_INFO }, 433 { "protectedContentInfo", IDS_PROTECTED_CONTENT_INFO },
433 { "protectedContentEnable", IDS_PROTECTED_CONTENT_ENABLE}, 434 { "protectedContentEnable", IDS_PROTECTED_CONTENT_ENABLE},
434 #endif // defined(OS_CHROMEOS) 435 #endif // defined(OS_CHROMEOS)
436 // Media stream capture device filter.
437 { "mediaStreamTabLabel", IDS_MEDIA_STREAM_TAB_LABEL },
438 { "media-stream_header", IDS_MEDIA_STREAM_HEADER },
439 { "mediaStreamAsk", IDS_MEDIA_STREAM_ASK_RADIO },
440 { "mediaStreamBlock", IDS_MEDIA_STREAM_BLOCK_RADIO },
435 }; 441 };
436 442
437 RegisterStrings(localized_strings, resources, arraysize(resources)); 443 RegisterStrings(localized_strings, resources, arraysize(resources));
438 RegisterTitle(localized_strings, "contentSettingsPage", 444 RegisterTitle(localized_strings, "contentSettingsPage",
439 IDS_CONTENT_SETTINGS_TITLE); 445 IDS_CONTENT_SETTINGS_TITLE);
440 446
441 // Register titles for each of the individual settings whose exception 447 // Register titles for each of the individual settings whose exception
442 // dialogs will be processed by |ContentSettingsHandler|. 448 // dialogs will be processed by |ContentSettingsHandler|.
443 RegisterTitle(localized_strings, "cookies", 449 RegisterTitle(localized_strings, "cookies",
444 IDS_COOKIES_TAB_LABEL); 450 IDS_COOKIES_TAB_LABEL);
445 RegisterTitle(localized_strings, "images", 451 RegisterTitle(localized_strings, "images",
446 IDS_IMAGES_TAB_LABEL); 452 IDS_IMAGES_TAB_LABEL);
447 RegisterTitle(localized_strings, "javascript", 453 RegisterTitle(localized_strings, "javascript",
448 IDS_JAVASCRIPT_TAB_LABEL); 454 IDS_JAVASCRIPT_TAB_LABEL);
449 RegisterTitle(localized_strings, "plugins", 455 RegisterTitle(localized_strings, "plugins",
450 IDS_PLUGIN_TAB_LABEL); 456 IDS_PLUGIN_TAB_LABEL);
451 RegisterTitle(localized_strings, "popups", 457 RegisterTitle(localized_strings, "popups",
452 IDS_POPUP_TAB_LABEL); 458 IDS_POPUP_TAB_LABEL);
453 RegisterTitle(localized_strings, "location", 459 RegisterTitle(localized_strings, "location",
454 IDS_GEOLOCATION_TAB_LABEL); 460 IDS_GEOLOCATION_TAB_LABEL);
455 RegisterTitle(localized_strings, "notifications", 461 RegisterTitle(localized_strings, "notifications",
456 IDS_NOTIFICATIONS_TAB_LABEL); 462 IDS_NOTIFICATIONS_TAB_LABEL);
457 RegisterTitle(localized_strings, "fullscreen", 463 RegisterTitle(localized_strings, "fullscreen",
458 IDS_FULLSCREEN_TAB_LABEL); 464 IDS_FULLSCREEN_TAB_LABEL);
459 RegisterTitle(localized_strings, "mouselock", 465 RegisterTitle(localized_strings, "mouselock",
460 IDS_MOUSE_LOCK_TAB_LABEL); 466 IDS_MOUSE_LOCK_TAB_LABEL);
461 RegisterTitle(localized_strings, "pepper-flash-cameramic", 467 RegisterTitle(localized_strings, "pepper-flash-cameramic",
462 IDS_PEPPER_FLASH_CAMERAMIC_TAB_LABEL); 468 IDS_PEPPER_FLASH_CAMERAMIC_TAB_LABEL);
469 RegisterTitle(localized_strings, "medias-tream",
470 IDS_MEDIA_STREAM_TAB_LABEL);
463 471
464 Profile* profile = Profile::FromWebUI(web_ui()); 472 Profile* profile = Profile::FromWebUI(web_ui());
465 localized_strings->SetBoolean( 473 localized_strings->SetBoolean(
466 "enable_web_intents", 474 "enable_web_intents",
467 web_intents::IsWebIntentsEnabledForProfile(profile)); 475 web_intents::IsWebIntentsEnabledForProfile(profile));
468 // TODO(marja): clean up the options UI after the decision on the session 476 // TODO(marja): clean up the options UI after the decision on the session
469 // restore changes has stabilized. 477 // restore changes has stabilized.
470 localized_strings->SetBoolean( 478 localized_strings->SetBoolean(
471 "enable_restore_session_state", false); 479 "enable_restore_session_state", false);
472 } 480 }
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
855 entries[i].source != "preference") { 863 entries[i].source != "preference") {
856 continue; 864 continue;
857 } 865 }
858 // The content settings UI does not support secondary content settings 866 // The content settings UI does not support secondary content settings
859 // pattern yet. For content settings set through the content settings UI the 867 // pattern yet. For content settings set through the content settings UI the
860 // secondary pattern is by default a wildcard pattern. Hence users are not 868 // secondary pattern is by default a wildcard pattern. Hence users are not
861 // able to modify content settings with a secondary pattern other than the 869 // able to modify content settings with a secondary pattern other than the
862 // wildcard pattern. So only show settings that the user is able to modify. 870 // wildcard pattern. So only show settings that the user is able to modify.
863 // TODO(bauerb): Support a read-only view for those patterns. 871 // TODO(bauerb): Support a read-only view for those patterns.
864 if (entries[i].secondary_pattern == ContentSettingsPattern::Wildcard()) { 872 if (entries[i].secondary_pattern == ContentSettingsPattern::Wildcard()) {
865 exceptions.Append( 873 // Media Stream is using compound values for exceptions, which are
866 GetExceptionForPage(entries[i].primary_pattern, entries[i].setting, 874 // granted as |CONTENT_SETTING_ALLOW|.
867 entries[i].source)); 875 ContentSetting content_setting = CONTENT_SETTING_DEFAULT;
876 if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM)
877 content_setting = CONTENT_SETTING_ALLOW;
878 else
879 content_setting = entries[i].setting;
880
881 exceptions.Append(GetExceptionForPage(entries[i].primary_pattern,
882 content_setting,
883 entries[i].source));
868 } else { 884 } else {
869 LOG(ERROR) << "Secondary content settings patterns are not " 885 LOG(ERROR) << "Secondary content settings patterns are not "
870 << "supported by the content settings UI"; 886 << "supported by the content settings UI";
871 } 887 }
872 } 888 }
873 889
874 StringValue type_string(ContentSettingsTypeToGroupName(type)); 890 StringValue type_string(ContentSettingsTypeToGroupName(type));
875 web_ui()->CallJavascriptFunction("ContentSettings.setExceptions", type_string, 891 web_ui()->CallJavascriptFunction("ContentSettings.setExceptions", type_string,
876 exceptions); 892 exceptions);
877 893
(...skipping 26 matching lines...) Expand all
904 if (!otr_entries[i].incognito) 920 if (!otr_entries[i].incognito)
905 continue; 921 continue;
906 // The content settings UI does not support secondary content settings 922 // The content settings UI does not support secondary content settings
907 // pattern yet. For content settings set through the content settings UI the 923 // pattern yet. For content settings set through the content settings UI the
908 // secondary pattern is by default a wildcard pattern. Hence users are not 924 // secondary pattern is by default a wildcard pattern. Hence users are not
909 // able to modify content settings with a secondary pattern other than the 925 // able to modify content settings with a secondary pattern other than the
910 // wildcard pattern. So only show settings that the user is able to modify. 926 // wildcard pattern. So only show settings that the user is able to modify.
911 // TODO(bauerb): Support a read-only view for those patterns. 927 // TODO(bauerb): Support a read-only view for those patterns.
912 if (otr_entries[i].secondary_pattern == 928 if (otr_entries[i].secondary_pattern ==
913 ContentSettingsPattern::Wildcard()) { 929 ContentSettingsPattern::Wildcard()) {
914 otr_exceptions.Append( 930 ContentSetting content_setting = CONTENT_SETTING_DEFAULT;
915 GetExceptionForPage(otr_entries[i].primary_pattern, 931 // Media Stream is using compound values for its exceptions and arbitrary
916 otr_entries[i].setting, 932 // values for its default setting. And all the exceptions are granted as
917 otr_entries[i].source)); 933 // |CONTENT_SETTING_ALLOW|.
934 if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM &&
935 otr_entries[i].primary_pattern != ContentSettingsPattern::Wildcard())
936 content_setting = CONTENT_SETTING_ALLOW;
937 else
938 content_setting = otr_entries[i].setting;
939
940 otr_exceptions.Append(GetExceptionForPage(otr_entries[i].primary_pattern,
941 content_setting,
942 otr_entries[i].source));
918 } else { 943 } else {
919 LOG(ERROR) << "Secondary content settings patterns are not " 944 LOG(ERROR) << "Secondary content settings patterns are not "
920 << "supported by the content settings UI"; 945 << "supported by the content settings UI";
921 } 946 }
922 } 947 }
923 948
924 StringValue type_string(ContentSettingsTypeToGroupName(type)); 949 StringValue type_string(ContentSettingsTypeToGroupName(type));
925 web_ui()->CallJavascriptFunction("ContentSettings.setOTRExceptions", 950 web_ui()->CallJavascriptFunction("ContentSettings.setOTRExceptions",
926 type_string, otr_exceptions); 951 type_string, otr_exceptions);
927 } 952 }
928 953
954 void ContentSettingsHandler::RemoveGeolocationException(
955 const ListValue* args, size_t arg_index) {
956 Profile* profile = Profile::FromWebUI(web_ui());
957 std::string origin;
958 std::string embedding_origin;
959 bool rv = args->GetString(arg_index++, &origin);
960 DCHECK(rv);
961 rv = args->GetString(arg_index++, &embedding_origin);
962 DCHECK(rv);
963
964 profile->GetHostContentSettingsMap()->
965 SetContentSetting(ContentSettingsPattern::FromString(origin),
966 ContentSettingsPattern::FromString(embedding_origin),
967 CONTENT_SETTINGS_TYPE_GEOLOCATION,
968 std::string(),
969 CONTENT_SETTING_DEFAULT);
970 }
971
972 void ContentSettingsHandler::RemoveNotificationException(
973 const ListValue* args, size_t arg_index) {
974 Profile* profile = Profile::FromWebUI(web_ui());
975 std::string origin;
976 std::string setting;
977 bool rv = args->GetString(arg_index++, &origin);
978 DCHECK(rv);
979 rv = args->GetString(arg_index++, &setting);
980 DCHECK(rv);
981 ContentSetting content_setting = ContentSettingFromString(setting);
982
983 DCHECK(content_setting == CONTENT_SETTING_ALLOW ||
984 content_setting == CONTENT_SETTING_BLOCK);
985 DesktopNotificationServiceFactory::GetForProfile(profile)->
986 ClearSetting(ContentSettingsPattern::FromString(origin));
987 }
988
989 void ContentSettingsHandler::RemoveFlashCameraMicException(
990 const ListValue* args, size_t arg_index) {
991 std::string mode;
992 bool rv = args->GetString(arg_index++, &mode);
993 DCHECK(rv);
994 DCHECK_EQ(mode, "normal");
995
996 std::string pattern;
997 rv = args->GetString(arg_index++, &pattern);
998 DCHECK(rv);
999
1000 CachedPepperFlashSettings::SiteMap::iterator iter =
1001 flash_cameramic_settings_.sites.find(pattern);
1002 if (iter != flash_cameramic_settings_.sites.end()) {
1003 flash_cameramic_settings_.sites.erase(iter);
1004 ppapi::FlashSiteSettings site_settings(
1005 1,
1006 ppapi::FlashSiteSetting(pattern,
1007 PP_FLASH_BROWSEROPERATIONS_PERMISSION_DEFAULT));
1008 flash_settings_manager_->SetSitePermission(
1009 PP_FLASH_BROWSEROPERATIONS_SETTINGTYPE_CAMERAMIC,
1010 site_settings);
1011 } else {
1012 NOTREACHED();
1013 }
1014
1015 UpdateFlashCameraMicExceptionsView();
1016 }
1017
1018 void ContentSettingsHandler::RemoveExceptionFromHostContentSettingsMap(
1019 const ListValue* args, size_t arg_index,
1020 const ExContentSettingsType& type) {
1021 std::string mode;
1022 bool rv = args->GetString(arg_index++, &mode);
1023 DCHECK(rv);
1024
1025 std::string pattern;
1026 rv = args->GetString(arg_index++, &pattern);
1027 DCHECK(rv);
1028
1029 HostContentSettingsMap* settings_map =
1030 mode == "normal" ? GetContentSettingsMap() :
1031 GetOTRContentSettingsMap();
1032 if (settings_map) {
1033 settings_map->SetWebsiteSetting(
1034 ContentSettingsPattern::FromString(pattern),
1035 ContentSettingsPattern::Wildcard(),
1036 type.ToContentSettingsType(),
1037 "",
1038 NULL);
1039 }
1040 }
1041
929 void ContentSettingsHandler::RegisterMessages() { 1042 void ContentSettingsHandler::RegisterMessages() {
930 web_ui()->RegisterMessageCallback("setContentFilter", 1043 web_ui()->RegisterMessageCallback("setContentFilter",
931 base::Bind(&ContentSettingsHandler::SetContentFilter, 1044 base::Bind(&ContentSettingsHandler::SetContentFilter,
932 base::Unretained(this))); 1045 base::Unretained(this)));
933 web_ui()->RegisterMessageCallback("removeException", 1046 web_ui()->RegisterMessageCallback("removeException",
934 base::Bind(&ContentSettingsHandler::RemoveException, 1047 base::Bind(&ContentSettingsHandler::RemoveException,
935 base::Unretained(this))); 1048 base::Unretained(this)));
936 web_ui()->RegisterMessageCallback("setException", 1049 web_ui()->RegisterMessageCallback("setException",
937 base::Bind(&ContentSettingsHandler::SetException, 1050 base::Bind(&ContentSettingsHandler::SetException,
938 base::Unretained(this))); 1051 base::Unretained(this)));
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
1041 UserMetricsAction("Options_DefaultHandlersSettingChanged")); 1154 UserMetricsAction("Options_DefaultHandlersSettingChanged"));
1042 break; 1155 break;
1043 case CONTENT_SETTINGS_TYPE_MOUSELOCK: 1156 case CONTENT_SETTINGS_TYPE_MOUSELOCK:
1044 content::RecordAction( 1157 content::RecordAction(
1045 UserMetricsAction("Options_DefaultMouseLockSettingChanged")); 1158 UserMetricsAction("Options_DefaultMouseLockSettingChanged"));
1046 break; 1159 break;
1047 case EX_CONTENT_SETTINGS_TYPE_PEPPER_FLASH_CAMERAMIC: 1160 case EX_CONTENT_SETTINGS_TYPE_PEPPER_FLASH_CAMERAMIC:
1048 content::RecordAction( 1161 content::RecordAction(
1049 UserMetricsAction("Options_DefaultFlashCameraMicSettingChanged")); 1162 UserMetricsAction("Options_DefaultFlashCameraMicSettingChanged"));
1050 break; 1163 break;
1164 case CONTENT_SETTINGS_TYPE_MEDIASTREAM:
1165 content::RecordAction(
1166 UserMetricsAction("Options_DefaultMediaStreamSettingChanged"));
1167 break;
1051 default: 1168 default:
1052 break; 1169 break;
1053 } 1170 }
1054 } 1171 }
1055 1172
1056 void ContentSettingsHandler::RemoveException(const ListValue* args) { 1173 void ContentSettingsHandler::RemoveException(const ListValue* args) {
1057 size_t arg_i = 0; 1174 size_t arg_i = 0;
1058 std::string type_string; 1175 std::string type_string;
1059 CHECK(args->GetString(arg_i++, &type_string)); 1176 CHECK(args->GetString(arg_i++, &type_string));
1060 1177
1061 Profile* profile = Profile::FromWebUI(web_ui()); 1178 ExContentSettingsType type = ExContentSettingsTypeFromGroupName(type_string);
1062 ExContentSettingsType type = ExContentSettingsTypeFromGroupName( 1179 switch (type) {
1063 type_string); 1180 case CONTENT_SETTINGS_TYPE_GEOLOCATION:
1064 if (type == CONTENT_SETTINGS_TYPE_GEOLOCATION) { 1181 RemoveGeolocationException(args, arg_i);
1065 std::string origin; 1182 break;
1066 std::string embedding_origin; 1183 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS:
1067 bool rv = args->GetString(arg_i++, &origin); 1184 RemoveNotificationException(args, arg_i);
1068 DCHECK(rv); 1185 break;
1069 rv = args->GetString(arg_i++, &embedding_origin); 1186 case EX_CONTENT_SETTINGS_TYPE_PEPPER_FLASH_CAMERAMIC:
1070 DCHECK(rv); 1187 RemoveFlashCameraMicException(args, arg_i);
1071 1188 break;
1072 profile->GetHostContentSettingsMap()-> 1189 default:
1073 SetContentSetting(ContentSettingsPattern::FromString(origin), 1190 RemoveExceptionFromHostContentSettingsMap(args, arg_i, type);
1074 ContentSettingsPattern::FromString(embedding_origin), 1191 break;
1075 CONTENT_SETTINGS_TYPE_GEOLOCATION,
1076 std::string(),
1077 CONTENT_SETTING_DEFAULT);
1078 } else if (type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS) {
1079 std::string origin;
1080 std::string setting;
1081 bool rv = args->GetString(arg_i++, &origin);
1082 DCHECK(rv);
1083 rv = args->GetString(arg_i++, &setting);
1084 DCHECK(rv);
1085 ContentSetting content_setting = ContentSettingFromString(setting);
1086
1087 DCHECK(content_setting == CONTENT_SETTING_ALLOW ||
1088 content_setting == CONTENT_SETTING_BLOCK);
1089 DesktopNotificationServiceFactory::GetForProfile(profile)->
1090 ClearSetting(ContentSettingsPattern::FromString(origin));
1091 } else {
1092 std::string mode;
1093 bool rv = args->GetString(arg_i++, &mode);
1094 DCHECK(rv);
1095
1096 std::string pattern;
1097 rv = args->GetString(arg_i++, &pattern);
1098 DCHECK(rv);
1099
1100 if (type == EX_CONTENT_SETTINGS_TYPE_PEPPER_FLASH_CAMERAMIC) {
1101 DCHECK_EQ(mode, "normal");
1102
1103 CachedPepperFlashSettings::SiteMap::iterator iter =
1104 flash_cameramic_settings_.sites.find(pattern);
1105 if (iter != flash_cameramic_settings_.sites.end()) {
1106 flash_cameramic_settings_.sites.erase(iter);
1107 ppapi::FlashSiteSettings site_settings(1,
1108 ppapi::FlashSiteSetting(
1109 pattern, PP_FLASH_BROWSEROPERATIONS_PERMISSION_DEFAULT));
1110 flash_settings_manager_->SetSitePermission(
1111 PP_FLASH_BROWSEROPERATIONS_SETTINGTYPE_CAMERAMIC,
1112 site_settings);
1113 } else {
1114 NOTREACHED();
1115 }
1116 UpdateFlashCameraMicExceptionsView();
1117 } else {
1118 HostContentSettingsMap* settings_map =
1119 mode == "normal" ? GetContentSettingsMap() :
1120 GetOTRContentSettingsMap();
1121 // The settings map could be null if the mode was OTR but the OTR profile
1122 // got destroyed before we received this message.
1123 if (settings_map) {
1124 settings_map->SetContentSetting(
1125 ContentSettingsPattern::FromString(pattern),
1126 ContentSettingsPattern::Wildcard(),
1127 type.ToContentSettingsType(),
1128 "",
1129 CONTENT_SETTING_DEFAULT);
1130 }
1131 }
1132 } 1192 }
1133 } 1193 }
1134 1194
1135 void ContentSettingsHandler::SetException(const ListValue* args) { 1195 void ContentSettingsHandler::SetException(const ListValue* args) {
1136 size_t arg_i = 0; 1196 size_t arg_i = 0;
1137 std::string type_string; 1197 std::string type_string;
1138 CHECK(args->GetString(arg_i++, &type_string)); 1198 CHECK(args->GetString(arg_i++, &type_string));
1139 std::string mode; 1199 std::string mode;
1140 CHECK(args->GetString(arg_i++, &mode)); 1200 CHECK(args->GetString(arg_i++, &mode));
1141 std::string pattern; 1201 std::string pattern;
1142 CHECK(args->GetString(arg_i++, &pattern)); 1202 CHECK(args->GetString(arg_i++, &pattern));
1143 std::string setting; 1203 std::string setting;
1144 CHECK(args->GetString(arg_i++, &setting)); 1204 CHECK(args->GetString(arg_i++, &setting));
1145 1205
1146 ExContentSettingsType type = ExContentSettingsTypeFromGroupName(type_string); 1206 ExContentSettingsType type = ExContentSettingsTypeFromGroupName(type_string);
1147 if (type == CONTENT_SETTINGS_TYPE_GEOLOCATION || 1207 if (type == CONTENT_SETTINGS_TYPE_GEOLOCATION ||
1148 type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS) { 1208 type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS ||
1209 type == CONTENT_SETTINGS_TYPE_MEDIASTREAM) {
1149 NOTREACHED(); 1210 NOTREACHED();
1150 } else if (type == EX_CONTENT_SETTINGS_TYPE_PEPPER_FLASH_CAMERAMIC) { 1211 } else if (type == EX_CONTENT_SETTINGS_TYPE_PEPPER_FLASH_CAMERAMIC) {
1151 DCHECK(IsValidHost(pattern)); 1212 DCHECK(IsValidHost(pattern));
1152 1213
1153 if (flash_cameramic_settings_.sites.find(pattern) == 1214 if (flash_cameramic_settings_.sites.find(pattern) ==
1154 flash_cameramic_settings_.sites.end()) { 1215 flash_cameramic_settings_.sites.end()) {
1155 pattern = CanonicalizeHost(pattern); 1216 pattern = CanonicalizeHost(pattern);
1156 } 1217 }
1157 PP_Flash_BrowserOperations_Permission permission = 1218 PP_Flash_BrowserOperations_Permission permission =
1158 FlashPermissionFromContentSetting(ContentSettingFromString(setting)); 1219 FlashPermissionFromContentSetting(ContentSettingFromString(setting));
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1266 for (size_t i = 0; i < arraysize(kExContentSettingsTypeGroupNames); ++i) { 1327 for (size_t i = 0; i < arraysize(kExContentSettingsTypeGroupNames); ++i) {
1267 if (type == kExContentSettingsTypeGroupNames[i].type) 1328 if (type == kExContentSettingsTypeGroupNames[i].type)
1268 return kExContentSettingsTypeGroupNames[i].name; 1329 return kExContentSettingsTypeGroupNames[i].name;
1269 } 1330 }
1270 1331
1271 NOTREACHED(); 1332 NOTREACHED();
1272 return std::string(); 1333 return std::string();
1273 } 1334 }
1274 1335
1275 } // namespace options2 1336 } // namespace options2
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698