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/options/content_settings_handler.cc

Issue 965103004: Stop using the MEDIASTREAM content setting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Migration code added. Created 5 years, 9 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
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/options/content_settings_handler.h" 5 #include "chrome/browser/ui/webui/options/content_settings_handler.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 {CONTENT_SETTINGS_TYPE_IMAGES, "images"}, 102 {CONTENT_SETTINGS_TYPE_IMAGES, "images"},
103 {CONTENT_SETTINGS_TYPE_JAVASCRIPT, "javascript"}, 103 {CONTENT_SETTINGS_TYPE_JAVASCRIPT, "javascript"},
104 {CONTENT_SETTINGS_TYPE_PLUGINS, "plugins"}, 104 {CONTENT_SETTINGS_TYPE_PLUGINS, "plugins"},
105 {CONTENT_SETTINGS_TYPE_POPUPS, "popups"}, 105 {CONTENT_SETTINGS_TYPE_POPUPS, "popups"},
106 {CONTENT_SETTINGS_TYPE_GEOLOCATION, "location"}, 106 {CONTENT_SETTINGS_TYPE_GEOLOCATION, "location"},
107 {CONTENT_SETTINGS_TYPE_NOTIFICATIONS, "notifications"}, 107 {CONTENT_SETTINGS_TYPE_NOTIFICATIONS, "notifications"},
108 {CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, "auto-select-certificate"}, 108 {CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, "auto-select-certificate"},
109 {CONTENT_SETTINGS_TYPE_FULLSCREEN, "fullscreen"}, 109 {CONTENT_SETTINGS_TYPE_FULLSCREEN, "fullscreen"},
110 {CONTENT_SETTINGS_TYPE_MOUSELOCK, "mouselock"}, 110 {CONTENT_SETTINGS_TYPE_MOUSELOCK, "mouselock"},
111 {CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS, "register-protocol-handler"}, 111 {CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS, "register-protocol-handler"},
112 // The MEDIASTREAM content setting is deprecated, but the settings for
113 // microphone and camera still live in the part of UI labeled "media-stream".
114 // TODO(msramek): Clean this up once we have a new UI for media.
112 {CONTENT_SETTINGS_TYPE_MEDIASTREAM, "media-stream"}, 115 {CONTENT_SETTINGS_TYPE_MEDIASTREAM, "media-stream"},
113 {CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, "media-stream-mic"}, 116 {CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, "media-stream"},
114 {CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, "media-stream-camera"}, 117 {CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, "media-stream"},
115 {CONTENT_SETTINGS_TYPE_PPAPI_BROKER, "ppapi-broker"}, 118 {CONTENT_SETTINGS_TYPE_PPAPI_BROKER, "ppapi-broker"},
116 {CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, "multiple-automatic-downloads"}, 119 {CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, "multiple-automatic-downloads"},
117 {CONTENT_SETTINGS_TYPE_MIDI_SYSEX, "midi-sysex"}, 120 {CONTENT_SETTINGS_TYPE_MIDI_SYSEX, "midi-sysex"},
118 {CONTENT_SETTINGS_TYPE_PUSH_MESSAGING, "push-messaging"}, 121 {CONTENT_SETTINGS_TYPE_PUSH_MESSAGING, "push-messaging"},
119 {CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS, "ssl-cert-decisions"}, 122 {CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS, "ssl-cert-decisions"},
120 #if defined(OS_CHROMEOS) 123 #if defined(OS_CHROMEOS)
121 {CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER, "protectedContent"}, 124 {CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER, "protectedContent"},
122 #endif 125 #endif
123 }; 126 };
124 127
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 } // namespace 251 } // namespace
249 252
250 namespace options { 253 namespace options {
251 254
252 ContentSettingsHandler::MediaSettingsInfo::MediaSettingsInfo() 255 ContentSettingsHandler::MediaSettingsInfo::MediaSettingsInfo()
253 : flash_default_setting(CONTENT_SETTING_DEFAULT), 256 : flash_default_setting(CONTENT_SETTING_DEFAULT),
254 flash_settings_initialized(false), 257 flash_settings_initialized(false),
255 last_flash_refresh_request_id(0), 258 last_flash_refresh_request_id(0),
256 show_flash_default_link(false), 259 show_flash_default_link(false),
257 show_flash_exceptions_link(false), 260 show_flash_exceptions_link(false),
258 default_setting(CONTENT_SETTING_DEFAULT), 261 default_audio_setting(CONTENT_SETTING_DEFAULT),
262 default_video_setting(CONTENT_SETTING_DEFAULT),
259 policy_disable_audio(false), 263 policy_disable_audio(false),
260 policy_disable_video(false), 264 policy_disable_video(false),
261 default_setting_initialized(false), 265 default_settings_initialized(false),
262 exceptions_initialized(false) { 266 exceptions_initialized(false) {
263 } 267 }
264 268
265 ContentSettingsHandler::MediaSettingsInfo::~MediaSettingsInfo() { 269 ContentSettingsHandler::MediaSettingsInfo::~MediaSettingsInfo() {
266 } 270 }
267 271
268 ContentSettingsHandler::ContentSettingsHandler() : observer_(this) { 272 ContentSettingsHandler::ContentSettingsHandler() : observer_(this) {
269 } 273 }
270 274
271 ContentSettingsHandler::~ContentSettingsHandler() { 275 ContentSettingsHandler::~ContentSettingsHandler() {
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 sites, &media_settings_.flash_exceptions); 596 sites, &media_settings_.flash_exceptions);
593 PepperFlashContentSettingsUtils::SortMediaExceptions( 597 PepperFlashContentSettingsUtils::SortMediaExceptions(
594 &media_settings_.flash_exceptions); 598 &media_settings_.flash_exceptions);
595 599
596 UpdateFlashMediaLinksVisibility(); 600 UpdateFlashMediaLinksVisibility();
597 } 601 }
598 } 602 }
599 603
600 void ContentSettingsHandler::UpdateSettingDefaultFromModel( 604 void ContentSettingsHandler::UpdateSettingDefaultFromModel(
601 ContentSettingsType type) { 605 ContentSettingsType type) {
602 Profile* profile = Profile::FromWebUI(web_ui());
603 std::string provider_id; 606 std::string provider_id;
604 ContentSetting default_setting = 607 ContentSetting default_setting =
605 profile->GetHostContentSettingsMap()->GetDefaultContentSetting( 608 GetContentSettingsMap()->GetDefaultContentSetting(type, &provider_id);
606 type, &provider_id);
607 609
608 // For Plugins, display the obsolete ASK setting as BLOCK. 610 // For Plugins, display the obsolete ASK setting as BLOCK.
609 if (type == ContentSettingsType::CONTENT_SETTINGS_TYPE_PLUGINS && 611 if (type == ContentSettingsType::CONTENT_SETTINGS_TYPE_PLUGINS &&
610 default_setting == ContentSetting::CONTENT_SETTING_ASK) { 612 default_setting == ContentSetting::CONTENT_SETTING_ASK) {
611 default_setting = ContentSetting::CONTENT_SETTING_BLOCK; 613 default_setting = ContentSetting::CONTENT_SETTING_BLOCK;
612 } 614 }
613 615
614 base::DictionaryValue filter_settings; 616 base::DictionaryValue filter_settings;
615 filter_settings.SetString(ContentSettingsTypeToGroupName(type) + ".value", 617 filter_settings.SetString(ContentSettingsTypeToGroupName(type) + ".value",
616 ContentSettingToString(default_setting)); 618 ContentSettingToString(default_setting));
617 filter_settings.SetString( 619 filter_settings.SetString(
618 ContentSettingsTypeToGroupName(type) + ".managedBy", provider_id); 620 ContentSettingsTypeToGroupName(type) + ".managedBy", provider_id);
619 621
620 web_ui()->CallJavascriptFunction( 622 web_ui()->CallJavascriptFunction(
621 "ContentSettings.setContentFilterSettingsValue", filter_settings); 623 "ContentSettings.setContentFilterSettingsValue", filter_settings);
622 } 624 }
623 625
624 void ContentSettingsHandler::UpdateMediaSettingsView() { 626 void ContentSettingsHandler::UpdateMediaSettingsView() {
625 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); 627 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui()));
626 bool audio_disabled = !prefs->GetBoolean(prefs::kAudioCaptureAllowed) && 628 bool audio_disabled = !prefs->GetBoolean(prefs::kAudioCaptureAllowed) &&
627 prefs->IsManagedPreference(prefs::kAudioCaptureAllowed); 629 prefs->IsManagedPreference(prefs::kAudioCaptureAllowed);
628 bool video_disabled = !prefs->GetBoolean(prefs::kVideoCaptureAllowed) && 630 bool video_disabled = !prefs->GetBoolean(prefs::kVideoCaptureAllowed) &&
629 prefs->IsManagedPreference(prefs::kVideoCaptureAllowed); 631 prefs->IsManagedPreference(prefs::kVideoCaptureAllowed);
630 632
631 media_settings_.policy_disable_audio = audio_disabled; 633 media_settings_.policy_disable_audio = audio_disabled;
632 media_settings_.policy_disable_video = video_disabled; 634 media_settings_.policy_disable_video = video_disabled;
633 media_settings_.default_setting = 635 media_settings_.default_audio_setting =
634 GetContentSettingsMap()->GetDefaultContentSetting( 636 GetContentSettingsMap()->GetDefaultContentSetting(
635 CONTENT_SETTINGS_TYPE_MEDIASTREAM, NULL); 637 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, NULL);
636 media_settings_.default_setting_initialized = true; 638 media_settings_.default_video_setting =
639 GetContentSettingsMap()->GetDefaultContentSetting(
640 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, NULL);
641 media_settings_.default_settings_initialized = true;
637 UpdateFlashMediaLinksVisibility(); 642 UpdateFlashMediaLinksVisibility();
638 643
639 base::DictionaryValue media_ui_settings; 644 base::DictionaryValue media_ui_settings;
640 media_ui_settings.SetBoolean("cameraDisabled", video_disabled); 645 media_ui_settings.SetBoolean("cameraDisabled", video_disabled);
641 media_ui_settings.SetBoolean("micDisabled", audio_disabled); 646 media_ui_settings.SetBoolean("micDisabled", audio_disabled);
642 647
643 // In case only video is enabled change the text appropriately. 648 // In case only video is enabled change the text appropriately.
644 if (audio_disabled && !video_disabled) { 649 if (audio_disabled && !video_disabled) {
645 media_ui_settings.SetString("askText", "mediaStreamVideoAsk"); 650 media_ui_settings.SetString("askText", "mediaStreamVideoAsk");
646 media_ui_settings.SetString("blockText", "mediaStreamVideoBlock"); 651 media_ui_settings.SetString("blockText", "mediaStreamVideoBlock");
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
716 void ContentSettingsHandler::UpdateExceptionsViewFromModel( 721 void ContentSettingsHandler::UpdateExceptionsViewFromModel(
717 ContentSettingsType type) { 722 ContentSettingsType type) {
718 switch (type) { 723 switch (type) {
719 case CONTENT_SETTINGS_TYPE_GEOLOCATION: 724 case CONTENT_SETTINGS_TYPE_GEOLOCATION:
720 UpdateGeolocationExceptionsView(); 725 UpdateGeolocationExceptionsView();
721 break; 726 break;
722 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: 727 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS:
723 UpdateNotificationExceptionsView(); 728 UpdateNotificationExceptionsView();
724 break; 729 break;
725 case CONTENT_SETTINGS_TYPE_MEDIASTREAM: 730 case CONTENT_SETTINGS_TYPE_MEDIASTREAM:
726 UpdateMediaSettingsView(); 731 // The content settings type CONTENT_SETTINGS_TYPE_MEDIASSTREAM
732 // is deprecated.
727 break; 733 break;
728 case CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC: 734 case CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC:
729 case CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA: 735 case CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA:
736 UpdateMediaSettingsView();
730 UpdateMediaExceptionsView(); 737 UpdateMediaExceptionsView();
731 break; 738 break;
732 case CONTENT_SETTINGS_TYPE_MIXEDSCRIPT: 739 case CONTENT_SETTINGS_TYPE_MIXEDSCRIPT:
733 // We don't yet support exceptions for mixed scripting. 740 // We don't yet support exceptions for mixed scripting.
734 break; 741 break;
735 case CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE: 742 case CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE:
736 // The content settings type CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE 743 // The content settings type CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE
737 // is supposed to be set by policy only. Hence there is no user facing UI 744 // is supposed to be set by policy only. Hence there is no user facing UI
738 // for this content type and we skip it here. 745 // for this content type and we skip it here.
739 break; 746 break;
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
974 PepperFlashContentSettingsUtils::SortMediaExceptions( 981 PepperFlashContentSettingsUtils::SortMediaExceptions(
975 &media_settings_.exceptions); 982 &media_settings_.exceptions);
976 media_settings_.exceptions_initialized = true; 983 media_settings_.exceptions_initialized = true;
977 UpdateFlashMediaLinksVisibility(); 984 UpdateFlashMediaLinksVisibility();
978 985
979 base::StringValue type_string( 986 base::StringValue type_string(
980 ContentSettingsTypeToGroupName(CONTENT_SETTINGS_TYPE_MEDIASTREAM)); 987 ContentSettingsTypeToGroupName(CONTENT_SETTINGS_TYPE_MEDIASTREAM));
981 web_ui()->CallJavascriptFunction("ContentSettings.setExceptions", 988 web_ui()->CallJavascriptFunction("ContentSettings.setExceptions",
982 type_string, media_exceptions); 989 type_string, media_exceptions);
983 990
984 UpdateSettingDefaultFromModel(CONTENT_SETTINGS_TYPE_MEDIASTREAM); 991 // TODO(msramek): We currently don't have a UI to show separate default
992 // settings for microphone and camera. However, SetContentFilter always sets
993 // both defaults to the same value, so it doesn't matter which one we pick
994 // to show in the UI. Makes sure to update both when we have the new media UI.
995 UpdateSettingDefaultFromModel(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC);
985 } 996 }
986 997
987 void ContentSettingsHandler::UpdateMIDISysExExceptionsView() { 998 void ContentSettingsHandler::UpdateMIDISysExExceptionsView() {
988 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 999 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
989 switches::kEnableWebMIDI)) { 1000 switches::kEnableWebMIDI)) {
990 web_ui()->CallJavascriptFunction( 1001 web_ui()->CallJavascriptFunction(
991 "ContentSettings.showExperimentalWebMIDISettings", 1002 "ContentSettings.showExperimentalWebMIDISettings",
992 base::FundamentalValue(true)); 1003 base::FundamentalValue(true));
993 } 1004 }
994 1005
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after
1337 ContentSettingsType content_type = ContentSettingsTypeFromGroupName(group); 1348 ContentSettingsType content_type = ContentSettingsTypeFromGroupName(group);
1338 Profile* profile = Profile::FromWebUI(web_ui()); 1349 Profile* profile = Profile::FromWebUI(web_ui());
1339 1350
1340 #if defined(OS_CHROMEOS) 1351 #if defined(OS_CHROMEOS)
1341 // ChromeOS special case : in Guest mode settings are opened in Incognito 1352 // ChromeOS special case : in Guest mode settings are opened in Incognito
1342 // mode, so we need original profile to actually modify settings. 1353 // mode, so we need original profile to actually modify settings.
1343 if (user_manager::UserManager::Get()->IsLoggedInAsGuest()) 1354 if (user_manager::UserManager::Get()->IsLoggedInAsGuest())
1344 profile = profile->GetOriginalProfile(); 1355 profile = profile->GetOriginalProfile();
1345 #endif 1356 #endif
1346 1357
1358 HostContentSettingsMap* map = profile->GetHostContentSettingsMap();
1347 1359
1348 HostContentSettingsMap* map = profile->GetHostContentSettingsMap(); 1360 // MEDIASTREAM is deprecated and the two separate settings MEDIASTREAM_CAMERA
1349 map->SetDefaultContentSetting(content_type, default_setting); 1361 // and MEDIASTREAM_MIC should be used instead. However, we still only have
1362 // one pair of radio buttons that sets both settings.
1363 // TODO(msramek): Clean this up once we have the new UI for media.
1364 if (content_type == CONTENT_SETTINGS_TYPE_MEDIASTREAM) {
1365 map->SetDefaultContentSetting(
1366 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, default_setting);
1367 map->SetDefaultContentSetting(
1368 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, default_setting);
1369 } else {
1370 map->SetDefaultContentSetting(content_type, default_setting);
1371 }
1350 1372
1351 switch (content_type) { 1373 switch (content_type) {
1352 case CONTENT_SETTINGS_TYPE_COOKIES: 1374 case CONTENT_SETTINGS_TYPE_COOKIES:
1353 content::RecordAction( 1375 content::RecordAction(
1354 UserMetricsAction("Options_DefaultCookieSettingChanged")); 1376 UserMetricsAction("Options_DefaultCookieSettingChanged"));
1355 break; 1377 break;
1356 case CONTENT_SETTINGS_TYPE_IMAGES: 1378 case CONTENT_SETTINGS_TYPE_IMAGES:
1357 content::RecordAction( 1379 content::RecordAction(
1358 UserMetricsAction("Options_DefaultImagesSettingChanged")); 1380 UserMetricsAction("Options_DefaultImagesSettingChanged"));
1359 break; 1381 break;
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1540 link_type == DEFAULT_SETTING ? 1562 link_type == DEFAULT_SETTING ?
1541 "ContentSettings.showMediaPepperFlashDefaultLink" : 1563 "ContentSettings.showMediaPepperFlashDefaultLink" :
1542 "ContentSettings.showMediaPepperFlashExceptionsLink", 1564 "ContentSettings.showMediaPepperFlashExceptionsLink",
1543 base::FundamentalValue(show)); 1565 base::FundamentalValue(show));
1544 show_link = show; 1566 show_link = show;
1545 } 1567 }
1546 } 1568 }
1547 1569
1548 void ContentSettingsHandler::UpdateFlashMediaLinksVisibility() { 1570 void ContentSettingsHandler::UpdateFlashMediaLinksVisibility() {
1549 if (!media_settings_.flash_settings_initialized || 1571 if (!media_settings_.flash_settings_initialized ||
1550 !media_settings_.default_setting_initialized || 1572 !media_settings_.default_settings_initialized ||
1551 !media_settings_.exceptions_initialized) { 1573 !media_settings_.exceptions_initialized) {
1552 return; 1574 return;
1553 } 1575 }
1554 1576
1555 // Flash won't send us notifications when its settings get changed, which 1577 // Flash won't send us notifications when its settings get changed, which
1556 // means the Flash settings in |media_settings_| may be out-dated, especially 1578 // means the Flash settings in |media_settings_| may be out-dated, especially
1557 // after we show links to change Flash settings. 1579 // after we show links to change Flash settings.
1558 // In order to avoid confusion, we won't hide the links once they are showed. 1580 // In order to avoid confusion, we won't hide the links once they are showed.
1559 // One exception is that we will hide them when Pepper Flash is disabled 1581 // One exception is that we will hide them when Pepper Flash is disabled
1560 // (handled in OnPepperFlashPrefChanged()). 1582 // (handled in OnPepperFlashPrefChanged()).
1561 if (media_settings_.show_flash_default_link && 1583 if (media_settings_.show_flash_default_link &&
1562 media_settings_.show_flash_exceptions_link) { 1584 media_settings_.show_flash_exceptions_link) {
1563 return; 1585 return;
1564 } 1586 }
1565 1587
1566 if (!media_settings_.show_flash_default_link) { 1588 if (!media_settings_.show_flash_default_link) {
1567 // If both audio and video capture are disabled by policy, the link 1589 // If both audio and video capture are disabled by policy, the link
1568 // shouldn't be showed. Flash conforms to the policy in this case because 1590 // shouldn't be showed. Flash conforms to the policy in this case because
1569 // it cannot open those devices. We don't have to look at the Flash 1591 // it cannot open those devices. We don't have to look at the Flash
1570 // settings. 1592 // settings.
1571 if (!(media_settings_.policy_disable_audio && 1593 if (!(media_settings_.policy_disable_audio &&
1572 media_settings_.policy_disable_video) && 1594 media_settings_.policy_disable_video) &&
1573 media_settings_.flash_default_setting != 1595 ((media_settings_.flash_default_setting !=
1574 media_settings_.default_setting) { 1596 media_settings_.default_audio_setting) ||
1597 (media_settings_.flash_default_setting !=
1598 media_settings_.default_video_setting))) {
1575 ShowFlashMediaLink(DEFAULT_SETTING, true); 1599 ShowFlashMediaLink(DEFAULT_SETTING, true);
1576 } 1600 }
1577 } 1601 }
1578 if (!media_settings_.show_flash_exceptions_link) { 1602 if (!media_settings_.show_flash_exceptions_link) {
1579 // If audio or video capture is disabled by policy, we skip comparison of 1603 // If audio or video capture is disabled by policy, we skip comparison of
1580 // exceptions for audio or video capture, respectively. 1604 // exceptions for audio or video capture, respectively.
1581 if (!PepperFlashContentSettingsUtils::AreMediaExceptionsEqual( 1605 if (!PepperFlashContentSettingsUtils::AreMediaExceptionsEqual(
1582 media_settings_.default_setting, 1606 media_settings_.default_audio_setting,
1607 media_settings_.default_video_setting,
1583 media_settings_.exceptions, 1608 media_settings_.exceptions,
1584 media_settings_.flash_default_setting, 1609 media_settings_.flash_default_setting,
1610 media_settings_.flash_default_setting,
1585 media_settings_.flash_exceptions, 1611 media_settings_.flash_exceptions,
1586 media_settings_.policy_disable_audio, 1612 media_settings_.policy_disable_audio,
1587 media_settings_.policy_disable_video)) { 1613 media_settings_.policy_disable_video)) {
1588 ShowFlashMediaLink(EXCEPTIONS, true); 1614 ShowFlashMediaLink(EXCEPTIONS, true);
1589 } 1615 }
1590 } 1616 }
1591 } 1617 }
1592 1618
1593 void ContentSettingsHandler::UpdateProtectedContentExceptionsButton() { 1619 void ContentSettingsHandler::UpdateProtectedContentExceptionsButton() {
1594 #if defined(OS_CHROMEOS) 1620 #if defined(OS_CHROMEOS)
1595 // Guests cannot modify exceptions. UIAccountTweaks will disabled the button. 1621 // Guests cannot modify exceptions. UIAccountTweaks will disabled the button.
1596 if (user_manager::UserManager::Get()->IsLoggedInAsGuest()) 1622 if (user_manager::UserManager::Get()->IsLoggedInAsGuest())
1597 return; 1623 return;
1598 #endif 1624 #endif
1599 1625
1600 // Exceptions apply only when the feature is enabled. 1626 // Exceptions apply only when the feature is enabled.
1601 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); 1627 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui()));
1602 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); 1628 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM);
1603 web_ui()->CallJavascriptFunction( 1629 web_ui()->CallJavascriptFunction(
1604 "ContentSettings.enableProtectedContentExceptions", 1630 "ContentSettings.enableProtectedContentExceptions",
1605 base::FundamentalValue(enable_exceptions)); 1631 base::FundamentalValue(enable_exceptions));
1606 } 1632 }
1607 1633
1608 } // namespace options 1634 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698