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 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 AllPatternsSettings; | 80 AllPatternsSettings; |
81 | 81 |
82 // The AppFilter is used in AddExceptionsGrantedByHostedApps() to choose | 82 // The AppFilter is used in AddExceptionsGrantedByHostedApps() to choose |
83 // extensions which should have their extent displayed. | 83 // extensions which should have their extent displayed. |
84 typedef bool (*AppFilter)(const extensions::Extension& app, | 84 typedef bool (*AppFilter)(const extensions::Extension& app, |
85 content::BrowserContext* profile); | 85 content::BrowserContext* profile); |
86 | 86 |
87 const char kExceptionsLearnMoreUrl[] = | 87 const char kExceptionsLearnMoreUrl[] = |
88 "https://support.google.com/chrome/?p=settings_manage_exceptions"; | 88 "https://support.google.com/chrome/?p=settings_manage_exceptions"; |
89 | 89 |
90 const char* kSetting = "setting"; | 90 const char kSetting[] = "setting"; |
91 const char* kOrigin = "origin"; | 91 const char kOrigin[] = "origin"; |
92 const char* kSource = "source"; | 92 const char kSource[] = "source"; |
93 const char* kAppName = "appName"; | 93 const char kAppName[] = "appName"; |
94 const char* kAppId = "appId"; | 94 const char kAppId[] = "appId"; |
95 const char* kEmbeddingOrigin = "embeddingOrigin"; | 95 const char kEmbeddingOrigin[] = "embeddingOrigin"; |
96 const char* kPreferencesSource = "preference"; | 96 const char kPreferencesSource[] = "preference"; |
97 const char* kVideoSetting = "video"; | 97 const char kVideoSetting[] = "video"; |
98 const char* kZoom = "zoom"; | 98 const char kZoom[] = "zoom"; |
99 | 99 |
100 const ContentSettingsTypeNameEntry kContentSettingsTypeGroupNames[] = { | 100 const ContentSettingsTypeNameEntry kContentSettingsTypeGroupNames[] = { |
101 {CONTENT_SETTINGS_TYPE_COOKIES, "cookies"}, | 101 {CONTENT_SETTINGS_TYPE_COOKIES, "cookies"}, |
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 {CONTENT_SETTINGS_TYPE_MEDIASTREAM, "media-stream"}, | 112 {CONTENT_SETTINGS_TYPE_MEDIASTREAM, "media-stream"}, |
113 {CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, "media-stream-mic"}, | 113 {CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, "media-stream-mic"}, |
114 {CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, "media-stream-camera"}, | 114 {CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, "media-stream-camera"}, |
115 {CONTENT_SETTINGS_TYPE_PPAPI_BROKER, "ppapi-broker"}, | 115 {CONTENT_SETTINGS_TYPE_PPAPI_BROKER, "ppapi-broker"}, |
116 {CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, "multiple-automatic-downloads"}, | 116 {CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, "multiple-automatic-downloads"}, |
117 {CONTENT_SETTINGS_TYPE_MIDI_SYSEX, "midi-sysex"}, | 117 {CONTENT_SETTINGS_TYPE_MIDI_SYSEX, "midi-sysex"}, |
118 {CONTENT_SETTINGS_TYPE_PUSH_MESSAGING, "push-messaging"}, | 118 {CONTENT_SETTINGS_TYPE_PUSH_MESSAGING, "push-messaging"}, |
119 {CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS, "ssl-cert-decisions"}, | 119 {CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS, "ssl-cert-decisions"}, |
120 #if defined(OS_CHROMEOS) | 120 #if defined(OS_CHROMEOS) |
121 {CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER, "protectedContent"}, | 121 {CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER, "protectedContent"}, |
122 #endif | 122 #endif |
123 }; | 123 }; |
124 | 124 |
125 // A pseudo content type. We use it to display data like a content setting even | 125 // A pseudo content type. We use it to display data like a content setting even |
126 // though it is not a real content setting. | 126 // though it is not a real content setting. |
127 const char* kZoomContentType = "zoomlevels"; | 127 const char kZoomContentType[] = "zoomlevels"; |
128 | 128 |
129 content::BrowserContext* GetBrowserContext(content::WebUI* web_ui) { | 129 content::BrowserContext* GetBrowserContext(content::WebUI* web_ui) { |
130 return web_ui->GetWebContents()->GetBrowserContext(); | 130 return web_ui->GetWebContents()->GetBrowserContext(); |
131 } | 131 } |
132 | 132 |
133 ContentSettingsType ContentSettingsTypeFromGroupName(const std::string& name) { | 133 ContentSettingsType ContentSettingsTypeFromGroupName(const std::string& name) { |
134 for (size_t i = 0; i < arraysize(kContentSettingsTypeGroupNames); ++i) { | 134 for (size_t i = 0; i < arraysize(kContentSettingsTypeGroupNames); ++i) { |
135 if (name == kContentSettingsTypeGroupNames[i].name) | 135 if (name == kContentSettingsTypeGroupNames[i].name) |
136 return kContentSettingsTypeGroupNames[i].type; | 136 return kContentSettingsTypeGroupNames[i].type; |
137 } | 137 } |
(...skipping 1463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1601 | 1601 |
1602 // Exceptions apply only when the feature is enabled. | 1602 // Exceptions apply only when the feature is enabled. |
1603 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); | 1603 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); |
1604 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); | 1604 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); |
1605 web_ui()->CallJavascriptFunction( | 1605 web_ui()->CallJavascriptFunction( |
1606 "ContentSettings.enableProtectedContentExceptions", | 1606 "ContentSettings.enableProtectedContentExceptions", |
1607 base::FundamentalValue(enable_exceptions)); | 1607 base::FundamentalValue(enable_exceptions)); |
1608 } | 1608 } |
1609 | 1609 |
1610 } // namespace options | 1610 } // namespace options |
OLD | NEW |