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

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

Issue 796543002: Plugin Power Saver: Implement option in Settings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: "Fix" a browser test by disabling it. Fix a nit. Created 6 years 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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 274
275 ContentSettingsHandler::~ContentSettingsHandler() { 275 ContentSettingsHandler::~ContentSettingsHandler() {
276 } 276 }
277 277
278 void ContentSettingsHandler::GetLocalizedValues( 278 void ContentSettingsHandler::GetLocalizedValues(
279 base::DictionaryValue* localized_strings) { 279 base::DictionaryValue* localized_strings) {
280 DCHECK(localized_strings); 280 DCHECK(localized_strings);
281 281
282 // TODO(dhnishi): Standardize to lowerCamelCase. 282 // TODO(dhnishi): Standardize to lowerCamelCase.
283 static OptionsStringResource resources[] = { 283 static OptionsStringResource resources[] = {
284 { "allowException", IDS_EXCEPTIONS_ALLOW_BUTTON }, 284 {"allowException", IDS_EXCEPTIONS_ALLOW_BUTTON},
285 { "blockException", IDS_EXCEPTIONS_BLOCK_BUTTON }, 285 {"blockException", IDS_EXCEPTIONS_BLOCK_BUTTON},
286 { "sessionException", IDS_EXCEPTIONS_SESSION_ONLY_BUTTON }, 286 {"sessionException", IDS_EXCEPTIONS_SESSION_ONLY_BUTTON},
287 { "askException", IDS_EXCEPTIONS_ASK_BUTTON }, 287 {"detectException", IDS_EXCEPTIONS_DETECT_IMPORTANT_CONTENT_BUTTON},
288 { "otr_exceptions_explanation", IDS_EXCEPTIONS_OTR_LABEL }, 288 {"askException", IDS_EXCEPTIONS_ASK_BUTTON},
289 { "addNewExceptionInstructions", IDS_EXCEPTIONS_ADD_NEW_INSTRUCTIONS }, 289 {"otr_exceptions_explanation", IDS_EXCEPTIONS_OTR_LABEL},
290 { "manageExceptions", IDS_EXCEPTIONS_MANAGE }, 290 {"addNewExceptionInstructions", IDS_EXCEPTIONS_ADD_NEW_INSTRUCTIONS},
291 { "manage_handlers", IDS_HANDLERS_MANAGE }, 291 {"manageExceptions", IDS_EXCEPTIONS_MANAGE},
292 { "exceptionPatternHeader", IDS_EXCEPTIONS_PATTERN_HEADER }, 292 {"manage_handlers", IDS_HANDLERS_MANAGE},
293 { "exceptionBehaviorHeader", IDS_EXCEPTIONS_ACTION_HEADER }, 293 {"exceptionPatternHeader", IDS_EXCEPTIONS_PATTERN_HEADER},
294 { "exceptionZoomHeader", IDS_EXCEPTIONS_ZOOM_HEADER }, 294 {"exceptionBehaviorHeader", IDS_EXCEPTIONS_ACTION_HEADER},
295 { "embeddedOnHost", IDS_EXCEPTIONS_GEOLOCATION_EMBEDDED_ON_HOST }, 295 {"exceptionZoomHeader", IDS_EXCEPTIONS_ZOOM_HEADER},
296 {"embeddedOnHost", IDS_EXCEPTIONS_GEOLOCATION_EMBEDDED_ON_HOST},
296 // Cookies filter. 297 // Cookies filter.
297 { "cookiesTabLabel", IDS_COOKIES_TAB_LABEL }, 298 {"cookiesTabLabel", IDS_COOKIES_TAB_LABEL},
298 { "cookies_header", IDS_COOKIES_HEADER }, 299 {"cookies_header", IDS_COOKIES_HEADER},
299 { "cookiesAllow", IDS_COOKIES_ALLOW_RADIO }, 300 {"cookiesAllow", IDS_COOKIES_ALLOW_RADIO},
300 { "cookiesBlock", IDS_COOKIES_BLOCK_RADIO }, 301 {"cookiesBlock", IDS_COOKIES_BLOCK_RADIO},
301 { "cookies_session_only", IDS_COOKIES_SESSION_ONLY_RADIO }, 302 {"cookies_session_only", IDS_COOKIES_SESSION_ONLY_RADIO},
302 { "cookies_block_3rd_party", IDS_COOKIES_BLOCK_3RDPARTY_CHKBOX }, 303 {"cookies_block_3rd_party", IDS_COOKIES_BLOCK_3RDPARTY_CHKBOX},
303 { "cookies_clear_when_close", IDS_COOKIES_CLEAR_WHEN_CLOSE_CHKBOX }, 304 {"cookies_clear_when_close", IDS_COOKIES_CLEAR_WHEN_CLOSE_CHKBOX},
304 { "cookies_lso_clear_when_close", IDS_COOKIES_LSO_CLEAR_WHEN_CLOSE_CHKBOX }, 305 {"cookies_lso_clear_when_close", IDS_COOKIES_LSO_CLEAR_WHEN_CLOSE_CHKBOX},
305 { "cookies_show_cookies", IDS_COOKIES_SHOW_COOKIES_BUTTON }, 306 {"cookies_show_cookies", IDS_COOKIES_SHOW_COOKIES_BUTTON},
306 { "flash_storage_settings", IDS_FLASH_STORAGE_SETTINGS }, 307 {"flash_storage_settings", IDS_FLASH_STORAGE_SETTINGS},
307 { "flash_storage_url", IDS_FLASH_STORAGE_URL }, 308 {"flash_storage_url", IDS_FLASH_STORAGE_URL},
308 #if defined(ENABLE_GOOGLE_NOW) 309 #if defined(ENABLE_GOOGLE_NOW)
309 { "googleGeolocationAccessEnable", 310 {"googleGeolocationAccessEnable",
310 IDS_GEOLOCATION_GOOGLE_ACCESS_ENABLE_CHKBOX }, 311 IDS_GEOLOCATION_GOOGLE_ACCESS_ENABLE_CHKBOX},
311 #endif 312 #endif
312 // Image filter. 313 // Image filter.
313 { "imagesTabLabel", IDS_IMAGES_TAB_LABEL }, 314 {"imagesTabLabel", IDS_IMAGES_TAB_LABEL},
314 { "images_header", IDS_IMAGES_HEADER }, 315 {"images_header", IDS_IMAGES_HEADER},
315 { "imagesAllow", IDS_IMAGES_LOAD_RADIO }, 316 {"imagesAllow", IDS_IMAGES_LOAD_RADIO},
316 { "imagesBlock", IDS_IMAGES_NOLOAD_RADIO }, 317 {"imagesBlock", IDS_IMAGES_NOLOAD_RADIO},
317 // JavaScript filter. 318 // JavaScript filter.
318 { "javascriptTabLabel", IDS_JAVASCRIPT_TAB_LABEL }, 319 {"javascriptTabLabel", IDS_JAVASCRIPT_TAB_LABEL},
319 { "javascript_header", IDS_JAVASCRIPT_HEADER }, 320 {"javascript_header", IDS_JAVASCRIPT_HEADER},
320 { "javascriptAllow", IDS_JS_ALLOW_RADIO }, 321 {"javascriptAllow", IDS_JS_ALLOW_RADIO},
321 { "javascriptBlock", IDS_JS_DONOTALLOW_RADIO }, 322 {"javascriptBlock", IDS_JS_DONOTALLOW_RADIO},
322 // Plug-ins filter. 323 // Plug-ins filter.
323 { "pluginsTabLabel", IDS_PLUGIN_TAB_LABEL }, 324 {"pluginsTabLabel", IDS_PLUGIN_TAB_LABEL},
324 { "plugins_header", IDS_PLUGIN_HEADER }, 325 {"plugins_header", IDS_PLUGIN_HEADER},
325 { "pluginsAsk", IDS_PLUGIN_ASK_RADIO }, 326 {"pluginsAllow", IDS_PLUGIN_ALLOW_RADIO},
326 { "pluginsAllow", IDS_PLUGIN_LOAD_RADIO }, 327 {"pluginsDetect", IDS_PLUGIN_DETECT_RADIO},
327 { "pluginsBlock", IDS_PLUGIN_ASK_MENU_RADIO }, 328 {"pluginsBlock", IDS_PLUGIN_BLOCK_RADIO},
328 { "disableIndividualPlugins", IDS_PLUGIN_SELECTIVE_DISABLE }, 329 {"disableIndividualPlugins", IDS_PLUGIN_SELECTIVE_DISABLE},
329 // Pop-ups filter. 330 // Pop-ups filter.
330 { "popupsTabLabel", IDS_POPUP_TAB_LABEL }, 331 {"popupsTabLabel", IDS_POPUP_TAB_LABEL},
331 { "popups_header", IDS_POPUP_HEADER }, 332 {"popups_header", IDS_POPUP_HEADER},
332 { "popupsAllow", IDS_POPUP_ALLOW_RADIO }, 333 {"popupsAllow", IDS_POPUP_ALLOW_RADIO},
333 { "popupsBlock", IDS_POPUP_BLOCK_RADIO }, 334 {"popupsBlock", IDS_POPUP_BLOCK_RADIO},
334 // Location filter. 335 // Location filter.
335 { "locationTabLabel", IDS_GEOLOCATION_TAB_LABEL }, 336 {"locationTabLabel", IDS_GEOLOCATION_TAB_LABEL},
336 { "location_header", IDS_GEOLOCATION_HEADER }, 337 {"location_header", IDS_GEOLOCATION_HEADER},
337 { "locationAllow", IDS_GEOLOCATION_ALLOW_RADIO }, 338 {"locationAllow", IDS_GEOLOCATION_ALLOW_RADIO},
338 { "locationAsk", IDS_GEOLOCATION_ASK_RADIO }, 339 {"locationAsk", IDS_GEOLOCATION_ASK_RADIO},
339 { "locationBlock", IDS_GEOLOCATION_BLOCK_RADIO }, 340 {"locationBlock", IDS_GEOLOCATION_BLOCK_RADIO},
340 { "set_by", IDS_GEOLOCATION_SET_BY_HOVER }, 341 {"set_by", IDS_GEOLOCATION_SET_BY_HOVER},
341 // Notifications filter. 342 // Notifications filter.
342 { "notificationsTabLabel", IDS_NOTIFICATIONS_TAB_LABEL }, 343 {"notificationsTabLabel", IDS_NOTIFICATIONS_TAB_LABEL},
343 { "notifications_header", IDS_NOTIFICATIONS_HEADER }, 344 {"notifications_header", IDS_NOTIFICATIONS_HEADER},
344 { "notificationsAllow", IDS_NOTIFICATIONS_ALLOW_RADIO }, 345 {"notificationsAllow", IDS_NOTIFICATIONS_ALLOW_RADIO},
345 { "notificationsAsk", IDS_NOTIFICATIONS_ASK_RADIO }, 346 {"notificationsAsk", IDS_NOTIFICATIONS_ASK_RADIO},
346 { "notificationsBlock", IDS_NOTIFICATIONS_BLOCK_RADIO }, 347 {"notificationsBlock", IDS_NOTIFICATIONS_BLOCK_RADIO},
347 // Fullscreen filter. 348 // Fullscreen filter.
348 { "fullscreenTabLabel", IDS_FULLSCREEN_TAB_LABEL }, 349 {"fullscreenTabLabel", IDS_FULLSCREEN_TAB_LABEL},
349 { "fullscreen_header", IDS_FULLSCREEN_HEADER }, 350 {"fullscreen_header", IDS_FULLSCREEN_HEADER},
350 // Mouse Lock filter. 351 // Mouse Lock filter.
351 { "mouselockTabLabel", IDS_MOUSE_LOCK_TAB_LABEL }, 352 {"mouselockTabLabel", IDS_MOUSE_LOCK_TAB_LABEL},
352 { "mouselock_header", IDS_MOUSE_LOCK_HEADER }, 353 {"mouselock_header", IDS_MOUSE_LOCK_HEADER},
353 { "mouselockAllow", IDS_MOUSE_LOCK_ALLOW_RADIO }, 354 {"mouselockAllow", IDS_MOUSE_LOCK_ALLOW_RADIO},
354 { "mouselockAsk", IDS_MOUSE_LOCK_ASK_RADIO }, 355 {"mouselockAsk", IDS_MOUSE_LOCK_ASK_RADIO},
355 { "mouselockBlock", IDS_MOUSE_LOCK_BLOCK_RADIO }, 356 {"mouselockBlock", IDS_MOUSE_LOCK_BLOCK_RADIO},
356 #if defined(OS_CHROMEOS) || defined(OS_WIN) 357 #if defined(OS_CHROMEOS) || defined(OS_WIN)
357 // Protected Content filter 358 // Protected Content filter
358 { "protectedContentTabLabel", IDS_PROTECTED_CONTENT_TAB_LABEL }, 359 {"protectedContentTabLabel", IDS_PROTECTED_CONTENT_TAB_LABEL},
359 { "protectedContentInfo", IDS_PROTECTED_CONTENT_INFO }, 360 {"protectedContentInfo", IDS_PROTECTED_CONTENT_INFO},
360 { "protectedContentEnable", IDS_PROTECTED_CONTENT_ENABLE }, 361 {"protectedContentEnable", IDS_PROTECTED_CONTENT_ENABLE},
361 { "protectedContent_header", IDS_PROTECTED_CONTENT_HEADER }, 362 {"protectedContent_header", IDS_PROTECTED_CONTENT_HEADER},
362 #endif // defined(OS_CHROMEOS) || defined(OS_WIN) 363 #endif // defined(OS_CHROMEOS) || defined(OS_WIN)
363 // Media stream capture device filter. 364 // Media stream capture device filter.
364 { "mediaStreamTabLabel", IDS_MEDIA_STREAM_TAB_LABEL }, 365 {"mediaStreamTabLabel", IDS_MEDIA_STREAM_TAB_LABEL},
365 { "media-stream_header", IDS_MEDIA_STREAM_HEADER }, 366 {"media-stream_header", IDS_MEDIA_STREAM_HEADER},
366 { "mediaStreamAsk", IDS_MEDIA_STREAM_ASK_RADIO }, 367 {"mediaStreamAsk", IDS_MEDIA_STREAM_ASK_RADIO},
367 { "mediaStreamBlock", IDS_MEDIA_STREAM_BLOCK_RADIO }, 368 {"mediaStreamBlock", IDS_MEDIA_STREAM_BLOCK_RADIO},
368 { "mediaStreamAudioAsk", IDS_MEDIA_STREAM_ASK_AUDIO_ONLY_RADIO }, 369 {"mediaStreamAudioAsk", IDS_MEDIA_STREAM_ASK_AUDIO_ONLY_RADIO},
369 { "mediaStreamAudioBlock", IDS_MEDIA_STREAM_BLOCK_AUDIO_ONLY_RADIO }, 370 {"mediaStreamAudioBlock", IDS_MEDIA_STREAM_BLOCK_AUDIO_ONLY_RADIO},
370 { "mediaStreamVideoAsk", IDS_MEDIA_STREAM_ASK_VIDEO_ONLY_RADIO }, 371 {"mediaStreamVideoAsk", IDS_MEDIA_STREAM_ASK_VIDEO_ONLY_RADIO},
371 { "mediaStreamVideoBlock", IDS_MEDIA_STREAM_BLOCK_VIDEO_ONLY_RADIO }, 372 {"mediaStreamVideoBlock", IDS_MEDIA_STREAM_BLOCK_VIDEO_ONLY_RADIO},
372 { "mediaStreamBubbleAudio", IDS_MEDIA_STREAM_AUDIO_MANAGED }, 373 {"mediaStreamBubbleAudio", IDS_MEDIA_STREAM_AUDIO_MANAGED},
373 { "mediaStreamBubbleVideo", IDS_MEDIA_STREAM_VIDEO_MANAGED }, 374 {"mediaStreamBubbleVideo", IDS_MEDIA_STREAM_VIDEO_MANAGED},
374 { "mediaAudioExceptionHeader", IDS_MEDIA_AUDIO_EXCEPTION_HEADER }, 375 {"mediaAudioExceptionHeader", IDS_MEDIA_AUDIO_EXCEPTION_HEADER},
375 { "mediaVideoExceptionHeader", IDS_MEDIA_VIDEO_EXCEPTION_HEADER }, 376 {"mediaVideoExceptionHeader", IDS_MEDIA_VIDEO_EXCEPTION_HEADER},
376 { "mediaPepperFlashDefaultDivergedLabel", 377 {"mediaPepperFlashDefaultDivergedLabel",
377 IDS_MEDIA_PEPPER_FLASH_DEFAULT_DIVERGED_LABEL }, 378 IDS_MEDIA_PEPPER_FLASH_DEFAULT_DIVERGED_LABEL},
378 { "mediaPepperFlashExceptionsDivergedLabel", 379 {"mediaPepperFlashExceptionsDivergedLabel",
379 IDS_MEDIA_PEPPER_FLASH_EXCEPTIONS_DIVERGED_LABEL }, 380 IDS_MEDIA_PEPPER_FLASH_EXCEPTIONS_DIVERGED_LABEL},
380 { "mediaPepperFlashChangeLink", IDS_MEDIA_PEPPER_FLASH_CHANGE_LINK }, 381 {"mediaPepperFlashChangeLink", IDS_MEDIA_PEPPER_FLASH_CHANGE_LINK},
381 { "mediaPepperFlashGlobalPrivacyURL", IDS_FLASH_GLOBAL_PRIVACY_URL }, 382 {"mediaPepperFlashGlobalPrivacyURL", IDS_FLASH_GLOBAL_PRIVACY_URL},
382 { "mediaPepperFlashWebsitePrivacyURL", IDS_FLASH_WEBSITE_PRIVACY_URL }, 383 {"mediaPepperFlashWebsitePrivacyURL", IDS_FLASH_WEBSITE_PRIVACY_URL},
383 // PPAPI broker filter. 384 // PPAPI broker filter.
384 { "ppapi-broker_header", IDS_PPAPI_BROKER_HEADER }, 385 {"ppapi-broker_header", IDS_PPAPI_BROKER_HEADER},
385 { "ppapiBrokerTabLabel", IDS_PPAPI_BROKER_TAB_LABEL }, 386 {"ppapiBrokerTabLabel", IDS_PPAPI_BROKER_TAB_LABEL},
386 { "ppapiBrokerAllow", IDS_PPAPI_BROKER_ALLOW_RADIO }, 387 {"ppapiBrokerAllow", IDS_PPAPI_BROKER_ALLOW_RADIO},
387 { "ppapiBrokerAsk", IDS_PPAPI_BROKER_ASK_RADIO }, 388 {"ppapiBrokerAsk", IDS_PPAPI_BROKER_ASK_RADIO},
388 { "ppapiBrokerBlock", IDS_PPAPI_BROKER_BLOCK_RADIO }, 389 {"ppapiBrokerBlock", IDS_PPAPI_BROKER_BLOCK_RADIO},
389 // Multiple automatic downloads 390 // Multiple automatic downloads
390 { "multipleAutomaticDownloadsTabLabel", 391 {"multipleAutomaticDownloadsTabLabel", IDS_AUTOMATIC_DOWNLOADS_TAB_LABEL},
391 IDS_AUTOMATIC_DOWNLOADS_TAB_LABEL }, 392 {"multiple-automatic-downloads_header", IDS_AUTOMATIC_DOWNLOADS_TAB_LABEL},
392 { "multiple-automatic-downloads_header", 393 {"multipleAutomaticDownloadsAllow", IDS_AUTOMATIC_DOWNLOADS_ALLOW_RADIO},
393 IDS_AUTOMATIC_DOWNLOADS_TAB_LABEL }, 394 {"multipleAutomaticDownloadsAsk", IDS_AUTOMATIC_DOWNLOADS_ASK_RADIO},
394 { "multipleAutomaticDownloadsAllow", 395 {"multipleAutomaticDownloadsBlock", IDS_AUTOMATIC_DOWNLOADS_BLOCK_RADIO},
395 IDS_AUTOMATIC_DOWNLOADS_ALLOW_RADIO },
396 { "multipleAutomaticDownloadsAsk",
397 IDS_AUTOMATIC_DOWNLOADS_ASK_RADIO },
398 { "multipleAutomaticDownloadsBlock",
399 IDS_AUTOMATIC_DOWNLOADS_BLOCK_RADIO },
400 // MIDI system exclusive messages 396 // MIDI system exclusive messages
401 { "midi-sysex_header", IDS_MIDI_SYSEX_TAB_LABEL }, 397 {"midi-sysex_header", IDS_MIDI_SYSEX_TAB_LABEL},
402 { "midiSysExAllow", IDS_MIDI_SYSEX_ALLOW_RADIO }, 398 {"midiSysExAllow", IDS_MIDI_SYSEX_ALLOW_RADIO},
403 { "midiSysExAsk", IDS_MIDI_SYSEX_ASK_RADIO }, 399 {"midiSysExAsk", IDS_MIDI_SYSEX_ASK_RADIO},
404 { "midiSysExBlock", IDS_MIDI_SYSEX_BLOCK_RADIO }, 400 {"midiSysExBlock", IDS_MIDI_SYSEX_BLOCK_RADIO},
405 // Push messaging strings 401 // Push messaging strings
406 { "push-messaging_header", IDS_PUSH_MESSAGES_TAB_LABEL }, 402 {"push-messaging_header", IDS_PUSH_MESSAGES_TAB_LABEL},
407 { "pushMessagingAllow", IDS_PUSH_MESSSAGING_ALLOW_RADIO }, 403 {"pushMessagingAllow", IDS_PUSH_MESSSAGING_ALLOW_RADIO},
408 { "pushMessagingAsk", IDS_PUSH_MESSSAGING_ASK_RADIO }, 404 {"pushMessagingAsk", IDS_PUSH_MESSSAGING_ASK_RADIO},
409 { "pushMessagingBlock", IDS_PUSH_MESSSAGING_BLOCK_RADIO }, 405 {"pushMessagingBlock", IDS_PUSH_MESSSAGING_BLOCK_RADIO},
410 { "zoomlevels_header", IDS_ZOOMLEVELS_HEADER_AND_TAB_LABEL }, 406 {"zoomlevels_header", IDS_ZOOMLEVELS_HEADER_AND_TAB_LABEL},
411 { "zoomLevelsManage", IDS_ZOOMLEVELS_MANAGE_BUTTON }, 407 {"zoomLevelsManage", IDS_ZOOMLEVELS_MANAGE_BUTTON},
412 }; 408 };
413 409
414 RegisterStrings(localized_strings, resources, arraysize(resources)); 410 RegisterStrings(localized_strings, resources, arraysize(resources));
415 RegisterTitle(localized_strings, "contentSettingsPage", 411 RegisterTitle(localized_strings, "contentSettingsPage",
416 IDS_CONTENT_SETTINGS_TITLE); 412 IDS_CONTENT_SETTINGS_TITLE);
417 413
418 // Register titles for each of the individual settings whose exception 414 // Register titles for each of the individual settings whose exception
419 // dialogs will be processed by |ContentSettingsHandler|. 415 // dialogs will be processed by |ContentSettingsHandler|.
420 RegisterTitle(localized_strings, "cookies", 416 RegisterTitle(localized_strings, "cookies",
421 IDS_COOKIES_TAB_LABEL); 417 IDS_COOKIES_TAB_LABEL);
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 sites, &media_settings_.flash_exceptions); 581 sites, &media_settings_.flash_exceptions);
586 PepperFlashContentSettingsUtils::SortMediaExceptions( 582 PepperFlashContentSettingsUtils::SortMediaExceptions(
587 &media_settings_.flash_exceptions); 583 &media_settings_.flash_exceptions);
588 584
589 UpdateFlashMediaLinksVisibility(); 585 UpdateFlashMediaLinksVisibility();
590 } 586 }
591 } 587 }
592 588
593 void ContentSettingsHandler::UpdateSettingDefaultFromModel( 589 void ContentSettingsHandler::UpdateSettingDefaultFromModel(
594 ContentSettingsType type) { 590 ContentSettingsType type) {
591 Profile* profile = Profile::FromWebUI(web_ui());
592 std::string provider_id;
593 ContentSetting default_setting =
594 profile->GetHostContentSettingsMap()->GetDefaultContentSetting(
595 type, &provider_id);
596
597 // For Plugins, display the obsolete ASK setting as BLOCK.
598 if (type == ContentSettingsType::CONTENT_SETTINGS_TYPE_PLUGINS &&
599 default_setting == ContentSetting::CONTENT_SETTING_ASK) {
600 default_setting = ContentSetting::CONTENT_SETTING_BLOCK;
601 }
602
595 base::DictionaryValue filter_settings; 603 base::DictionaryValue filter_settings;
596 std::string provider_id;
597 filter_settings.SetString(ContentSettingsTypeToGroupName(type) + ".value", 604 filter_settings.SetString(ContentSettingsTypeToGroupName(type) + ".value",
598 GetSettingDefaultFromModel(type, &provider_id)); 605 ContentSettingToString(default_setting));
599 filter_settings.SetString( 606 filter_settings.SetString(
600 ContentSettingsTypeToGroupName(type) + ".managedBy", provider_id); 607 ContentSettingsTypeToGroupName(type) + ".managedBy", provider_id);
601 608
602 web_ui()->CallJavascriptFunction( 609 web_ui()->CallJavascriptFunction(
603 "ContentSettings.setContentFilterSettingsValue", filter_settings); 610 "ContentSettings.setContentFilterSettingsValue", filter_settings);
604 } 611 }
605 612
606 void ContentSettingsHandler::UpdateMediaSettingsView() { 613 void ContentSettingsHandler::UpdateMediaSettingsView() {
607 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); 614 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui()));
608 bool audio_disabled = !prefs->GetBoolean(prefs::kAudioCaptureAllowed) && 615 bool audio_disabled = !prefs->GetBoolean(prefs::kAudioCaptureAllowed) &&
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 669
663 media_ui_settings.SetString("askText", "mediaStreamAsk"); 670 media_ui_settings.SetString("askText", "mediaStreamAsk");
664 media_ui_settings.SetString("blockText", "mediaStreamBlock"); 671 media_ui_settings.SetString("blockText", "mediaStreamBlock");
665 media_ui_settings.SetBoolean("showBubble", false); 672 media_ui_settings.SetBoolean("showBubble", false);
666 media_ui_settings.SetString("bubbleText", std::string()); 673 media_ui_settings.SetString("bubbleText", std::string());
667 674
668 web_ui()->CallJavascriptFunction("ContentSettings.updateMediaUI", 675 web_ui()->CallJavascriptFunction("ContentSettings.updateMediaUI",
669 media_ui_settings); 676 media_ui_settings);
670 } 677 }
671 678
672 std::string ContentSettingsHandler::GetSettingDefaultFromModel(
673 ContentSettingsType type, std::string* provider_id) {
674 Profile* profile = Profile::FromWebUI(web_ui());
675 ContentSetting default_setting;
676 default_setting =
677 profile->GetHostContentSettingsMap()->GetDefaultContentSetting(
678 type, provider_id);
679
680 return ContentSettingToString(default_setting);
681 }
682
683 void ContentSettingsHandler::UpdateHandlersEnabledRadios() { 679 void ContentSettingsHandler::UpdateHandlersEnabledRadios() {
684 base::FundamentalValue handlers_enabled( 680 base::FundamentalValue handlers_enabled(
685 GetProtocolHandlerRegistry()->enabled()); 681 GetProtocolHandlerRegistry()->enabled());
686 682
687 web_ui()->CallJavascriptFunction( 683 web_ui()->CallJavascriptFunction(
688 "ContentSettings.updateHandlersEnabledRadios", 684 "ContentSettings.updateHandlersEnabledRadios",
689 handlers_enabled); 685 handlers_enabled);
690 } 686 }
691 687
692 void ContentSettingsHandler::UpdateAllExceptionsViewsFromModel() { 688 void ContentSettingsHandler::UpdateAllExceptionsViewsFromModel() {
(...skipping 835 matching lines...) Expand 10 before | Expand all | Expand 10 after
1528 1524
1529 // Exceptions apply only when the feature is enabled. 1525 // Exceptions apply only when the feature is enabled.
1530 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); 1526 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui()));
1531 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); 1527 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM);
1532 web_ui()->CallJavascriptFunction( 1528 web_ui()->CallJavascriptFunction(
1533 "ContentSettings.enableProtectedContentExceptions", 1529 "ContentSettings.enableProtectedContentExceptions",
1534 base::FundamentalValue(enable_exceptions)); 1530 base::FundamentalValue(enable_exceptions));
1535 } 1531 }
1536 1532
1537 } // namespace options 1533 } // namespace options
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698