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

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: Rebase over 1004733003. 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
975 PepperFlashContentSettingsUtils::SortMediaExceptions( 982 PepperFlashContentSettingsUtils::SortMediaExceptions(
976 &media_settings_.exceptions); 983 &media_settings_.exceptions);
977 media_settings_.exceptions_initialized = true; 984 media_settings_.exceptions_initialized = true;
978 UpdateFlashMediaLinksVisibility(); 985 UpdateFlashMediaLinksVisibility();
979 986
980 base::StringValue type_string( 987 base::StringValue type_string(
981 ContentSettingsTypeToGroupName(CONTENT_SETTINGS_TYPE_MEDIASTREAM)); 988 ContentSettingsTypeToGroupName(CONTENT_SETTINGS_TYPE_MEDIASTREAM));
982 web_ui()->CallJavascriptFunction("ContentSettings.setExceptions", 989 web_ui()->CallJavascriptFunction("ContentSettings.setExceptions",
983 type_string, media_exceptions); 990 type_string, media_exceptions);
984 991
985 UpdateSettingDefaultFromModel(CONTENT_SETTINGS_TYPE_MEDIASTREAM); 992 // TODO(msramek): We currently don't have a UI to show separate default
993 // settings for microphone and camera. However, SetContentFilter always sets
994 // both defaults to the same value, so it doesn't matter which one we pick
995 // to show in the UI. Makes sure to update both when we have the new media UI.
996 UpdateSettingDefaultFromModel(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC);
986 } 997 }
987 998
988 void ContentSettingsHandler::UpdateMIDISysExExceptionsView() { 999 void ContentSettingsHandler::UpdateMIDISysExExceptionsView() {
989 UpdateSettingDefaultFromModel(CONTENT_SETTINGS_TYPE_MIDI_SYSEX); 1000 UpdateSettingDefaultFromModel(CONTENT_SETTINGS_TYPE_MIDI_SYSEX);
990 UpdateExceptionsViewFromHostContentSettingsMap( 1001 UpdateExceptionsViewFromHostContentSettingsMap(
991 CONTENT_SETTINGS_TYPE_MIDI_SYSEX); 1002 CONTENT_SETTINGS_TYPE_MIDI_SYSEX);
992 } 1003 }
993 1004
994 void ContentSettingsHandler::AdjustZoomLevelsListForSigninPageIfNecessary( 1005 void ContentSettingsHandler::AdjustZoomLevelsListForSigninPageIfNecessary(
995 content::HostZoomMap::ZoomLevelVector* zoom_levels) { 1006 content::HostZoomMap::ZoomLevelVector* zoom_levels) {
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
1333 ContentSettingsType content_type = ContentSettingsTypeFromGroupName(group); 1344 ContentSettingsType content_type = ContentSettingsTypeFromGroupName(group);
1334 Profile* profile = Profile::FromWebUI(web_ui()); 1345 Profile* profile = Profile::FromWebUI(web_ui());
1335 1346
1336 #if defined(OS_CHROMEOS) 1347 #if defined(OS_CHROMEOS)
1337 // ChromeOS special case : in Guest mode settings are opened in Incognito 1348 // ChromeOS special case : in Guest mode settings are opened in Incognito
1338 // mode, so we need original profile to actually modify settings. 1349 // mode, so we need original profile to actually modify settings.
1339 if (user_manager::UserManager::Get()->IsLoggedInAsGuest()) 1350 if (user_manager::UserManager::Get()->IsLoggedInAsGuest())
1340 profile = profile->GetOriginalProfile(); 1351 profile = profile->GetOriginalProfile();
1341 #endif 1352 #endif
1342 1353
1354 HostContentSettingsMap* map = profile->GetHostContentSettingsMap();
1343 1355
1344 HostContentSettingsMap* map = profile->GetHostContentSettingsMap(); 1356 // MEDIASTREAM is deprecated and the two separate settings MEDIASTREAM_CAMERA
1345 map->SetDefaultContentSetting(content_type, default_setting); 1357 // and MEDIASTREAM_MIC should be used instead. However, we still only have
1358 // one pair of radio buttons that sets both settings.
1359 // TODO(msramek): Clean this up once we have the new UI for media.
1360 if (content_type == CONTENT_SETTINGS_TYPE_MEDIASTREAM) {
1361 map->SetDefaultContentSetting(
1362 CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, default_setting);
1363 map->SetDefaultContentSetting(
1364 CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, default_setting);
1365 } else {
1366 map->SetDefaultContentSetting(content_type, default_setting);
1367 }
1346 1368
1347 switch (content_type) { 1369 switch (content_type) {
1348 case CONTENT_SETTINGS_TYPE_COOKIES: 1370 case CONTENT_SETTINGS_TYPE_COOKIES:
1349 content::RecordAction( 1371 content::RecordAction(
1350 UserMetricsAction("Options_DefaultCookieSettingChanged")); 1372 UserMetricsAction("Options_DefaultCookieSettingChanged"));
1351 break; 1373 break;
1352 case CONTENT_SETTINGS_TYPE_IMAGES: 1374 case CONTENT_SETTINGS_TYPE_IMAGES:
1353 content::RecordAction( 1375 content::RecordAction(
1354 UserMetricsAction("Options_DefaultImagesSettingChanged")); 1376 UserMetricsAction("Options_DefaultImagesSettingChanged"));
1355 break; 1377 break;
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
1536 link_type == DEFAULT_SETTING ? 1558 link_type == DEFAULT_SETTING ?
1537 "ContentSettings.showMediaPepperFlashDefaultLink" : 1559 "ContentSettings.showMediaPepperFlashDefaultLink" :
1538 "ContentSettings.showMediaPepperFlashExceptionsLink", 1560 "ContentSettings.showMediaPepperFlashExceptionsLink",
1539 base::FundamentalValue(show)); 1561 base::FundamentalValue(show));
1540 show_link = show; 1562 show_link = show;
1541 } 1563 }
1542 } 1564 }
1543 1565
1544 void ContentSettingsHandler::UpdateFlashMediaLinksVisibility() { 1566 void ContentSettingsHandler::UpdateFlashMediaLinksVisibility() {
1545 if (!media_settings_.flash_settings_initialized || 1567 if (!media_settings_.flash_settings_initialized ||
1546 !media_settings_.default_setting_initialized || 1568 !media_settings_.default_settings_initialized ||
1547 !media_settings_.exceptions_initialized) { 1569 !media_settings_.exceptions_initialized) {
1548 return; 1570 return;
1549 } 1571 }
1550 1572
1551 // Flash won't send us notifications when its settings get changed, which 1573 // Flash won't send us notifications when its settings get changed, which
1552 // means the Flash settings in |media_settings_| may be out-dated, especially 1574 // means the Flash settings in |media_settings_| may be out-dated, especially
1553 // after we show links to change Flash settings. 1575 // after we show links to change Flash settings.
1554 // In order to avoid confusion, we won't hide the links once they are showed. 1576 // In order to avoid confusion, we won't hide the links once they are showed.
1555 // One exception is that we will hide them when Pepper Flash is disabled 1577 // One exception is that we will hide them when Pepper Flash is disabled
1556 // (handled in OnPepperFlashPrefChanged()). 1578 // (handled in OnPepperFlashPrefChanged()).
1557 if (media_settings_.show_flash_default_link && 1579 if (media_settings_.show_flash_default_link &&
1558 media_settings_.show_flash_exceptions_link) { 1580 media_settings_.show_flash_exceptions_link) {
1559 return; 1581 return;
1560 } 1582 }
1561 1583
1562 if (!media_settings_.show_flash_default_link) { 1584 if (!media_settings_.show_flash_default_link) {
1563 // If both audio and video capture are disabled by policy, the link 1585 // If both audio and video capture are disabled by policy, the link
1564 // shouldn't be showed. Flash conforms to the policy in this case because 1586 // shouldn't be showed. Flash conforms to the policy in this case because
1565 // it cannot open those devices. We don't have to look at the Flash 1587 // it cannot open those devices. We don't have to look at the Flash
1566 // settings. 1588 // settings.
1567 if (!(media_settings_.policy_disable_audio && 1589 if (!(media_settings_.policy_disable_audio &&
1568 media_settings_.policy_disable_video) && 1590 media_settings_.policy_disable_video) &&
1569 media_settings_.flash_default_setting != 1591 ((media_settings_.flash_default_setting !=
1570 media_settings_.default_setting) { 1592 media_settings_.default_audio_setting) ||
1593 (media_settings_.flash_default_setting !=
1594 media_settings_.default_video_setting))) {
1571 ShowFlashMediaLink(DEFAULT_SETTING, true); 1595 ShowFlashMediaLink(DEFAULT_SETTING, true);
1572 } 1596 }
1573 } 1597 }
1574 if (!media_settings_.show_flash_exceptions_link) { 1598 if (!media_settings_.show_flash_exceptions_link) {
1575 // If audio or video capture is disabled by policy, we skip comparison of 1599 // If audio or video capture is disabled by policy, we skip comparison of
1576 // exceptions for audio or video capture, respectively. 1600 // exceptions for audio or video capture, respectively.
1577 if (!PepperFlashContentSettingsUtils::AreMediaExceptionsEqual( 1601 if (!PepperFlashContentSettingsUtils::AreMediaExceptionsEqual(
1578 media_settings_.default_setting, 1602 media_settings_.default_audio_setting,
1603 media_settings_.default_video_setting,
1579 media_settings_.exceptions, 1604 media_settings_.exceptions,
1580 media_settings_.flash_default_setting, 1605 media_settings_.flash_default_setting,
1606 media_settings_.flash_default_setting,
1581 media_settings_.flash_exceptions, 1607 media_settings_.flash_exceptions,
1582 media_settings_.policy_disable_audio, 1608 media_settings_.policy_disable_audio,
1583 media_settings_.policy_disable_video)) { 1609 media_settings_.policy_disable_video)) {
1584 ShowFlashMediaLink(EXCEPTIONS, true); 1610 ShowFlashMediaLink(EXCEPTIONS, true);
1585 } 1611 }
1586 } 1612 }
1587 } 1613 }
1588 1614
1589 void ContentSettingsHandler::UpdateProtectedContentExceptionsButton() { 1615 void ContentSettingsHandler::UpdateProtectedContentExceptionsButton() {
1590 #if defined(OS_CHROMEOS) 1616 #if defined(OS_CHROMEOS)
1591 // Guests cannot modify exceptions. UIAccountTweaks will disabled the button. 1617 // Guests cannot modify exceptions. UIAccountTweaks will disabled the button.
1592 if (user_manager::UserManager::Get()->IsLoggedInAsGuest()) 1618 if (user_manager::UserManager::Get()->IsLoggedInAsGuest())
1593 return; 1619 return;
1594 #endif 1620 #endif
1595 1621
1596 // Exceptions apply only when the feature is enabled. 1622 // Exceptions apply only when the feature is enabled.
1597 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); 1623 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui()));
1598 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); 1624 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM);
1599 web_ui()->CallJavascriptFunction( 1625 web_ui()->CallJavascriptFunction(
1600 "ContentSettings.enableProtectedContentExceptions", 1626 "ContentSettings.enableProtectedContentExceptions",
1601 base::FundamentalValue(enable_exceptions)); 1627 base::FundamentalValue(enable_exceptions));
1602 } 1628 }
1603 1629
1604 } // namespace options 1630 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698