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

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

Issue 2296073002: [HBD] Update Old Options Strings for HBD (Closed)
Patch Set: Shorten strings adding using ternary Created 4 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
« no previous file with comments | « chrome/browser/resources/options/content_settings.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <map> 10 #include <map>
(...skipping 22 matching lines...) Expand all
33 #include "chrome/browser/permissions/chooser_context_base.h" 33 #include "chrome/browser/permissions/chooser_context_base.h"
34 #include "chrome/browser/permissions/permission_uma_util.h" 34 #include "chrome/browser/permissions/permission_uma_util.h"
35 #include "chrome/browser/permissions/permission_util.h" 35 #include "chrome/browser/permissions/permission_util.h"
36 #include "chrome/browser/plugins/plugins_field_trial.h" 36 #include "chrome/browser/plugins/plugins_field_trial.h"
37 #include "chrome/browser/profiles/profile.h" 37 #include "chrome/browser/profiles/profile.h"
38 #include "chrome/browser/ui/browser_list.h" 38 #include "chrome/browser/ui/browser_list.h"
39 #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h" 39 #include "chrome/browser/ui/exclusive_access/exclusive_access_manager.h"
40 #include "chrome/browser/ui/webui/site_settings_helper.h" 40 #include "chrome/browser/ui/webui/site_settings_helper.h"
41 #include "chrome/browser/usb/usb_chooser_context.h" 41 #include "chrome/browser/usb/usb_chooser_context.h"
42 #include "chrome/browser/usb/usb_chooser_context_factory.h" 42 #include "chrome/browser/usb/usb_chooser_context_factory.h"
43 #include "chrome/common/chrome_features.h"
43 #include "chrome/common/chrome_switches.h" 44 #include "chrome/common/chrome_switches.h"
44 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h" 45 #include "chrome/common/extensions/manifest_handlers/app_launch_info.h"
45 #include "chrome/common/features.h" 46 #include "chrome/common/features.h"
46 #include "chrome/common/pref_names.h" 47 #include "chrome/common/pref_names.h"
47 #include "chrome/common/url_constants.h" 48 #include "chrome/common/url_constants.h"
48 #include "chrome/grit/generated_resources.h" 49 #include "chrome/grit/generated_resources.h"
49 #include "chrome/grit/locale_settings.h" 50 #include "chrome/grit/locale_settings.h"
50 #include "components/content_settings/core/browser/content_settings_details.h" 51 #include "components/content_settings/core/browser/content_settings_details.h"
51 #include "components/content_settings/core/browser/content_settings_utils.h" 52 #include "components/content_settings/core/browser/content_settings_utils.h"
52 #include "components/content_settings/core/browser/host_content_settings_map.h" 53 #include "components/content_settings/core/browser/host_content_settings_map.h"
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 } 367 }
367 368
368 void ContentSettingsHandler::GetLocalizedValues( 369 void ContentSettingsHandler::GetLocalizedValues(
369 base::DictionaryValue* localized_strings) { 370 base::DictionaryValue* localized_strings) {
370 DCHECK(localized_strings); 371 DCHECK(localized_strings);
371 372
372 static OptionsStringResource resources[] = { 373 static OptionsStringResource resources[] = {
373 {"allowException", IDS_EXCEPTIONS_ALLOW_BUTTON}, 374 {"allowException", IDS_EXCEPTIONS_ALLOW_BUTTON},
374 {"blockException", IDS_EXCEPTIONS_BLOCK_BUTTON}, 375 {"blockException", IDS_EXCEPTIONS_BLOCK_BUTTON},
375 {"sessionException", IDS_EXCEPTIONS_SESSION_ONLY_BUTTON}, 376 {"sessionException", IDS_EXCEPTIONS_SESSION_ONLY_BUTTON},
376 {"detectException", IDS_EXCEPTIONS_DETECT_IMPORTANT_CONTENT_BUTTON},
377 {"askException", IDS_EXCEPTIONS_ASK_BUTTON}, 377 {"askException", IDS_EXCEPTIONS_ASK_BUTTON},
378 {"otrExceptionsExplanation", IDS_EXCEPTIONS_OTR_LABEL}, 378 {"otrExceptionsExplanation", IDS_EXCEPTIONS_OTR_LABEL},
379 {"addNewExceptionInstructions", IDS_EXCEPTIONS_ADD_NEW_INSTRUCTIONS}, 379 {"addNewExceptionInstructions", IDS_EXCEPTIONS_ADD_NEW_INSTRUCTIONS},
380 {"manageExceptions", IDS_EXCEPTIONS_MANAGE}, 380 {"manageExceptions", IDS_EXCEPTIONS_MANAGE},
381 {"manageHandlers", IDS_HANDLERS_MANAGE}, 381 {"manageHandlers", IDS_HANDLERS_MANAGE},
382 {"exceptionPatternHeader", IDS_EXCEPTIONS_PATTERN_HEADER}, 382 {"exceptionPatternHeader", IDS_EXCEPTIONS_PATTERN_HEADER},
383 {"exceptionBehaviorHeader", IDS_EXCEPTIONS_ACTION_HEADER}, 383 {"exceptionBehaviorHeader", IDS_EXCEPTIONS_ACTION_HEADER},
384 {"exceptionUsbDeviceHeader", IDS_EXCEPTIONS_USB_DEVICE_HEADER}, 384 {"exceptionUsbDeviceHeader", IDS_EXCEPTIONS_USB_DEVICE_HEADER},
385 {"exceptionZoomHeader", IDS_EXCEPTIONS_ZOOM_HEADER}, 385 {"exceptionZoomHeader", IDS_EXCEPTIONS_ZOOM_HEADER},
386 {"embeddedOnHost", IDS_EXCEPTIONS_GEOLOCATION_EMBEDDED_ON_HOST}, 386 {"embeddedOnHost", IDS_EXCEPTIONS_GEOLOCATION_EMBEDDED_ON_HOST},
(...skipping 15 matching lines...) Expand all
402 {"imagesTabLabel", IDS_IMAGES_TAB_LABEL}, 402 {"imagesTabLabel", IDS_IMAGES_TAB_LABEL},
403 {"imagesHeader", IDS_IMAGES_HEADER}, 403 {"imagesHeader", IDS_IMAGES_HEADER},
404 {"imagesAllow", IDS_IMAGES_LOAD_RADIO}, 404 {"imagesAllow", IDS_IMAGES_LOAD_RADIO},
405 {"imagesBlock", IDS_IMAGES_NOLOAD_RADIO}, 405 {"imagesBlock", IDS_IMAGES_NOLOAD_RADIO},
406 // JavaScript filter. 406 // JavaScript filter.
407 {"javascriptTabLabel", IDS_JAVASCRIPT_TAB_LABEL}, 407 {"javascriptTabLabel", IDS_JAVASCRIPT_TAB_LABEL},
408 {"javascriptHeader", IDS_JAVASCRIPT_HEADER}, 408 {"javascriptHeader", IDS_JAVASCRIPT_HEADER},
409 {"javascriptAllow", IDS_JS_ALLOW_RADIO}, 409 {"javascriptAllow", IDS_JS_ALLOW_RADIO},
410 {"javascriptBlock", IDS_JS_DONOTALLOW_RADIO}, 410 {"javascriptBlock", IDS_JS_DONOTALLOW_RADIO},
411 // Plugins filter. 411 // Plugins filter.
412 {"pluginsTabLabel", IDS_PLUGIN_TAB_LABEL}, 412 {"pluginsTabLabel", IDS_FLASH_TAB_LABEL},
413 {"pluginsHeader", IDS_PLUGIN_HEADER}, 413 {"pluginsHeader", IDS_FLASH_HEADER},
414 {"pluginsAllow", IDS_PLUGIN_ALLOW_RADIO}, 414 {"pluginsAllow", IDS_FLASH_ALLOW_RADIO},
415 {"pluginsBlock", IDS_PLUGIN_BLOCK_RADIO}, 415 {"pluginsBlock", IDS_FLASH_BLOCK_RADIO},
416 {"pluginsDetectImportantContent", IDS_PLUGIN_DETECT_RECOMMENDED_RADIO},
417 {"manageIndividualPlugins", IDS_PLUGIN_MANAGE_INDIVIDUAL},
418 // Pop-ups filter. 416 // Pop-ups filter.
419 {"popupsTabLabel", IDS_POPUP_TAB_LABEL}, 417 {"popupsTabLabel", IDS_POPUP_TAB_LABEL},
420 {"popupsHeader", IDS_POPUP_HEADER}, 418 {"popupsHeader", IDS_POPUP_HEADER},
421 {"popupsAllow", IDS_POPUP_ALLOW_RADIO}, 419 {"popupsAllow", IDS_POPUP_ALLOW_RADIO},
422 {"popupsBlock", IDS_POPUP_BLOCK_RADIO}, 420 {"popupsBlock", IDS_POPUP_BLOCK_RADIO},
423 // Location filter. 421 // Location filter.
424 {"locationTabLabel", IDS_GEOLOCATION_TAB_LABEL}, 422 {"locationTabLabel", IDS_GEOLOCATION_TAB_LABEL},
425 {"locationHeader", IDS_GEOLOCATION_HEADER}, 423 {"locationHeader", IDS_GEOLOCATION_HEADER},
426 {"locationAllow", IDS_GEOLOCATION_ALLOW_RADIO}, 424 {"locationAllow", IDS_GEOLOCATION_ALLOW_RADIO},
427 {"locationAsk", IDS_GEOLOCATION_ASK_RADIO}, 425 {"locationAsk", IDS_GEOLOCATION_ASK_RADIO},
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 {"zoomLevelsManage", IDS_ZOOMLEVELS_MANAGE_BUTTON}, 502 {"zoomLevelsManage", IDS_ZOOMLEVELS_MANAGE_BUTTON},
505 // Keygen filter. 503 // Keygen filter.
506 {"keygenTabLabel", IDS_KEYGEN_TAB_LABEL}, 504 {"keygenTabLabel", IDS_KEYGEN_TAB_LABEL},
507 {"keygenHeader", IDS_KEYGEN_HEADER}, 505 {"keygenHeader", IDS_KEYGEN_HEADER},
508 {"keygenAllow", IDS_KEYGEN_ALLOW_RADIO}, 506 {"keygenAllow", IDS_KEYGEN_ALLOW_RADIO},
509 {"keygenBlock", IDS_KEYGEN_DONOTALLOW_RADIO}, 507 {"keygenBlock", IDS_KEYGEN_DONOTALLOW_RADIO},
510 }; 508 };
511 509
512 RegisterStrings(localized_strings, resources, arraysize(resources)); 510 RegisterStrings(localized_strings, resources, arraysize(resources));
513 511
512 // TODO(tommycli): When the HTML5 By Default feature flag is on, we want to
513 // display strings that begin with "Ask...", even though the setting remains
514 // DETECT. Once this feature is finalized, then we migrate the setting to ASK.
515 bool is_hbd = base::FeatureList::IsEnabled(features::kPreferHtmlOverPlugins);
516 static OptionsStringResource flash_strings[] = {
517 {"pluginsDetectImportantContent",
518 is_hbd ? IDS_FLASH_ASK_RECOMMENDED_RADIO
519 : IDS_FLASH_DETECT_RECOMMENDED_RADIO},
520 {"detectException",
521 is_hbd ? IDS_EXCEPTIONS_ASK_BUTTON
522 : IDS_EXCEPTIONS_DETECT_IMPORTANT_CONTENT_BUTTON},
523 };
524 RegisterStrings(localized_strings, flash_strings, arraysize(flash_strings));
525
514 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs(); 526 PrefService* prefs = Profile::FromWebUI(web_ui())->GetPrefs();
515 const base::Value* default_pref = prefs->GetDefaultPrefValue( 527 const base::Value* default_pref = prefs->GetDefaultPrefValue(
516 content_settings::WebsiteSettingsRegistry::GetInstance() 528 content_settings::WebsiteSettingsRegistry::GetInstance()
517 ->Get(CONTENT_SETTINGS_TYPE_PLUGINS) 529 ->Get(CONTENT_SETTINGS_TYPE_PLUGINS)
518 ->default_value_pref_name()); 530 ->default_value_pref_name());
519 531
520 int default_value = CONTENT_SETTING_DEFAULT; 532 int default_value = CONTENT_SETTING_DEFAULT;
521 bool success = default_pref->GetAsInteger(&default_value); 533 bool success = default_pref->GetAsInteger(&default_value);
522 DCHECK(success); 534 DCHECK(success);
523 DCHECK_NE(CONTENT_SETTING_DEFAULT, default_value); 535 DCHECK_NE(CONTENT_SETTING_DEFAULT, default_value);
524 536
525 RegisterTitle(localized_strings, "contentSettingsPage", 537 RegisterTitle(localized_strings, "contentSettingsPage",
526 IDS_CONTENT_SETTINGS_TITLE); 538 IDS_CONTENT_SETTINGS_TITLE);
527 539
528 // Register titles for each of the individual settings whose exception 540 // Register titles for each of the individual settings whose exception
529 // dialogs will be processed by |ContentSettingsHandler|. 541 // dialogs will be processed by |ContentSettingsHandler|.
530 RegisterTitle(localized_strings, "cookies", 542 RegisterTitle(localized_strings, "cookies",
531 IDS_COOKIES_TAB_LABEL); 543 IDS_COOKIES_TAB_LABEL);
532 RegisterTitle(localized_strings, "images", 544 RegisterTitle(localized_strings, "images",
533 IDS_IMAGES_TAB_LABEL); 545 IDS_IMAGES_TAB_LABEL);
534 RegisterTitle(localized_strings, "javascript", 546 RegisterTitle(localized_strings, "javascript",
535 IDS_JAVASCRIPT_TAB_LABEL); 547 IDS_JAVASCRIPT_TAB_LABEL);
536 RegisterTitle(localized_strings, "plugins", 548 RegisterTitle(localized_strings, "plugins", IDS_FLASH_TAB_LABEL);
537 IDS_PLUGIN_TAB_LABEL);
538 RegisterTitle(localized_strings, "popups", 549 RegisterTitle(localized_strings, "popups",
539 IDS_POPUP_TAB_LABEL); 550 IDS_POPUP_TAB_LABEL);
540 RegisterTitle(localized_strings, "location", 551 RegisterTitle(localized_strings, "location",
541 IDS_GEOLOCATION_TAB_LABEL); 552 IDS_GEOLOCATION_TAB_LABEL);
542 RegisterTitle(localized_strings, "notifications", 553 RegisterTitle(localized_strings, "notifications",
543 IDS_NOTIFICATIONS_TAB_LABEL); 554 IDS_NOTIFICATIONS_TAB_LABEL);
544 RegisterTitle(localized_strings, "fullscreen", 555 RegisterTitle(localized_strings, "fullscreen",
545 IDS_FULLSCREEN_TAB_LABEL); 556 IDS_FULLSCREEN_TAB_LABEL);
546 RegisterTitle(localized_strings, "mouselock", 557 RegisterTitle(localized_strings, "mouselock",
547 IDS_MOUSE_LOCK_TAB_LABEL); 558 IDS_MOUSE_LOCK_TAB_LABEL);
(...skipping 956 matching lines...) Expand 10 before | Expand all | Expand 10 after
1504 1515
1505 // Exceptions apply only when the feature is enabled. 1516 // Exceptions apply only when the feature is enabled.
1506 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui())); 1517 PrefService* prefs = user_prefs::UserPrefs::Get(GetBrowserContext(web_ui()));
1507 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM); 1518 bool enable_exceptions = prefs->GetBoolean(prefs::kEnableDRM);
1508 web_ui()->CallJavascriptFunctionUnsafe( 1519 web_ui()->CallJavascriptFunctionUnsafe(
1509 "ContentSettings.enableProtectedContentExceptions", 1520 "ContentSettings.enableProtectedContentExceptions",
1510 base::FundamentalValue(enable_exceptions)); 1521 base::FundamentalValue(enable_exceptions));
1511 } 1522 }
1512 1523
1513 } // namespace options 1524 } // namespace options
OLDNEW
« no previous file with comments | « chrome/browser/resources/options/content_settings.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698