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

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: 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 <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 {CONTENT_SETTINGS_TYPE_IMAGES, "images"}, 73 {CONTENT_SETTINGS_TYPE_IMAGES, "images"},
74 {CONTENT_SETTINGS_TYPE_JAVASCRIPT, "javascript"}, 74 {CONTENT_SETTINGS_TYPE_JAVASCRIPT, "javascript"},
75 {CONTENT_SETTINGS_TYPE_PLUGINS, "plugins"}, 75 {CONTENT_SETTINGS_TYPE_PLUGINS, "plugins"},
76 {CONTENT_SETTINGS_TYPE_POPUPS, "popups"}, 76 {CONTENT_SETTINGS_TYPE_POPUPS, "popups"},
77 {CONTENT_SETTINGS_TYPE_GEOLOCATION, "location"}, 77 {CONTENT_SETTINGS_TYPE_GEOLOCATION, "location"},
78 {CONTENT_SETTINGS_TYPE_NOTIFICATIONS, "notifications"}, 78 {CONTENT_SETTINGS_TYPE_NOTIFICATIONS, "notifications"},
79 {CONTENT_SETTINGS_TYPE_INTENTS, "intents"}, 79 {CONTENT_SETTINGS_TYPE_INTENTS, "intents"},
80 {CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, "auto-select-certificate"}, 80 {CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, "auto-select-certificate"},
81 {CONTENT_SETTINGS_TYPE_FULLSCREEN, "fullscreen"}, 81 {CONTENT_SETTINGS_TYPE_FULLSCREEN, "fullscreen"},
82 {CONTENT_SETTINGS_TYPE_MOUSELOCK, "mouselock"}, 82 {CONTENT_SETTINGS_TYPE_MOUSELOCK, "mouselock"},
83 {CONTENT_SETTINGS_TYPE_MEDIASTREAM, "mediastream"},
83 }; 84 };
84 COMPILE_ASSERT(arraysize(kContentSettingsTypeGroupNames) == 85 COMPILE_ASSERT(arraysize(kContentSettingsTypeGroupNames) ==
85 CONTENT_SETTINGS_NUM_TYPES, 86 CONTENT_SETTINGS_NUM_TYPES,
86 MISSING_CONTENT_SETTINGS_TYPE); 87 MISSING_CONTENT_SETTINGS_TYPE);
87 88
88 ContentSettingsType ContentSettingsTypeFromGroupName(const std::string& name) { 89 ContentSettingsType ContentSettingsTypeFromGroupName(const std::string& name) {
89 for (size_t i = 0; i < arraysize(kContentSettingsTypeGroupNames); ++i) { 90 for (size_t i = 0; i < arraysize(kContentSettingsTypeGroupNames); ++i) {
90 if (name == kContentSettingsTypeGroupNames[i].name) 91 if (name == kContentSettingsTypeGroupNames[i].name)
91 return kContentSettingsTypeGroupNames[i].type; 92 return kContentSettingsTypeGroupNames[i].type;
92 } 93 }
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
327 { "mouselock_header", IDS_MOUSE_LOCK_HEADER }, 328 { "mouselock_header", IDS_MOUSE_LOCK_HEADER },
328 { "mouselock_allow", IDS_MOUSE_LOCK_ALLOW_RADIO }, 329 { "mouselock_allow", IDS_MOUSE_LOCK_ALLOW_RADIO },
329 { "mouselock_ask", IDS_MOUSE_LOCK_ASK_RADIO }, 330 { "mouselock_ask", IDS_MOUSE_LOCK_ASK_RADIO },
330 { "mouselock_block", IDS_MOUSE_LOCK_BLOCK_RADIO }, 331 { "mouselock_block", IDS_MOUSE_LOCK_BLOCK_RADIO },
331 #if defined(OS_CHROMEOS) 332 #if defined(OS_CHROMEOS)
332 // Protected Content filter 333 // Protected Content filter
333 { "protectedContentTabLabel", IDS_PROTECTED_CONTENT_TAB_LABEL }, 334 { "protectedContentTabLabel", IDS_PROTECTED_CONTENT_TAB_LABEL },
334 { "protectedContentInfo", IDS_PROTECTED_CONTENT_INFO }, 335 { "protectedContentInfo", IDS_PROTECTED_CONTENT_INFO },
335 { "protectedContentEnable", IDS_PROTECTED_CONTENT_ENABLE}, 336 { "protectedContentEnable", IDS_PROTECTED_CONTENT_ENABLE},
336 #endif // defined(OS_CHROMEOS) 337 #endif // defined(OS_CHROMEOS)
338 // Media stream capture device filter.
339 { "mediastream_tab_label", IDS_MEDIA_STREAM_TAB_LABEL },
340 { "mediastream_header", IDS_MEDIA_STREAM_HEADER },
341 { "mediastream_ask", IDS_MEDIA_STREAM_ASK_RADIO },
342 { "mediastream_block", IDS_MEDIA_STREAM_BLOCK_RADIO },
337 }; 343 };
338 344
339 RegisterStrings(localized_strings, resources, arraysize(resources)); 345 RegisterStrings(localized_strings, resources, arraysize(resources));
340 RegisterTitle(localized_strings, "contentSettingsPage", 346 RegisterTitle(localized_strings, "contentSettingsPage",
341 IDS_CONTENT_SETTINGS_TITLE); 347 IDS_CONTENT_SETTINGS_TITLE);
342 348
343 // Register titles for each of the individual settings whose exception 349 // Register titles for each of the individual settings whose exception
344 // dialogs will be processed by |ContentSettingsHandler|. 350 // dialogs will be processed by |ContentSettingsHandler|.
345 RegisterTitle(localized_strings, "cookies", 351 RegisterTitle(localized_strings, "cookies",
346 IDS_COOKIES_TAB_LABEL); 352 IDS_COOKIES_TAB_LABEL);
347 RegisterTitle(localized_strings, "images", 353 RegisterTitle(localized_strings, "images",
348 IDS_IMAGES_TAB_LABEL); 354 IDS_IMAGES_TAB_LABEL);
349 RegisterTitle(localized_strings, "javascript", 355 RegisterTitle(localized_strings, "javascript",
350 IDS_JAVASCRIPT_TAB_LABEL); 356 IDS_JAVASCRIPT_TAB_LABEL);
351 RegisterTitle(localized_strings, "plugins", 357 RegisterTitle(localized_strings, "plugins",
352 IDS_PLUGIN_TAB_LABEL); 358 IDS_PLUGIN_TAB_LABEL);
353 RegisterTitle(localized_strings, "popups", 359 RegisterTitle(localized_strings, "popups",
354 IDS_POPUP_TAB_LABEL); 360 IDS_POPUP_TAB_LABEL);
355 RegisterTitle(localized_strings, "location", 361 RegisterTitle(localized_strings, "location",
356 IDS_GEOLOCATION_TAB_LABEL); 362 IDS_GEOLOCATION_TAB_LABEL);
357 RegisterTitle(localized_strings, "notifications", 363 RegisterTitle(localized_strings, "notifications",
358 IDS_NOTIFICATIONS_TAB_LABEL); 364 IDS_NOTIFICATIONS_TAB_LABEL);
359 RegisterTitle(localized_strings, "fullscreen", 365 RegisterTitle(localized_strings, "fullscreen",
360 IDS_FULLSCREEN_TAB_LABEL); 366 IDS_FULLSCREEN_TAB_LABEL);
361 RegisterTitle(localized_strings, "mouselock", 367 RegisterTitle(localized_strings, "mouselock",
362 IDS_MOUSE_LOCK_TAB_LABEL); 368 IDS_MOUSE_LOCK_TAB_LABEL);
369 RegisterTitle(localized_strings, "mediastream",
370 IDS_MEDIA_STREAM_TAB_LABEL);
363 371
364 Profile* profile = Profile::FromWebUI(web_ui()); 372 Profile* profile = Profile::FromWebUI(web_ui());
365 localized_strings->SetBoolean( 373 localized_strings->SetBoolean(
366 "enable_web_intents", 374 "enable_web_intents",
367 web_intents::IsWebIntentsEnabledForProfile(profile)); 375 web_intents::IsWebIntentsEnabledForProfile(profile));
368 // TODO(marja): clean up the options UI after the decision on the session 376 // TODO(marja): clean up the options UI after the decision on the session
369 // restore changes has stabilized. 377 // restore changes has stabilized.
370 localized_strings->SetBoolean( 378 localized_strings->SetBoolean(
371 "enable_restore_session_state", false); 379 "enable_restore_session_state", false);
372 } 380 }
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 } 550 }
543 } 551 }
544 552
545 void ContentSettingsHandler::UpdateOTRExceptionsViewFromModel( 553 void ContentSettingsHandler::UpdateOTRExceptionsViewFromModel(
546 ContentSettingsType type) { 554 ContentSettingsType type) {
547 switch (type) { 555 switch (type) {
548 case CONTENT_SETTINGS_TYPE_GEOLOCATION: 556 case CONTENT_SETTINGS_TYPE_GEOLOCATION:
549 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: 557 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS:
550 case CONTENT_SETTINGS_TYPE_INTENTS: 558 case CONTENT_SETTINGS_TYPE_INTENTS:
551 case CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE: 559 case CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE:
552 break; 560 case CONTENT_SETTINGS_TYPE_MEDIASTREAM:
Bernhard Bauer 2012/06/11 18:16:00 You're removing a |break| here. Also, doesn't thi
no longer working on chromium 2012/06/14 13:03:25 Thanks, we should show the exceptions in incognito
553 default: 561 default:
554 UpdateExceptionsViewFromOTRHostContentSettingsMap(type); 562 UpdateExceptionsViewFromOTRHostContentSettingsMap(type);
555 break; 563 break;
556 } 564 }
557 } 565 }
558 566
559 void ContentSettingsHandler::UpdateGeolocationExceptionsView() { 567 void ContentSettingsHandler::UpdateGeolocationExceptionsView() {
560 Profile* profile = Profile::FromWebUI(web_ui()); 568 Profile* profile = Profile::FromWebUI(web_ui());
561 HostContentSettingsMap* map = profile->GetHostContentSettingsMap(); 569 HostContentSettingsMap* map = profile->GetHostContentSettingsMap();
562 570
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
850 UserMetricsAction("Options_DefaultGeolocationSettingChanged")); 858 UserMetricsAction("Options_DefaultGeolocationSettingChanged"));
851 break; 859 break;
852 case CONTENT_SETTINGS_TYPE_INTENTS: 860 case CONTENT_SETTINGS_TYPE_INTENTS:
853 content::RecordAction( 861 content::RecordAction(
854 UserMetricsAction("Options_DefaultHandlersSettingChanged")); 862 UserMetricsAction("Options_DefaultHandlersSettingChanged"));
855 break; 863 break;
856 case CONTENT_SETTINGS_TYPE_MOUSELOCK: 864 case CONTENT_SETTINGS_TYPE_MOUSELOCK:
857 content::RecordAction( 865 content::RecordAction(
858 UserMetricsAction("Options_DefaultMouseLockSettingChanged")); 866 UserMetricsAction("Options_DefaultMouseLockSettingChanged"));
859 break; 867 break;
868 case CONTENT_SETTINGS_TYPE_MEDIASTREAM:
869 content::RecordAction(
870 UserMetricsAction("Options_DefaultMediaStreamSettingChanged"));
tommi (sloooow) - chröme 2012/06/11 20:59:21 add a break here for consistency with all the othe
no longer working on chromium 2012/06/14 13:03:25 Done.
860 default: 871 default:
861 break; 872 break;
862 } 873 }
863 } 874 }
864 875
865 void ContentSettingsHandler::RemoveException(const ListValue* args) { 876 void ContentSettingsHandler::RemoveException(const ListValue* args) {
866 size_t arg_i = 0; 877 size_t arg_i = 0;
867 std::string type_string; 878 std::string type_string;
868 CHECK(args->GetString(arg_i++, &type_string)); 879 CHECK(args->GetString(arg_i++, &type_string));
869 880
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
1001 1012
1002 HostContentSettingsMap* 1013 HostContentSettingsMap*
1003 ContentSettingsHandler::GetOTRContentSettingsMap() { 1014 ContentSettingsHandler::GetOTRContentSettingsMap() {
1004 Profile* profile = Profile::FromWebUI(web_ui()); 1015 Profile* profile = Profile::FromWebUI(web_ui());
1005 if (profile->HasOffTheRecordProfile()) 1016 if (profile->HasOffTheRecordProfile())
1006 return profile->GetOffTheRecordProfile()->GetHostContentSettingsMap(); 1017 return profile->GetOffTheRecordProfile()->GetHostContentSettingsMap();
1007 return NULL; 1018 return NULL;
1008 } 1019 }
1009 1020
1010 } // namespace options2 1021 } // namespace options2
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698