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

Side by Side Diff: chrome/browser/ui/webui/options/content_settings_handler.cc

Issue 543983005: Add a dropdown to change the default content setting to the Website Settings page. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix CrOS build error. Created 6 years, 3 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 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 ContentSettingsHandler::ContentSettingsHandler() : observer_(this) { 266 ContentSettingsHandler::ContentSettingsHandler() : observer_(this) {
267 } 267 }
268 268
269 ContentSettingsHandler::~ContentSettingsHandler() { 269 ContentSettingsHandler::~ContentSettingsHandler() {
270 } 270 }
271 271
272 void ContentSettingsHandler::GetLocalizedValues( 272 void ContentSettingsHandler::GetLocalizedValues(
273 base::DictionaryValue* localized_strings) { 273 base::DictionaryValue* localized_strings) {
274 DCHECK(localized_strings); 274 DCHECK(localized_strings);
275 275
276 // TODO(dhnishi): Standardize to lowerCamelCase.
276 static OptionsStringResource resources[] = { 277 static OptionsStringResource resources[] = {
277 { "allowException", IDS_EXCEPTIONS_ALLOW_BUTTON }, 278 { "allowException", IDS_EXCEPTIONS_ALLOW_BUTTON },
278 { "blockException", IDS_EXCEPTIONS_BLOCK_BUTTON }, 279 { "blockException", IDS_EXCEPTIONS_BLOCK_BUTTON },
279 { "sessionException", IDS_EXCEPTIONS_SESSION_ONLY_BUTTON }, 280 { "sessionException", IDS_EXCEPTIONS_SESSION_ONLY_BUTTON },
280 { "askException", IDS_EXCEPTIONS_ASK_BUTTON }, 281 { "askException", IDS_EXCEPTIONS_ASK_BUTTON },
281 { "otr_exceptions_explanation", IDS_EXCEPTIONS_OTR_LABEL }, 282 { "otr_exceptions_explanation", IDS_EXCEPTIONS_OTR_LABEL },
282 { "addNewExceptionInstructions", IDS_EXCEPTIONS_ADD_NEW_INSTRUCTIONS }, 283 { "addNewExceptionInstructions", IDS_EXCEPTIONS_ADD_NEW_INSTRUCTIONS },
283 { "manageExceptions", IDS_EXCEPTIONS_MANAGE }, 284 { "manageExceptions", IDS_EXCEPTIONS_MANAGE },
284 { "manage_handlers", IDS_HANDLERS_MANAGE }, 285 { "manage_handlers", IDS_HANDLERS_MANAGE },
285 { "exceptionPatternHeader", IDS_EXCEPTIONS_PATTERN_HEADER }, 286 { "exceptionPatternHeader", IDS_EXCEPTIONS_PATTERN_HEADER },
286 { "exceptionBehaviorHeader", IDS_EXCEPTIONS_ACTION_HEADER }, 287 { "exceptionBehaviorHeader", IDS_EXCEPTIONS_ACTION_HEADER },
287 { "exceptionZoomHeader", IDS_EXCEPTIONS_ZOOM_HEADER }, 288 { "exceptionZoomHeader", IDS_EXCEPTIONS_ZOOM_HEADER },
288 { "embeddedOnHost", IDS_EXCEPTIONS_GEOLOCATION_EMBEDDED_ON_HOST }, 289 { "embeddedOnHost", IDS_EXCEPTIONS_GEOLOCATION_EMBEDDED_ON_HOST },
289 // Cookies filter. 290 // Cookies filter.
290 { "cookies_tab_label", IDS_COOKIES_TAB_LABEL }, 291 { "cookies_tab_label", IDS_COOKIES_TAB_LABEL },
291 { "cookies_header", IDS_COOKIES_HEADER }, 292 { "cookies_header", IDS_COOKIES_HEADER },
292 { "cookies_allow", IDS_COOKIES_ALLOW_RADIO }, 293 { "cookiesAllow", IDS_COOKIES_ALLOW_RADIO },
293 { "cookies_block", IDS_COOKIES_BLOCK_RADIO }, 294 { "cookiesBlock", IDS_COOKIES_BLOCK_RADIO },
294 { "cookies_session_only", IDS_COOKIES_SESSION_ONLY_RADIO }, 295 { "cookies_session_only", IDS_COOKIES_SESSION_ONLY_RADIO },
295 { "cookies_block_3rd_party", IDS_COOKIES_BLOCK_3RDPARTY_CHKBOX }, 296 { "cookies_block_3rd_party", IDS_COOKIES_BLOCK_3RDPARTY_CHKBOX },
296 { "cookies_clear_when_close", IDS_COOKIES_CLEAR_WHEN_CLOSE_CHKBOX }, 297 { "cookies_clear_when_close", IDS_COOKIES_CLEAR_WHEN_CLOSE_CHKBOX },
297 { "cookies_lso_clear_when_close", IDS_COOKIES_LSO_CLEAR_WHEN_CLOSE_CHKBOX }, 298 { "cookies_lso_clear_when_close", IDS_COOKIES_LSO_CLEAR_WHEN_CLOSE_CHKBOX },
298 { "cookies_show_cookies", IDS_COOKIES_SHOW_COOKIES_BUTTON }, 299 { "cookies_show_cookies", IDS_COOKIES_SHOW_COOKIES_BUTTON },
299 { "flash_storage_settings", IDS_FLASH_STORAGE_SETTINGS }, 300 { "flash_storage_settings", IDS_FLASH_STORAGE_SETTINGS },
300 { "flash_storage_url", IDS_FLASH_STORAGE_URL }, 301 { "flash_storage_url", IDS_FLASH_STORAGE_URL },
301 #if defined(ENABLE_GOOGLE_NOW) 302 #if defined(ENABLE_GOOGLE_NOW)
302 { "googleGeolocationAccessEnable", 303 { "googleGeolocationAccessEnable",
303 IDS_GEOLOCATION_GOOGLE_ACCESS_ENABLE_CHKBOX }, 304 IDS_GEOLOCATION_GOOGLE_ACCESS_ENABLE_CHKBOX },
304 #endif 305 #endif
305 // Image filter. 306 // Image filter.
306 { "images_tab_label", IDS_IMAGES_TAB_LABEL }, 307 { "images_tab_label", IDS_IMAGES_TAB_LABEL },
307 { "images_header", IDS_IMAGES_HEADER }, 308 { "images_header", IDS_IMAGES_HEADER },
308 { "images_allow", IDS_IMAGES_LOAD_RADIO }, 309 { "imagesAllow", IDS_IMAGES_LOAD_RADIO },
309 { "images_block", IDS_IMAGES_NOLOAD_RADIO }, 310 { "imagesBlock", IDS_IMAGES_NOLOAD_RADIO },
310 // JavaScript filter. 311 // JavaScript filter.
311 { "javascript_tab_label", IDS_JAVASCRIPT_TAB_LABEL }, 312 { "javascript_tab_label", IDS_JAVASCRIPT_TAB_LABEL },
312 { "javascript_header", IDS_JAVASCRIPT_HEADER }, 313 { "javascript_header", IDS_JAVASCRIPT_HEADER },
313 { "javascript_allow", IDS_JS_ALLOW_RADIO }, 314 { "javascriptAllow", IDS_JS_ALLOW_RADIO },
314 { "javascript_block", IDS_JS_DONOTALLOW_RADIO }, 315 { "javascriptBlock", IDS_JS_DONOTALLOW_RADIO },
315 // Plug-ins filter. 316 // Plug-ins filter.
316 { "plugins_tab_label", IDS_PLUGIN_TAB_LABEL }, 317 { "plugins_tab_label", IDS_PLUGIN_TAB_LABEL },
317 { "plugins_header", IDS_PLUGIN_HEADER }, 318 { "plugins_header", IDS_PLUGIN_HEADER },
318 { "plugins_ask", IDS_PLUGIN_ASK_RADIO }, 319 { "pluginsAsk", IDS_PLUGIN_ASK_RADIO },
319 { "plugins_allow", IDS_PLUGIN_LOAD_RADIO }, 320 { "pluginsAllow", IDS_PLUGIN_LOAD_RADIO },
320 { "plugins_block", IDS_PLUGIN_NOLOAD_RADIO }, 321 { "pluginsBlock", IDS_PLUGIN_NOLOAD_RADIO },
321 { "disableIndividualPlugins", IDS_PLUGIN_SELECTIVE_DISABLE }, 322 { "disableIndividualPlugins", IDS_PLUGIN_SELECTIVE_DISABLE },
322 // Pop-ups filter. 323 // Pop-ups filter.
323 { "popups_tab_label", IDS_POPUP_TAB_LABEL }, 324 { "popups_tab_label", IDS_POPUP_TAB_LABEL },
324 { "popups_header", IDS_POPUP_HEADER }, 325 { "popups_header", IDS_POPUP_HEADER },
325 { "popups_allow", IDS_POPUP_ALLOW_RADIO }, 326 { "popupsAllow", IDS_POPUP_ALLOW_RADIO },
326 { "popups_block", IDS_POPUP_BLOCK_RADIO }, 327 { "popupsBlock", IDS_POPUP_BLOCK_RADIO },
327 // Location filter. 328 // Location filter.
328 { "location_tab_label", IDS_GEOLOCATION_TAB_LABEL }, 329 { "location_tab_label", IDS_GEOLOCATION_TAB_LABEL },
329 { "location_header", IDS_GEOLOCATION_HEADER }, 330 { "location_header", IDS_GEOLOCATION_HEADER },
330 { "location_allow", IDS_GEOLOCATION_ALLOW_RADIO }, 331 { "locationAllow", IDS_GEOLOCATION_ALLOW_RADIO },
331 { "location_ask", IDS_GEOLOCATION_ASK_RADIO }, 332 { "locationAsk", IDS_GEOLOCATION_ASK_RADIO },
332 { "location_block", IDS_GEOLOCATION_BLOCK_RADIO }, 333 { "locationBlock", IDS_GEOLOCATION_BLOCK_RADIO },
333 { "set_by", IDS_GEOLOCATION_SET_BY_HOVER }, 334 { "set_by", IDS_GEOLOCATION_SET_BY_HOVER },
334 // Notifications filter. 335 // Notifications filter.
335 { "notifications_tab_label", IDS_NOTIFICATIONS_TAB_LABEL }, 336 { "notifications_tab_label", IDS_NOTIFICATIONS_TAB_LABEL },
336 { "notifications_header", IDS_NOTIFICATIONS_HEADER }, 337 { "notifications_header", IDS_NOTIFICATIONS_HEADER },
337 { "notifications_allow", IDS_NOTIFICATIONS_ALLOW_RADIO }, 338 { "notificationsAllow", IDS_NOTIFICATIONS_ALLOW_RADIO },
338 { "notifications_ask", IDS_NOTIFICATIONS_ASK_RADIO }, 339 { "notificationsAsk", IDS_NOTIFICATIONS_ASK_RADIO },
339 { "notifications_block", IDS_NOTIFICATIONS_BLOCK_RADIO }, 340 { "notificationsBlock", IDS_NOTIFICATIONS_BLOCK_RADIO },
340 // Fullscreen filter. 341 // Fullscreen filter.
341 { "fullscreen_tab_label", IDS_FULLSCREEN_TAB_LABEL }, 342 { "fullscreen_tab_label", IDS_FULLSCREEN_TAB_LABEL },
342 { "fullscreen_header", IDS_FULLSCREEN_HEADER }, 343 { "fullscreen_header", IDS_FULLSCREEN_HEADER },
343 // Mouse Lock filter. 344 // Mouse Lock filter.
344 { "mouselock_tab_label", IDS_MOUSE_LOCK_TAB_LABEL }, 345 { "mouselock_tab_label", IDS_MOUSE_LOCK_TAB_LABEL },
345 { "mouselock_header", IDS_MOUSE_LOCK_HEADER }, 346 { "mouselock_header", IDS_MOUSE_LOCK_HEADER },
346 { "mouselock_allow", IDS_MOUSE_LOCK_ALLOW_RADIO }, 347 { "mouselockAllow", IDS_MOUSE_LOCK_ALLOW_RADIO },
347 { "mouselock_ask", IDS_MOUSE_LOCK_ASK_RADIO }, 348 { "mouselockAsk", IDS_MOUSE_LOCK_ASK_RADIO },
348 { "mouselock_block", IDS_MOUSE_LOCK_BLOCK_RADIO }, 349 { "mouselockBlock", IDS_MOUSE_LOCK_BLOCK_RADIO },
349 #if defined(OS_CHROMEOS) || defined(OS_WIN) 350 #if defined(OS_CHROMEOS) || defined(OS_WIN)
350 // Protected Content filter 351 // Protected Content filter
351 { "protectedContentTabLabel", IDS_PROTECTED_CONTENT_TAB_LABEL }, 352 { "protectedContentTabLabel", IDS_PROTECTED_CONTENT_TAB_LABEL },
352 { "protectedContentInfo", IDS_PROTECTED_CONTENT_INFO }, 353 { "protectedContentInfo", IDS_PROTECTED_CONTENT_INFO },
353 { "protectedContentEnable", IDS_PROTECTED_CONTENT_ENABLE }, 354 { "protectedContentEnable", IDS_PROTECTED_CONTENT_ENABLE },
354 { "protectedContent_header", IDS_PROTECTED_CONTENT_HEADER }, 355 { "protectedContent_header", IDS_PROTECTED_CONTENT_HEADER },
355 #endif // defined(OS_CHROMEOS) || defined(OS_WIN) 356 #endif // defined(OS_CHROMEOS) || defined(OS_WIN)
356 // Media stream capture device filter. 357 // Media stream capture device filter.
357 { "mediaStreamTabLabel", IDS_MEDIA_STREAM_TAB_LABEL }, 358 { "mediaStreamTabLabel", IDS_MEDIA_STREAM_TAB_LABEL },
358 { "media-stream_header", IDS_MEDIA_STREAM_HEADER }, 359 { "media-stream_header", IDS_MEDIA_STREAM_HEADER },
(...skipping 10 matching lines...) Expand all
369 { "mediaPepperFlashDefaultDivergedLabel", 370 { "mediaPepperFlashDefaultDivergedLabel",
370 IDS_MEDIA_PEPPER_FLASH_DEFAULT_DIVERGED_LABEL }, 371 IDS_MEDIA_PEPPER_FLASH_DEFAULT_DIVERGED_LABEL },
371 { "mediaPepperFlashExceptionsDivergedLabel", 372 { "mediaPepperFlashExceptionsDivergedLabel",
372 IDS_MEDIA_PEPPER_FLASH_EXCEPTIONS_DIVERGED_LABEL }, 373 IDS_MEDIA_PEPPER_FLASH_EXCEPTIONS_DIVERGED_LABEL },
373 { "mediaPepperFlashChangeLink", IDS_MEDIA_PEPPER_FLASH_CHANGE_LINK }, 374 { "mediaPepperFlashChangeLink", IDS_MEDIA_PEPPER_FLASH_CHANGE_LINK },
374 { "mediaPepperFlashGlobalPrivacyURL", IDS_FLASH_GLOBAL_PRIVACY_URL }, 375 { "mediaPepperFlashGlobalPrivacyURL", IDS_FLASH_GLOBAL_PRIVACY_URL },
375 { "mediaPepperFlashWebsitePrivacyURL", IDS_FLASH_WEBSITE_PRIVACY_URL }, 376 { "mediaPepperFlashWebsitePrivacyURL", IDS_FLASH_WEBSITE_PRIVACY_URL },
376 // PPAPI broker filter. 377 // PPAPI broker filter.
377 { "ppapi-broker_header", IDS_PPAPI_BROKER_HEADER }, 378 { "ppapi-broker_header", IDS_PPAPI_BROKER_HEADER },
378 { "ppapiBrokerTabLabel", IDS_PPAPI_BROKER_TAB_LABEL }, 379 { "ppapiBrokerTabLabel", IDS_PPAPI_BROKER_TAB_LABEL },
379 { "ppapi_broker_allow", IDS_PPAPI_BROKER_ALLOW_RADIO }, 380 { "ppapiBrokerAllow", IDS_PPAPI_BROKER_ALLOW_RADIO },
380 { "ppapi_broker_ask", IDS_PPAPI_BROKER_ASK_RADIO }, 381 { "ppapiBrokerAsk", IDS_PPAPI_BROKER_ASK_RADIO },
381 { "ppapi_broker_block", IDS_PPAPI_BROKER_BLOCK_RADIO }, 382 { "ppapiBrokerBlock", IDS_PPAPI_BROKER_BLOCK_RADIO },
382 // Multiple automatic downloads 383 // Multiple automatic downloads
383 { "multiple-automatic-downloads_header", 384 { "multiple-automatic-downloads_header",
384 IDS_AUTOMATIC_DOWNLOADS_TAB_LABEL }, 385 IDS_AUTOMATIC_DOWNLOADS_TAB_LABEL },
385 { "multiple-automatic-downloads_allow", 386 { "multipleAutomaticDownloadsAllow",
386 IDS_AUTOMATIC_DOWNLOADS_ALLOW_RADIO }, 387 IDS_AUTOMATIC_DOWNLOADS_ALLOW_RADIO },
387 { "multiple-automatic-downloads_ask", 388 { "multipleAutomaticDownloadsAsk",
388 IDS_AUTOMATIC_DOWNLOADS_ASK_RADIO }, 389 IDS_AUTOMATIC_DOWNLOADS_ASK_RADIO },
389 { "multiple-automatic-downloads_block", 390 { "multipleAutomaticDownloadsBlock",
390 IDS_AUTOMATIC_DOWNLOADS_BLOCK_RADIO }, 391 IDS_AUTOMATIC_DOWNLOADS_BLOCK_RADIO },
391 // MIDI system exclusive messages 392 // MIDI system exclusive messages
392 { "midi-sysex_header", IDS_MIDI_SYSEX_TAB_LABEL }, 393 { "midi-sysex_header", IDS_MIDI_SYSEX_TAB_LABEL },
393 { "midiSysExAllow", IDS_MIDI_SYSEX_ALLOW_RADIO }, 394 { "midiSysExAllow", IDS_MIDI_SYSEX_ALLOW_RADIO },
394 { "midiSysExAsk", IDS_MIDI_SYSEX_ASK_RADIO }, 395 { "midiSysExAsk", IDS_MIDI_SYSEX_ASK_RADIO },
395 { "midiSysExBlock", IDS_MIDI_SYSEX_BLOCK_RADIO }, 396 { "midiSysExBlock", IDS_MIDI_SYSEX_BLOCK_RADIO },
396 // Push messaging strings 397 // Push messaging strings
397 { "push-messaging_header", IDS_PUSH_MESSAGES_TAB_LABEL }, 398 { "push-messaging_header", IDS_PUSH_MESSAGES_TAB_LABEL },
398 { "pushMessagingAllow", IDS_PUSH_MESSSAGING_ALLOW_RADIO }, 399 { "pushMessagingAllow", IDS_PUSH_MESSSAGING_ALLOW_RADIO },
399 { "pushMessagingAsk", IDS_PUSH_MESSSAGING_ASK_RADIO }, 400 { "pushMessagingAsk", IDS_PUSH_MESSSAGING_ASK_RADIO },
(...skipping 1109 matching lines...) Expand 10 before | Expand all | Expand 10 after
1509 void ContentSettingsHandler::UpdateProtectedContentExceptionsButton() { 1510 void ContentSettingsHandler::UpdateProtectedContentExceptionsButton() {
1510 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); 1511 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui()));
1511 // Exceptions apply only when the feature is enabled. 1512 // Exceptions apply only when the feature is enabled.
1512 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); 1513 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM);
1513 web_ui()->CallJavascriptFunction( 1514 web_ui()->CallJavascriptFunction(
1514 "ContentSettings.enableProtectedContentExceptions", 1515 "ContentSettings.enableProtectedContentExceptions",
1515 base::FundamentalValue(enable_exceptions)); 1516 base::FundamentalValue(enable_exceptions));
1516 } 1517 }
1517 1518
1518 } // namespace options 1519 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698