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

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: Check the exceptions before the default setting, sites in the exceptions list can access the device… 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 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 } 187 }
188 188
189 // Returns true whenever the |extension| is hosted and has |permission|. 189 // Returns true whenever the |extension| is hosted and has |permission|.
190 // Must have the AppFilter signature. 190 // Must have the AppFilter signature.
191 template <ExtensionAPIPermission::ID permission> 191 template <ExtensionAPIPermission::ID permission>
192 bool HostedAppHasPermission( 192 bool HostedAppHasPermission(
193 const extensions::Extension& extension, Profile* /*profile*/) { 193 const extensions::Extension& extension, Profile* /*profile*/) {
194 return extension.is_hosted_app() && extension.HasAPIPermission(permission); 194 return extension.is_hosted_app() && extension.HasAPIPermission(permission);
195 } 195 }
196 196
197 // Create a DictionaryValue* that will act as a data source for a single row
198 // in the Media Stream exceptions table. Ownership of the pointer is
199 // passed to the caller.
200 DictionaryValue* GetMediaStreamExceptionForPage(
201 const ContentSettingsPattern& pattern) {
202 DictionaryValue* exception = new DictionaryValue();
203 exception->SetString(kDisplayPattern, pattern.ToString());
204 exception->SetString(kSetting, ContentSettingToString(CONTENT_SETTING_ALLOW));
205 exception->SetString(kOrigin, pattern.ToString());
206 exception->SetString(kSource, std::string());
207 return exception;
208 }
209
197 // Add an "Allow"-entry to the list of |exceptions| for a |url_pattern| from 210 // Add an "Allow"-entry to the list of |exceptions| for a |url_pattern| from
198 // the web extent of a hosted |app|. 211 // the web extent of a hosted |app|.
199 void AddExceptionForHostedApp(const std::string& url_pattern, 212 void AddExceptionForHostedApp(const std::string& url_pattern,
200 const extensions::Extension& app, ListValue* exceptions) { 213 const extensions::Extension& app, ListValue* exceptions) {
201 DictionaryValue* exception = new DictionaryValue(); 214 DictionaryValue* exception = new DictionaryValue();
202 exception->SetString(kDisplayPattern, url_pattern); 215 exception->SetString(kDisplayPattern, url_pattern);
203 exception->SetString(kSetting, ContentSettingToString(CONTENT_SETTING_ALLOW)); 216 exception->SetString(kSetting, ContentSettingToString(CONTENT_SETTING_ALLOW));
204 exception->SetString(kOrigin, url_pattern); 217 exception->SetString(kOrigin, url_pattern);
205 exception->SetString(kEmbeddingOrigin, url_pattern); 218 exception->SetString(kEmbeddingOrigin, url_pattern);
206 exception->SetString(kSource, "HostedApp"); 219 exception->SetString(kSource, "HostedApp");
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 {CONTENT_SETTINGS_TYPE_JAVASCRIPT, "javascript"}, 343 {CONTENT_SETTINGS_TYPE_JAVASCRIPT, "javascript"},
331 {CONTENT_SETTINGS_TYPE_PLUGINS, "plugins"}, 344 {CONTENT_SETTINGS_TYPE_PLUGINS, "plugins"},
332 {CONTENT_SETTINGS_TYPE_POPUPS, "popups"}, 345 {CONTENT_SETTINGS_TYPE_POPUPS, "popups"},
333 {CONTENT_SETTINGS_TYPE_GEOLOCATION, "location"}, 346 {CONTENT_SETTINGS_TYPE_GEOLOCATION, "location"},
334 {CONTENT_SETTINGS_TYPE_NOTIFICATIONS, "notifications"}, 347 {CONTENT_SETTINGS_TYPE_NOTIFICATIONS, "notifications"},
335 {CONTENT_SETTINGS_TYPE_INTENTS, "intents"}, 348 {CONTENT_SETTINGS_TYPE_INTENTS, "intents"},
336 {CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, "auto-select-certificate"}, 349 {CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, "auto-select-certificate"},
337 {CONTENT_SETTINGS_TYPE_FULLSCREEN, "fullscreen"}, 350 {CONTENT_SETTINGS_TYPE_FULLSCREEN, "fullscreen"},
338 {CONTENT_SETTINGS_TYPE_MOUSELOCK, "mouselock"}, 351 {CONTENT_SETTINGS_TYPE_MOUSELOCK, "mouselock"},
339 {EX_CONTENT_SETTINGS_TYPE_PEPPER_FLASH_CAMERAMIC, "pepper-flash-cameramic"}, 352 {EX_CONTENT_SETTINGS_TYPE_PEPPER_FLASH_CAMERAMIC, "pepper-flash-cameramic"},
353 {CONTENT_SETTINGS_TYPE_MEDIASTREAM, "media-stream"},
340 }; 354 };
341 355
342 ContentSettingsHandler::ContentSettingsHandler() { 356 ContentSettingsHandler::ContentSettingsHandler() {
343 } 357 }
344 358
345 ContentSettingsHandler::~ContentSettingsHandler() { 359 ContentSettingsHandler::~ContentSettingsHandler() {
346 } 360 }
347 361
348 void ContentSettingsHandler::GetLocalizedValues( 362 void ContentSettingsHandler::GetLocalizedValues(
349 DictionaryValue* localized_strings) { 363 DictionaryValue* localized_strings) {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 // The header has to be named as <content_type_name>_header. 438 // The header has to be named as <content_type_name>_header.
425 { "pepper-flash-cameramic_header", IDS_PEPPER_FLASH_CAMERAMIC_HEADER }, 439 { "pepper-flash-cameramic_header", IDS_PEPPER_FLASH_CAMERAMIC_HEADER },
426 { "pepperFlashCameramicAsk", IDS_PEPPER_FLASH_CAMERAMIC_ASK_RADIO }, 440 { "pepperFlashCameramicAsk", IDS_PEPPER_FLASH_CAMERAMIC_ASK_RADIO },
427 { "pepperFlashCameramicBlock", IDS_PEPPER_FLASH_CAMERAMIC_BLOCK_RADIO }, 441 { "pepperFlashCameramicBlock", IDS_PEPPER_FLASH_CAMERAMIC_BLOCK_RADIO },
428 #if defined(OS_CHROMEOS) 442 #if defined(OS_CHROMEOS)
429 // Protected Content filter 443 // Protected Content filter
430 { "protectedContentTabLabel", IDS_PROTECTED_CONTENT_TAB_LABEL }, 444 { "protectedContentTabLabel", IDS_PROTECTED_CONTENT_TAB_LABEL },
431 { "protectedContentInfo", IDS_PROTECTED_CONTENT_INFO }, 445 { "protectedContentInfo", IDS_PROTECTED_CONTENT_INFO },
432 { "protectedContentEnable", IDS_PROTECTED_CONTENT_ENABLE}, 446 { "protectedContentEnable", IDS_PROTECTED_CONTENT_ENABLE},
433 #endif // defined(OS_CHROMEOS) 447 #endif // defined(OS_CHROMEOS)
448 // Media stream capture device filter.
449 { "mediaStreamTabLabel", IDS_MEDIA_STREAM_TAB_LABEL },
450 { "media-stream_header", IDS_MEDIA_STREAM_HEADER },
451 { "mediaStreamAsk", IDS_MEDIA_STREAM_ASK_RADIO },
452 { "mediaStreamBlock", IDS_MEDIA_STREAM_BLOCK_RADIO },
434 }; 453 };
435 454
436 RegisterStrings(localized_strings, resources, arraysize(resources)); 455 RegisterStrings(localized_strings, resources, arraysize(resources));
437 RegisterTitle(localized_strings, "contentSettingsPage", 456 RegisterTitle(localized_strings, "contentSettingsPage",
438 IDS_CONTENT_SETTINGS_TITLE); 457 IDS_CONTENT_SETTINGS_TITLE);
439 458
440 // Register titles for each of the individual settings whose exception 459 // Register titles for each of the individual settings whose exception
441 // dialogs will be processed by |ContentSettingsHandler|. 460 // dialogs will be processed by |ContentSettingsHandler|.
442 RegisterTitle(localized_strings, "cookies", 461 RegisterTitle(localized_strings, "cookies",
443 IDS_COOKIES_TAB_LABEL); 462 IDS_COOKIES_TAB_LABEL);
444 RegisterTitle(localized_strings, "images", 463 RegisterTitle(localized_strings, "images",
445 IDS_IMAGES_TAB_LABEL); 464 IDS_IMAGES_TAB_LABEL);
446 RegisterTitle(localized_strings, "javascript", 465 RegisterTitle(localized_strings, "javascript",
447 IDS_JAVASCRIPT_TAB_LABEL); 466 IDS_JAVASCRIPT_TAB_LABEL);
448 RegisterTitle(localized_strings, "plugins", 467 RegisterTitle(localized_strings, "plugins",
449 IDS_PLUGIN_TAB_LABEL); 468 IDS_PLUGIN_TAB_LABEL);
450 RegisterTitle(localized_strings, "popups", 469 RegisterTitle(localized_strings, "popups",
451 IDS_POPUP_TAB_LABEL); 470 IDS_POPUP_TAB_LABEL);
452 RegisterTitle(localized_strings, "location", 471 RegisterTitle(localized_strings, "location",
453 IDS_GEOLOCATION_TAB_LABEL); 472 IDS_GEOLOCATION_TAB_LABEL);
454 RegisterTitle(localized_strings, "notifications", 473 RegisterTitle(localized_strings, "notifications",
455 IDS_NOTIFICATIONS_TAB_LABEL); 474 IDS_NOTIFICATIONS_TAB_LABEL);
456 RegisterTitle(localized_strings, "fullscreen", 475 RegisterTitle(localized_strings, "fullscreen",
457 IDS_FULLSCREEN_TAB_LABEL); 476 IDS_FULLSCREEN_TAB_LABEL);
458 RegisterTitle(localized_strings, "mouselock", 477 RegisterTitle(localized_strings, "mouselock",
459 IDS_MOUSE_LOCK_TAB_LABEL); 478 IDS_MOUSE_LOCK_TAB_LABEL);
460 RegisterTitle(localized_strings, "pepper-flash-cameramic", 479 RegisterTitle(localized_strings, "pepper-flash-cameramic",
461 IDS_PEPPER_FLASH_CAMERAMIC_TAB_LABEL); 480 IDS_PEPPER_FLASH_CAMERAMIC_TAB_LABEL);
481 RegisterTitle(localized_strings, "medias-tream",
482 IDS_MEDIA_STREAM_TAB_LABEL);
462 483
463 Profile* profile = Profile::FromWebUI(web_ui()); 484 Profile* profile = Profile::FromWebUI(web_ui());
464 localized_strings->SetBoolean( 485 localized_strings->SetBoolean(
465 "enable_web_intents", 486 "enable_web_intents",
466 web_intents::IsWebIntentsEnabledForProfile(profile)); 487 web_intents::IsWebIntentsEnabledForProfile(profile));
467 // TODO(marja): clean up the options UI after the decision on the session 488 // TODO(marja): clean up the options UI after the decision on the session
468 // restore changes has stabilized. 489 // restore changes has stabilized.
469 localized_strings->SetBoolean( 490 localized_strings->SetBoolean(
470 "enable_restore_session_state", false); 491 "enable_restore_session_state", false);
471 } 492 }
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
671 692
672 switch (type) { 693 switch (type) {
673 case CONTENT_SETTINGS_TYPE_GEOLOCATION: 694 case CONTENT_SETTINGS_TYPE_GEOLOCATION:
674 UpdateGeolocationExceptionsView(); 695 UpdateGeolocationExceptionsView();
675 break; 696 break;
676 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: 697 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS:
677 UpdateNotificationExceptionsView(); 698 UpdateNotificationExceptionsView();
678 break; 699 break;
679 case EX_CONTENT_SETTINGS_TYPE_PEPPER_FLASH_CAMERAMIC: 700 case EX_CONTENT_SETTINGS_TYPE_PEPPER_FLASH_CAMERAMIC:
680 UpdateFlashCameraMicExceptionsView(); 701 UpdateFlashCameraMicExceptionsView();
702 case CONTENT_SETTINGS_TYPE_MEDIASTREAM:
703 UpdateMediaStreamExceptionsView();
681 break; 704 break;
682 default: 705 default:
683 UpdateExceptionsViewFromHostContentSettingsMap( 706 UpdateExceptionsViewFromHostContentSettingsMap(
684 type.ToContentSettingsType()); 707 type.ToContentSettingsType());
685 break; 708 break;
686 } 709 }
687 } 710 }
688 711
689 void ContentSettingsHandler::UpdateOTRExceptionsViewFromModel( 712 void ContentSettingsHandler::UpdateOTRExceptionsViewFromModel(
690 const ExContentSettingsType& type) { 713 const ExContentSettingsType& type) {
691 switch (type) { 714 switch (type) {
692 case CONTENT_SETTINGS_TYPE_GEOLOCATION: 715 case CONTENT_SETTINGS_TYPE_GEOLOCATION:
693 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: 716 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS:
694 case CONTENT_SETTINGS_TYPE_INTENTS: 717 case CONTENT_SETTINGS_TYPE_INTENTS:
695 case CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE: 718 case CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE:
696 case EX_CONTENT_SETTINGS_TYPE_PEPPER_FLASH_CAMERAMIC: 719 case EX_CONTENT_SETTINGS_TYPE_PEPPER_FLASH_CAMERAMIC:
697 break; 720 break;
721 case CONTENT_SETTINGS_TYPE_MEDIASTREAM:
722 // TODO(xians): Add MediaStream support to OTRExceptionsView.
723 break;
698 default: 724 default:
699 UpdateExceptionsViewFromOTRHostContentSettingsMap( 725 UpdateExceptionsViewFromOTRHostContentSettingsMap(
700 type.ToContentSettingsType()); 726 type.ToContentSettingsType());
701 break; 727 break;
702 } 728 }
703 } 729 }
704 730
705 void ContentSettingsHandler::UpdateGeolocationExceptionsView() { 731 void ContentSettingsHandler::UpdateGeolocationExceptionsView() {
706 Profile* profile = Profile::FromWebUI(web_ui()); 732 Profile* profile = Profile::FromWebUI(web_ui());
707 HostContentSettingsMap* map = profile->GetHostContentSettingsMap(); 733 HostContentSettingsMap* map = profile->GetHostContentSettingsMap();
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
830 856
831 StringValue type_string(ExContentSettingsTypeToGroupName( 857 StringValue type_string(ExContentSettingsTypeToGroupName(
832 ExContentSettingsType(EX_CONTENT_SETTINGS_TYPE_PEPPER_FLASH_CAMERAMIC))); 858 ExContentSettingsType(EX_CONTENT_SETTINGS_TYPE_PEPPER_FLASH_CAMERAMIC)));
833 web_ui()->CallJavascriptFunction("ContentSettings.setExceptions", 859 web_ui()->CallJavascriptFunction("ContentSettings.setExceptions",
834 type_string, exceptions); 860 type_string, exceptions);
835 861
836 UpdateSettingDefaultFromModel( 862 UpdateSettingDefaultFromModel(
837 ExContentSettingsType(EX_CONTENT_SETTINGS_TYPE_PEPPER_FLASH_CAMERAMIC)); 863 ExContentSettingsType(EX_CONTENT_SETTINGS_TYPE_PEPPER_FLASH_CAMERAMIC));
838 } 864 }
839 865
866 void ContentSettingsHandler::UpdateMediaStreamExceptionsView() {
867 ContentSettingsForOneType entries;
868 GetContentSettingsMap()->GetSettingsForOneType(
869 CONTENT_SETTINGS_TYPE_MEDIASTREAM, "", &entries);
870
871 ListValue exceptions;
872 for (size_t i = 0; i < entries.size(); ++i) {
873 // Don't add default settings.
874 if (entries[i].primary_pattern == ContentSettingsPattern::Wildcard() &&
875 entries[i].secondary_pattern == ContentSettingsPattern::Wildcard() &&
876 entries[i].source != "preference") {
877 continue;
878 }
879
880 exceptions.Append(
881 GetMediaStreamExceptionForPage(entries[i].primary_pattern));
882 }
883
884 StringValue type_string(ContentSettingsTypeToGroupName(
885 CONTENT_SETTINGS_TYPE_MEDIASTREAM));
886 web_ui()->CallJavascriptFunction("ContentSettings.setExceptions", type_string,
887 exceptions);
888
889 // This is mainly here to keep this function ideologically parallel to
890 // UpdateExceptionsViewFromHostContentSettingsMap().
891 UpdateSettingDefaultFromModel(
892 ExContentSettingsType(CONTENT_SETTINGS_TYPE_MEDIASTREAM));
893 }
894
840 void ContentSettingsHandler::UpdateExceptionsViewFromHostContentSettingsMap( 895 void ContentSettingsHandler::UpdateExceptionsViewFromHostContentSettingsMap(
841 ContentSettingsType type) { 896 ContentSettingsType type) {
842 ContentSettingsForOneType entries; 897 ContentSettingsForOneType entries;
843 GetContentSettingsMap()->GetSettingsForOneType(type, "", &entries); 898 GetContentSettingsMap()->GetSettingsForOneType(type, "", &entries);
844 899
845 ListValue exceptions; 900 ListValue exceptions;
846 if (type == CONTENT_SETTINGS_TYPE_COOKIES) { 901 if (type == CONTENT_SETTINGS_TYPE_COOKIES) {
847 Profile* profile = Profile::FromWebUI(web_ui()); 902 Profile* profile = Profile::FromWebUI(web_ui());
848 AddExceptionsGrantedByHostedApps(profile, HasProtectedStorage, &exceptions); 903 AddExceptionsGrantedByHostedApps(profile, HasProtectedStorage, &exceptions);
849 } 904 }
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
1040 UserMetricsAction("Options_DefaultHandlersSettingChanged")); 1095 UserMetricsAction("Options_DefaultHandlersSettingChanged"));
1041 break; 1096 break;
1042 case CONTENT_SETTINGS_TYPE_MOUSELOCK: 1097 case CONTENT_SETTINGS_TYPE_MOUSELOCK:
1043 content::RecordAction( 1098 content::RecordAction(
1044 UserMetricsAction("Options_DefaultMouseLockSettingChanged")); 1099 UserMetricsAction("Options_DefaultMouseLockSettingChanged"));
1045 break; 1100 break;
1046 case EX_CONTENT_SETTINGS_TYPE_PEPPER_FLASH_CAMERAMIC: 1101 case EX_CONTENT_SETTINGS_TYPE_PEPPER_FLASH_CAMERAMIC:
1047 content::RecordAction( 1102 content::RecordAction(
1048 UserMetricsAction("Options_DefaultFlashCameraMicSettingChanged")); 1103 UserMetricsAction("Options_DefaultFlashCameraMicSettingChanged"));
1049 break; 1104 break;
1105 case CONTENT_SETTINGS_TYPE_MEDIASTREAM:
1106 content::RecordAction(
1107 UserMetricsAction("Options_DefaultMediaStreamSettingChanged"));
1108 break;
1050 default: 1109 default:
1051 break; 1110 break;
1052 } 1111 }
1053 } 1112 }
1054 1113
1055 void ContentSettingsHandler::RemoveException(const ListValue* args) { 1114 void ContentSettingsHandler::RemoveException(const ListValue* args) {
1056 size_t arg_i = 0; 1115 size_t arg_i = 0;
1057 std::string type_string; 1116 std::string type_string;
1058 CHECK(args->GetString(arg_i++, &type_string)); 1117 CHECK(args->GetString(arg_i++, &type_string));
1059 1118
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
1106 ppapi::FlashSiteSettings site_settings(1, 1165 ppapi::FlashSiteSettings site_settings(1,
1107 ppapi::FlashSiteSetting( 1166 ppapi::FlashSiteSetting(
1108 pattern, PP_FLASH_BROWSEROPERATIONS_PERMISSION_DEFAULT)); 1167 pattern, PP_FLASH_BROWSEROPERATIONS_PERMISSION_DEFAULT));
1109 flash_settings_manager_->SetSitePermission( 1168 flash_settings_manager_->SetSitePermission(
1110 PP_FLASH_BROWSEROPERATIONS_SETTINGTYPE_CAMERAMIC, 1169 PP_FLASH_BROWSEROPERATIONS_SETTINGTYPE_CAMERAMIC,
1111 site_settings); 1170 site_settings);
1112 } else { 1171 } else {
1113 NOTREACHED(); 1172 NOTREACHED();
1114 } 1173 }
1115 UpdateFlashCameraMicExceptionsView(); 1174 UpdateFlashCameraMicExceptionsView();
1116 } else { 1175 } else {
Bernhard Bauer 2012/06/18 17:38:15 Would you mind doing a small bit of cleanup here?
no longer working on chromium 2012/06/19 12:23:17 Sure, no problem at all. I found the function gets
Bernhard Bauer 2012/06/19 14:33:35 Nice, thanks!
1117 HostContentSettingsMap* settings_map = 1176 HostContentSettingsMap* settings_map =
1118 mode == "normal" ? GetContentSettingsMap() : 1177 mode == "normal" ? GetContentSettingsMap() :
1119 GetOTRContentSettingsMap(); 1178 GetOTRContentSettingsMap();
1120 // The settings map could be null if the mode was OTR but the OTR profile
1121 // got destroyed before we received this message.
1122 if (settings_map) { 1179 if (settings_map) {
1123 settings_map->SetContentSetting( 1180 // MediaStream is using compound value, so we need to use
1124 ContentSettingsPattern::FromString(pattern), 1181 // SetWebsiteSetting instead of SetContentSetting.
Bernhard Bauer 2012/06/18 17:38:15 I think you *can* use SetWebsiteSetting for simple
no longer working on chromium 2012/06/19 12:23:17 Done.
1125 ContentSettingsPattern::Wildcard(), 1182 if (type == CONTENT_SETTINGS_TYPE_MEDIASTREAM) {
1126 type.ToContentSettingsType(), 1183 settings_map->SetWebsiteSetting(
1127 "", 1184 ContentSettingsPattern::FromString(pattern),
1128 CONTENT_SETTING_DEFAULT); 1185 ContentSettingsPattern::Wildcard(),
1186 type.ToContentSettingsType(),
1187 "",
1188 NULL);
1189 } else {
1190 settings_map->SetContentSetting(
1191 ContentSettingsPattern::FromString(pattern),
1192 ContentSettingsPattern::Wildcard(),
1193 type.ToContentSettingsType(),
1194 "",
1195 CONTENT_SETTING_DEFAULT);
1196 }
1129 } 1197 }
1130 } 1198 }
1131 } 1199 }
1132 } 1200 }
1133 1201
1134 void ContentSettingsHandler::SetException(const ListValue* args) { 1202 void ContentSettingsHandler::SetException(const ListValue* args) {
1135 size_t arg_i = 0; 1203 size_t arg_i = 0;
1136 std::string type_string; 1204 std::string type_string;
1137 CHECK(args->GetString(arg_i++, &type_string)); 1205 CHECK(args->GetString(arg_i++, &type_string));
1138 std::string mode; 1206 std::string mode;
1139 CHECK(args->GetString(arg_i++, &mode)); 1207 CHECK(args->GetString(arg_i++, &mode));
1140 std::string pattern; 1208 std::string pattern;
1141 CHECK(args->GetString(arg_i++, &pattern)); 1209 CHECK(args->GetString(arg_i++, &pattern));
1142 std::string setting; 1210 std::string setting;
1143 CHECK(args->GetString(arg_i++, &setting)); 1211 CHECK(args->GetString(arg_i++, &setting));
1144 1212
1145 ExContentSettingsType type = ExContentSettingsTypeFromGroupName(type_string); 1213 ExContentSettingsType type = ExContentSettingsTypeFromGroupName(type_string);
1146 if (type == CONTENT_SETTINGS_TYPE_GEOLOCATION || 1214 if (type == CONTENT_SETTINGS_TYPE_GEOLOCATION ||
1147 type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS) { 1215 type == CONTENT_SETTINGS_TYPE_NOTIFICATIONS ||
1216 type == CONTENT_SETTINGS_TYPE_MEDIASTREAM) {
1148 NOTREACHED(); 1217 NOTREACHED();
1149 } else if (type == EX_CONTENT_SETTINGS_TYPE_PEPPER_FLASH_CAMERAMIC) { 1218 } else if (type == EX_CONTENT_SETTINGS_TYPE_PEPPER_FLASH_CAMERAMIC) {
1150 DCHECK(IsValidHost(pattern)); 1219 DCHECK(IsValidHost(pattern));
1151 1220
1152 if (flash_cameramic_settings_.sites.find(pattern) == 1221 if (flash_cameramic_settings_.sites.find(pattern) ==
1153 flash_cameramic_settings_.sites.end()) { 1222 flash_cameramic_settings_.sites.end()) {
1154 pattern = CanonicalizeHost(pattern); 1223 pattern = CanonicalizeHost(pattern);
1155 } 1224 }
1156 PP_Flash_BrowserOperations_Permission permission = 1225 PP_Flash_BrowserOperations_Permission permission =
1157 FlashPermissionFromContentSetting(ContentSettingFromString(setting)); 1226 FlashPermissionFromContentSetting(ContentSettingFromString(setting));
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
1257 for (size_t i = 0; i < arraysize(kExContentSettingsTypeGroupNames); ++i) { 1326 for (size_t i = 0; i < arraysize(kExContentSettingsTypeGroupNames); ++i) {
1258 if (type == kExContentSettingsTypeGroupNames[i].type) 1327 if (type == kExContentSettingsTypeGroupNames[i].type)
1259 return kExContentSettingsTypeGroupNames[i].name; 1328 return kExContentSettingsTypeGroupNames[i].name;
1260 } 1329 }
1261 1330
1262 NOTREACHED(); 1331 NOTREACHED();
1263 return std::string(); 1332 return std::string();
1264 } 1333 }
1265 1334
1266 } // namespace options2 1335 } // namespace options2
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698