| OLD | NEW |
| 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 {CONTENT_SETTINGS_TYPE_FULLSCREEN, "fullscreen"}, | 104 {CONTENT_SETTINGS_TYPE_FULLSCREEN, "fullscreen"}, |
| 105 {CONTENT_SETTINGS_TYPE_MOUSELOCK, "mouselock"}, | 105 {CONTENT_SETTINGS_TYPE_MOUSELOCK, "mouselock"}, |
| 106 {CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS, "register-protocol-handler"}, | 106 {CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS, "register-protocol-handler"}, |
| 107 {CONTENT_SETTINGS_TYPE_MEDIASTREAM, "media-stream"}, | 107 {CONTENT_SETTINGS_TYPE_MEDIASTREAM, "media-stream"}, |
| 108 {CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, "media-stream-mic"}, | 108 {CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, "media-stream-mic"}, |
| 109 {CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, "media-stream-camera"}, | 109 {CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, "media-stream-camera"}, |
| 110 {CONTENT_SETTINGS_TYPE_PPAPI_BROKER, "ppapi-broker"}, | 110 {CONTENT_SETTINGS_TYPE_PPAPI_BROKER, "ppapi-broker"}, |
| 111 {CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, "multiple-automatic-downloads"}, | 111 {CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, "multiple-automatic-downloads"}, |
| 112 {CONTENT_SETTINGS_TYPE_MIDI_SYSEX, "midi-sysex"}, | 112 {CONTENT_SETTINGS_TYPE_MIDI_SYSEX, "midi-sysex"}, |
| 113 {CONTENT_SETTINGS_TYPE_PUSH_MESSAGING, "push-messaging"}, | 113 {CONTENT_SETTINGS_TYPE_PUSH_MESSAGING, "push-messaging"}, |
| 114 {CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS, "ssl-cert-decisions"}, |
| 114 #if defined(OS_CHROMEOS) | 115 #if defined(OS_CHROMEOS) |
| 115 {CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER, "protectedContent"}, | 116 {CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER, "protectedContent"}, |
| 116 #endif | 117 #endif |
| 117 }; | 118 }; |
| 118 | 119 |
| 119 // A pseudo content type. We use it to display data like a content setting even | 120 // A pseudo content type. We use it to display data like a content setting even |
| 120 // though it is not a real content setting. | 121 // though it is not a real content setting. |
| 121 const char* kZoomContentType = "zoomlevels"; | 122 const char* kZoomContentType = "zoomlevels"; |
| 122 | 123 |
| 123 content::BrowserContext* GetBrowserContext(content::WebUI* web_ui) { | 124 content::BrowserContext* GetBrowserContext(content::WebUI* web_ui) { |
| (...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 // The content settings type CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE | 742 // The content settings type CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE |
| 742 // is supposed to be set by policy only. Hence there is no user facing UI | 743 // is supposed to be set by policy only. Hence there is no user facing UI |
| 743 // for this content type and we skip it here. | 744 // for this content type and we skip it here. |
| 744 break; | 745 break; |
| 745 case CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS: | 746 case CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS: |
| 746 // The RPH settings are retrieved separately. | 747 // The RPH settings are retrieved separately. |
| 747 break; | 748 break; |
| 748 case CONTENT_SETTINGS_TYPE_MIDI_SYSEX: | 749 case CONTENT_SETTINGS_TYPE_MIDI_SYSEX: |
| 749 UpdateMIDISysExExceptionsView(); | 750 UpdateMIDISysExExceptionsView(); |
| 750 break; | 751 break; |
| 752 case CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS: |
| 753 // The content settings type CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS is |
| 754 // supposed to be set by flags and field trials only, thus there is no |
| 755 // user facing UI for this content type and we skip it here. |
| 756 break; |
| 751 #if defined(OS_WIN) | 757 #if defined(OS_WIN) |
| 752 case CONTENT_SETTINGS_TYPE_METRO_SWITCH_TO_DESKTOP: | 758 case CONTENT_SETTINGS_TYPE_METRO_SWITCH_TO_DESKTOP: |
| 753 break; | 759 break; |
| 754 #endif | 760 #endif |
| 755 default: | 761 default: |
| 756 UpdateExceptionsViewFromHostContentSettingsMap(type); | 762 UpdateExceptionsViewFromHostContentSettingsMap(type); |
| 757 break; | 763 break; |
| 758 } | 764 } |
| 759 } | 765 } |
| 760 | 766 |
| 761 void ContentSettingsHandler::UpdateOTRExceptionsViewFromModel( | 767 void ContentSettingsHandler::UpdateOTRExceptionsViewFromModel( |
| 762 ContentSettingsType type) { | 768 ContentSettingsType type) { |
| 763 switch (type) { | 769 switch (type) { |
| 764 case CONTENT_SETTINGS_TYPE_GEOLOCATION: | 770 case CONTENT_SETTINGS_TYPE_GEOLOCATION: |
| 765 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: | 771 case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: |
| 766 case CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE: | 772 case CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE: |
| 767 case CONTENT_SETTINGS_TYPE_MIXEDSCRIPT: | 773 case CONTENT_SETTINGS_TYPE_MIXEDSCRIPT: |
| 768 #if defined(OS_WIN) | 774 #if defined(OS_WIN) |
| 769 case CONTENT_SETTINGS_TYPE_METRO_SWITCH_TO_DESKTOP: | 775 case CONTENT_SETTINGS_TYPE_METRO_SWITCH_TO_DESKTOP: |
| 770 #endif | 776 #endif |
| 771 case CONTENT_SETTINGS_TYPE_MEDIASTREAM: | 777 case CONTENT_SETTINGS_TYPE_MEDIASTREAM: |
| 772 case CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC: | 778 case CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC: |
| 773 case CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA: | 779 case CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA: |
| 774 case CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS: | 780 case CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS: |
| 775 case CONTENT_SETTINGS_TYPE_MIDI_SYSEX: | 781 case CONTENT_SETTINGS_TYPE_MIDI_SYSEX: |
| 782 case CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS: |
| 776 break; | 783 break; |
| 777 default: | 784 default: |
| 778 UpdateExceptionsViewFromOTRHostContentSettingsMap(type); | 785 UpdateExceptionsViewFromOTRHostContentSettingsMap(type); |
| 779 break; | 786 break; |
| 780 } | 787 } |
| 781 } | 788 } |
| 782 | 789 |
| 783 // TODO(estade): merge with GetExceptionsFromHostContentSettingsMap. | 790 // TODO(estade): merge with GetExceptionsFromHostContentSettingsMap. |
| 784 void ContentSettingsHandler::UpdateGeolocationExceptionsView() { | 791 void ContentSettingsHandler::UpdateGeolocationExceptionsView() { |
| 785 Profile* profile = Profile::FromWebUI(web_ui()); | 792 Profile* profile = Profile::FromWebUI(web_ui()); |
| (...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1567 void ContentSettingsHandler::UpdateProtectedContentExceptionsButton() { | 1574 void ContentSettingsHandler::UpdateProtectedContentExceptionsButton() { |
| 1568 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); | 1575 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); |
| 1569 // Exceptions apply only when the feature is enabled. | 1576 // Exceptions apply only when the feature is enabled. |
| 1570 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); | 1577 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); |
| 1571 web_ui()->CallJavascriptFunction( | 1578 web_ui()->CallJavascriptFunction( |
| 1572 "ContentSettings.enableProtectedContentExceptions", | 1579 "ContentSettings.enableProtectedContentExceptions", |
| 1573 base::FundamentalValue(enable_exceptions)); | 1580 base::FundamentalValue(enable_exceptions)); |
| 1574 } | 1581 } |
| 1575 | 1582 |
| 1576 } // namespace options | 1583 } // namespace options |
| OLD | NEW |