diff options
Diffstat (limited to 'chromium/chrome/browser/prefs')
-rw-r--r-- | chromium/chrome/browser/prefs/OWNERS | 2 | ||||
-rw-r--r-- | chromium/chrome/browser/prefs/browser_prefs.cc | 83 | ||||
-rw-r--r-- | chromium/chrome/browser/prefs/chrome_command_line_pref_store_ssl_manager_unittest.cc | 3 | ||||
-rw-r--r-- | chromium/chrome/browser/prefs/chrome_pref_service_factory.cc | 46 | ||||
-rw-r--r-- | chromium/chrome/browser/prefs/incognito_mode_prefs.cc | 7 | ||||
-rw-r--r-- | chromium/chrome/browser/prefs/pref_service_incognito_allowlist.cc (renamed from chromium/chrome/browser/prefs/pref_service_incognito_whitelist.cc) | 6 | ||||
-rw-r--r-- | chromium/chrome/browser/prefs/pref_service_incognito_allowlist.h (renamed from chromium/chrome/browser/prefs/pref_service_incognito_whitelist.h) | 8 | ||||
-rw-r--r-- | chromium/chrome/browser/prefs/pref_service_syncable_util.cc | 4 | ||||
-rw-r--r-- | chromium/chrome/browser/prefs/tracked/pref_hash_browsertest.cc | 65 |
9 files changed, 97 insertions, 127 deletions
diff --git a/chromium/chrome/browser/prefs/OWNERS b/chromium/chrome/browser/prefs/OWNERS index 538512cd888..9a8b24b3e19 100644 --- a/chromium/chrome/browser/prefs/OWNERS +++ b/chromium/chrome/browser/prefs/OWNERS @@ -1,7 +1,7 @@ battre@chromium.org gab@chromium.org -per-file pref_service_incognito_whitelist.cc=rhalavati@chromium.org +per-file pref_service_incognito_allowlist.cc=rhalavati@chromium.org # COMPONENT: UI>Browser>Preferences # TEAM: chromium-dev@chromium.org diff --git a/chromium/chrome/browser/prefs/browser_prefs.cc b/chromium/chrome/browser/prefs/browser_prefs.cc index 3d00fae9dc1..6dc80ff464e 100644 --- a/chromium/chrome/browser/prefs/browser_prefs.cc +++ b/chromium/chrome/browser/prefs/browser_prefs.cc @@ -17,9 +17,11 @@ #include "chrome/browser/browser_process_impl.h" #include "chrome/browser/chrome_content_browser_client.h" #include "chrome/browser/chromeos/policy/tpm_auto_update_mode_policy_handler.h" +#include "chrome/browser/chromeos/printing/print_management/printing_manager_factory.h" #include "chrome/browser/chromeos/scheduler_configuration_manager.h" #include "chrome/browser/component_updater/component_updater_prefs.h" #include "chrome/browser/custom_handlers/protocol_handler_registry.h" +#include "chrome/browser/data_use_measurement/chrome_data_use_measurement.h" #include "chrome/browser/devtools/devtools_window.h" #include "chrome/browser/download/download_prefs.h" #include "chrome/browser/engagement/important_sites_util.h" @@ -69,9 +71,9 @@ #include "chrome/browser/sharing/sharing_sync_preference.h" #include "chrome/browser/ssl/ssl_config_service_manager.h" #include "chrome/browser/storage/appcache_feature_prefs.h" +#include "chrome/browser/subresource_redirect/https_image_compression_infobar_decider.h" #include "chrome/browser/task_manager/task_manager_interface.h" #include "chrome/browser/tracing/chrome_tracing_delegate.h" -#include "chrome/browser/ui/blocked_content/safe_browsing_triggered_popup_blocker.h" #include "chrome/browser/ui/browser_ui_prefs.h" #include "chrome/browser/ui/hats/hats_service.h" #include "chrome/browser/ui/navigation_correction_tab_observer.h" @@ -88,11 +90,10 @@ #include "chrome/browser/web_applications/web_app_provider.h" #include "chrome/browser/webauthn/chrome_authenticator_request_delegate.h" #include "chrome/common/buildflags.h" -#include "chrome/common/chrome_ui_features_prefs.h" #include "chrome/common/pref_names.h" -#include "chrome/common/secure_origin_whitelist.h" -#include "chrome/common/web_components_prefs.h" +#include "chrome/common/secure_origin_allowlist.h" #include "components/autofill/core/common/autofill_prefs.h" +#include "components/blocked_content/safe_browsing_triggered_popup_blocker.h" #include "components/browsing_data/core/pref_names.h" #include "components/certificate_transparency/pref_names.h" #include "components/content_settings/core/browser/host_content_settings_map.h" @@ -103,6 +104,7 @@ #include "components/feature_engagement/buildflags.h" #include "components/flags_ui/pref_service_flags_storage.h" #include "components/image_fetcher/core/cache/image_cache.h" +#include "components/invalidation/impl/fcm_invalidation_service.h" #include "components/invalidation/impl/invalidator_registrar_with_memory.h" #include "components/invalidation/impl/per_user_topic_subscription_manager.h" #include "components/language/content/browser/geo_language_provider.h" @@ -138,7 +140,6 @@ #include "components/safe_browsing/core/common/safe_browsing_prefs.h" #include "components/search_engines/template_url_prepopulate_data.h" #include "components/security_interstitials/content/stateful_ssl_host_state_delegate.h" -#include "components/security_state/core/security_state.h" #include "components/sessions/core/session_id_generator.h" #include "components/signin/public/identity_manager/identity_manager.h" #include "components/subresource_filter/content/browser/ruleset_service.h" @@ -242,6 +243,7 @@ #include "chrome/browser/gcm/gcm_product_util.h" #include "chrome/browser/media/unified_autoplay_config.h" #include "chrome/browser/metrics/tab_stats_tracker.h" +#include "chrome/browser/nearby_sharing/nearby_sharing_prefs.h" #include "chrome/browser/search/instant_service.h" #include "chrome/browser/search/promos/promo_service.h" #include "chrome/browser/search/search_suggest/search_suggest_service.h" @@ -283,6 +285,7 @@ #include "chrome/browser/chromeos/file_system_provider/registry.h" #include "chrome/browser/chromeos/first_run/first_run.h" #include "chrome/browser/chromeos/guest_os/guest_os_pref_names.h" +#include "chrome/browser/chromeos/local_search_service/search_metrics_reporter.h" #include "chrome/browser/chromeos/lock_screen_apps/state_controller.h" #include "chrome/browser/chromeos/login/demo_mode/demo_mode_detector.h" #include "chrome/browser/chromeos/login/demo_mode/demo_mode_resources_remover.h" @@ -309,7 +312,10 @@ #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h" #include "chrome/browser/chromeos/policy/device_cloud_policy_manager_chromeos.h" #include "chrome/browser/chromeos/policy/dm_token_storage.h" +#include "chrome/browser/chromeos/policy/enrollment_requisition_manager.h" +#include "chrome/browser/chromeos/policy/extension_install_event_log_manager_wrapper.h" #include "chrome/browser/chromeos/policy/external_data_handlers/device_wallpaper_image_external_data_handler.h" +#include "chrome/browser/chromeos/policy/minimum_version_policy_handler.h" #include "chrome/browser/chromeos/policy/policy_cert_service_factory.h" #include "chrome/browser/chromeos/policy/status_collector/device_status_collector.h" #include "chrome/browser/chromeos/policy/status_collector/status_collector.h" @@ -350,7 +356,6 @@ #include "chromeos/services/multidevice_setup/multidevice_setup_service.h" #include "chromeos/timezone/timezone_resolver.h" #include "components/arc/arc_prefs.h" -#include "components/invalidation/impl/fcm_invalidation_service.h" #include "components/onc/onc_pref_names.h" #include "components/quirks/quirks_manager.h" #include "extensions/browser/api/lock_screen_data/lock_screen_item_storage.h" @@ -398,6 +403,10 @@ #include "chrome/browser/media/feeds/media_feeds_service.h" #endif +#if defined(USE_X11) +#include "ui/base/ui_base_features.h" +#endif + namespace { #if defined(OS_ANDROID) @@ -547,6 +556,10 @@ const char kPreviewsLPROriginProbeCache[] = const char kSupervisedUsersNextId[] = "LocallyManagedUsersNextId"; #endif // defined(OS_CHROMEOS) +// Deprecated 6/2020 +const char kStricterMixedContentTreatmentEnabled[] = + "security_state.stricter_mixed_content_treatment_enabled"; + // Register local state used only for migration (clearing or moving to a new // key). void RegisterLocalStatePrefsForMigration(PrefRegistrySimple* registry) { @@ -610,7 +623,8 @@ void RegisterProfilePrefsForMigration( registry->RegisterStringPref(kLastKnownGoogleURL, std::string()); registry->RegisterStringPref(kLastPromptedGoogleURL, std::string()); #if defined(USE_X11) - registry->RegisterIntegerPref(kLocalProfileId, 0); + if (!features::IsUsingOzonePlatform()) + registry->RegisterIntegerPref(kLocalProfileId, 0); #endif registry->RegisterBooleanPref(kInsecureExtensionUpdatesEnabled, false); @@ -648,14 +662,19 @@ void RegisterProfilePrefsForMigration( registry->RegisterDictionaryPref(kPreviewsLPRHostBlacklist); registry->RegisterDictionaryPref(kPreviewsLPRProbeCache); registry->RegisterDictionaryPref(kPreviewsLPROriginProbeCache); + + registry->RegisterBooleanPref(kStricterMixedContentTreatmentEnabled, true); } } // namespace void RegisterLocalState(PrefRegistrySimple* registry) { - // Please keep this list alphabetized. + // Call outs to individual subsystems that register Local State (browser-wide) + // prefs en masse. See RegisterProfilePrefs for per-profile prefs. Please + // keep this list alphabetized. browser_shutdown::RegisterPrefs(registry); data_reduction_proxy::RegisterPrefs(registry); + data_use_measurement::ChromeDataUseMeasurement::RegisterPrefs(registry); BrowserProcessImpl::RegisterPrefs(registry); ChromeContentBrowserClient::RegisterLocalStatePrefs(registry); ChromeMetricsServiceClient::RegisterPrefs(registry); @@ -666,6 +685,7 @@ void RegisterLocalState(PrefRegistrySimple* registry) { GpuModeManager::RegisterPrefs(registry); signin::IdentityManager::RegisterLocalStatePrefs(registry); IntranetRedirectDetector::RegisterPrefs(registry); + invalidation::FCMInvalidationService::RegisterPrefs(registry); language::GeoLanguageProvider::RegisterLocalStatePrefs(registry); language::UlpLanguageCodeLocator::RegisterLocalStatePrefs(registry); memory::EnterpriseMemoryLimitPrefObserver::RegisterPrefs(registry); @@ -682,10 +702,12 @@ void RegisterLocalState(PrefRegistrySimple* registry) { rappor::RapporServiceImpl::RegisterPrefs(registry); RegisterScreenshotPrefs(registry); safe_browsing::RegisterLocalStatePrefs(registry); - secure_origin_whitelist::RegisterPrefs(registry); + secure_origin_allowlist::RegisterPrefs(registry); sessions::SessionIdGenerator::RegisterPrefs(registry); SSLConfigServiceManager::RegisterPrefs(registry); subresource_filter::IndexedRulesetVersion::RegisterPrefs(registry); + syncer::InvalidatorRegistrarWithMemory::RegisterPrefs(registry); + syncer::PerUserTopicSubscriptionManager::RegisterPrefs(registry); SystemNetworkContextManager::RegisterPrefs(registry); update_client::RegisterPrefs(registry); variations::VariationsService::RegisterPrefs(registry); @@ -694,6 +716,11 @@ void RegisterLocalState(PrefRegistrySimple* registry) { // clearly be grouped together, please group them together into a helper // function called above. Please keep this list alphabetized. registry->RegisterBooleanPref( + policy::policy_prefs::kIntensiveWakeUpThrottlingEnabled, false); + registry->RegisterInt64Pref(kLastStartupTimestamp, 0); + registry->RegisterStringPref(kLastStartupVersion, std::string()); + registry->RegisterIntegerPref(kSameVersionStartupCount, 0); + registry->RegisterBooleanPref( policy::policy_prefs::kUserAgentClientHintsEnabled, true); // Below this point is for platform-specific and compile-time conditional @@ -717,9 +744,12 @@ void RegisterLocalState(PrefRegistrySimple* registry) { media_router::RegisterLocalStatePrefs(registry); metrics::TabStatsTracker::RegisterPrefs(registry); RegisterBrowserPrefs(registry); + RegisterNearbySharingLocalPrefs(registry); StartupBrowserCreator::RegisterLocalStatePrefs(registry); task_manager::TaskManagerInterface::RegisterPrefs(registry); UpgradeDetector::RegisterPrefs(registry); + + registry->RegisterBooleanPref(kNtpActivateHideShortcutsFieldTrial, false); #endif // !defined(OS_ANDROID) #if defined(OS_CHROMEOS) @@ -770,22 +800,23 @@ void RegisterLocalState(PrefRegistrySimple* registry) { extensions::lock_screen_data::LockScreenItemStorage::RegisterLocalState( registry); extensions::login_api::RegisterLocalStatePrefs(registry); - invalidation::FCMInvalidationService::RegisterPrefs(registry); ::onc::RegisterPrefs(registry); + local_search_service::SearchMetricsReporter::RegisterLocalStatePrefs( + registry); policy::AutoEnrollmentClientImpl::RegisterPrefs(registry); policy::BrowserPolicyConnectorChromeOS::RegisterPrefs(registry); policy::DeviceCloudPolicyManagerChromeOS::RegisterPrefs(registry); policy::DeviceStatusCollector::RegisterPrefs(registry); policy::DeviceWallpaperImageExternalDataHandler::RegisterPrefs(registry); policy::DMTokenStorage::RegisterPrefs(registry); + policy::EnrollmentRequisitionManager::RegisterPrefs(registry); + policy::MinimumVersionPolicyHandler::RegisterPrefs(registry); policy::PolicyCertServiceFactory::RegisterPrefs(registry); policy::TPMAutoUpdateModePolicyHandler::RegisterPrefs(registry); policy::WebUsbAllowDevicesForUrlsPolicyHandler::RegisterPrefs(registry); policy::SystemFeaturesDisableListPolicyHandler::RegisterPrefs(registry); quirks::QuirksManager::RegisterPrefs(registry); UpgradeDetectorChromeos::RegisterPrefs(registry); - syncer::PerUserTopicSubscriptionManager::RegisterPrefs(registry); - syncer::InvalidatorRegistrarWithMemory::RegisterPrefs(registry); chromeos::cert_provisioning::RegisterLocalStatePrefs(registry); #endif // defined(OS_CHROMEOS) @@ -799,9 +830,6 @@ void RegisterLocalState(PrefRegistrySimple* registry) { #if defined(OS_WIN) OSCrypt::RegisterLocalPrefs(registry); -#endif - -#if defined(OS_WIN) registry->RegisterBooleanPref(prefs::kRendererCodeIntegrityEnabled, true); registry->RegisterBooleanPref( policy::policy_prefs::kNativeWindowOcclusionEnabled, true); @@ -819,17 +847,11 @@ void RegisterLocalState(PrefRegistrySimple* registry) { DeviceOAuth2TokenStoreDesktop::RegisterPrefs(registry); #endif -#if !defined(OS_ANDROID) - registry->RegisterBooleanPref(kNtpActivateHideShortcutsFieldTrial, false); -#endif // !defined(OS_ANDROID) - registry->RegisterInt64Pref(kLastStartupTimestamp, 0); - registry->RegisterStringPref(kLastStartupVersion, std::string()); - registry->RegisterIntegerPref(kSameVersionStartupCount, 0); - #if defined(TOOLKIT_VIEWS) RegisterBrowserViewLocalPrefs(registry); #endif + // This is intentionally last. RegisterLocalStatePrefsForMigration(registry); } @@ -853,12 +875,12 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry, chrome_browser_net::NetErrorTabHelper::RegisterProfilePrefs(registry); chrome_browser_net::RegisterPredictionOptionsProfilePrefs(registry); chrome_prefs::RegisterProfilePrefs(registry); - chrome_ui_features_prefs::RegisterProfilePrefs(registry); DocumentProvider::RegisterProfilePrefs(registry); dom_distiller::DistilledPagePrefs::RegisterProfilePrefs(registry); dom_distiller::RegisterProfilePrefs(registry); DownloadPrefs::RegisterProfilePrefs(registry); HostContentSettingsMap::RegisterProfilePrefs(registry); + HttpsImageCompressionInfoBarDecider::RegisterProfilePrefs(registry); image_fetcher::ImageCache::RegisterProfilePrefs(registry); ImportantSitesUtil::RegisterProfilePrefs(registry); IncognitoModePrefs::RegisterProfilePrefs(registry); @@ -896,8 +918,8 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry, QuietNotificationPermissionUiState::RegisterProfilePrefs(registry); RegisterBrowserUserPrefs(registry); safe_browsing::RegisterProfilePrefs(registry); - SafeBrowsingTriggeredPopupBlocker::RegisterProfilePrefs(registry); - security_state::RegisterProfilePrefs(registry); + blocked_content::SafeBrowsingTriggeredPopupBlocker::RegisterProfilePrefs( + registry); SessionStartupPref::RegisterProfilePrefs(registry); SharingSyncPreference::RegisterProfilePrefs(registry); sync_sessions::SessionSyncPrefs::RegisterProfilePrefs(registry); @@ -905,7 +927,6 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry, syncer::SyncPrefs::RegisterProfilePrefs(registry); syncer::PerUserTopicSubscriptionManager::RegisterProfilePrefs(registry); syncer::InvalidatorRegistrarWithMemory::RegisterProfilePrefs(registry); - web_components_prefs::RegisterProfilePrefs(registry); TemplateURLPrepopulateData::RegisterProfilePrefs(registry); translate::TranslatePrefs::RegisterProfilePrefs(registry); omnibox::RegisterProfilePrefs(registry); @@ -1037,6 +1058,8 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry, chromeos::quick_unlock::FingerprintStorage::RegisterProfilePrefs(registry); chromeos::quick_unlock::PinStoragePrefs::RegisterProfilePrefs(registry); chromeos::Preferences::RegisterProfilePrefs(registry); + chromeos::printing::print_management::PrintingManagerFactory :: + RegisterProfilePrefs(registry); chromeos::PrintJobHistoryService::RegisterProfilePrefs(registry); chromeos::EnterprisePrintersProvider::RegisterProfilePrefs(registry); chromeos::parent_access::ParentAccessService::RegisterProfilePrefs(registry); @@ -1060,6 +1083,8 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry, plugin_vm::prefs::RegisterProfilePrefs(registry); policy::AppInstallEventLogger::RegisterProfilePrefs(registry); policy::AppInstallEventLogManagerWrapper::RegisterProfilePrefs(registry); + policy::ExtensionInstallEventLogManagerWrapper::RegisterProfilePrefs( + registry); policy::StatusCollector::RegisterProfilePrefs(registry); RegisterChromeLauncherUserPrefs(registry); ::onc::RegisterProfilePrefs(registry); @@ -1233,7 +1258,8 @@ void MigrateObsoleteProfilePrefs(Profile* profile) { // Added 7/2019. #if defined(USE_X11) - profile_prefs->ClearPref(kLocalProfileId); + if (!features::IsUsingOzonePlatform()) + profile_prefs->ClearPref(kLocalProfileId); #endif // Added 8/2019 @@ -1286,4 +1312,7 @@ void MigrateObsoleteProfilePrefs(Profile* profile) { profile_prefs->ClearPref(kPreviewsLPRHostBlacklist); profile_prefs->ClearPref(kPreviewsLPRProbeCache); profile_prefs->ClearPref(kPreviewsLPROriginProbeCache); + + // Added 6/2020 + profile_prefs->ClearPref(kStricterMixedContentTreatmentEnabled); } diff --git a/chromium/chrome/browser/prefs/chrome_command_line_pref_store_ssl_manager_unittest.cc b/chromium/chrome/browser/prefs/chrome_command_line_pref_store_ssl_manager_unittest.cc index ba08fd05151..f2532d99821 100644 --- a/chromium/chrome/browser/prefs/chrome_command_line_pref_store_ssl_manager_unittest.cc +++ b/chromium/chrome/browser/prefs/chrome_command_line_pref_store_ssl_manager_unittest.cc @@ -13,6 +13,7 @@ #include "components/prefs/pref_service.h" #include "components/prefs/testing_pref_store.h" #include "components/sync_preferences/pref_service_mock_factory.h" +#include "content/public/browser/network_service_instance.h" #include "services/network/public/mojom/network_service.mojom.h" #include "services/network/public/mojom/ssl_config.mojom.h" #include "testing/gtest/include/gtest/gtest.h" @@ -43,6 +44,8 @@ TEST_F(CommandLinePrefStoreSSLManagerTest, CommandLinePrefs) { SSLConfigServiceManager::RegisterPrefs(registry.get()); network::mojom::NetworkContextParamsPtr context_params = network::mojom::NetworkContextParams::New(); + context_params->cert_verifier_params = content::GetCertVerifierParams( + network::mojom::CertVerifierCreationParams::New()); std::unique_ptr<SSLConfigServiceManager> config_manager( SSLConfigServiceManager::CreateDefaultManager(local_state.get())); config_manager->AddToNetworkContextParams(context_params.get()); diff --git a/chromium/chrome/browser/prefs/chrome_pref_service_factory.cc b/chromium/chrome/browser/prefs/chrome_pref_service_factory.cc index 6186da7ed18..68b01b41f02 100644 --- a/chromium/chrome/browser/prefs/chrome_pref_service_factory.cc +++ b/chromium/chrome/browser/prefs/chrome_pref_service_factory.cc @@ -222,50 +222,14 @@ SettingsEnforcementGroup GetSettingsEnforcementGroup() { } #endif - struct { - const char* group_name; - SettingsEnforcementGroup group; - } static const kEnforcementLevelMap[] = { - { chrome_prefs::internals::kSettingsEnforcementGroupNoEnforcement, - GROUP_NO_ENFORCEMENT }, - { chrome_prefs::internals::kSettingsEnforcementGroupEnforceAlways, - GROUP_ENFORCE_ALWAYS }, - { chrome_prefs::internals:: - kSettingsEnforcementGroupEnforceAlwaysWithDSE, - GROUP_ENFORCE_ALWAYS_WITH_DSE }, - { chrome_prefs::internals:: - kSettingsEnforcementGroupEnforceAlwaysWithExtensionsAndDSE, - GROUP_ENFORCE_ALWAYS_WITH_EXTENSIONS_AND_DSE }, - }; - - // Use the strongest enforcement setting in the absence of a field trial - // config on Windows and MacOS. Remember to update the OFFICIAL_BUILD section - // of extension_startup_browsertest.cc and pref_hash_browsertest.cc when - // updating the default value below. - // TODO(gab): Enforce this on all platforms. - SettingsEnforcementGroup enforcement_group = + // Use the strongest enforcement setting on Windows and MacOS. Remember to + // update the OFFICIAL_BUILD section of extension_startup_browsertest.cc and + // pref_hash_browsertest.cc when updating the default value below. #if defined(OS_WIN) || defined(OS_MACOSX) - GROUP_ENFORCE_DEFAULT; + return GROUP_ENFORCE_DEFAULT; #else - GROUP_NO_ENFORCEMENT; + return GROUP_NO_ENFORCEMENT; #endif - bool group_determined_from_trial = false; - base::FieldTrial* trial = - base::FieldTrialList::Find( - chrome_prefs::internals::kSettingsEnforcementTrialName); - if (trial) { - const std::string& group_name = trial->group_name(); - for (size_t i = 0; i < base::size(kEnforcementLevelMap); ++i) { - if (kEnforcementLevelMap[i].group_name == group_name) { - enforcement_group = kEnforcementLevelMap[i].group; - group_determined_from_trial = true; - break; - } - } - } - UMA_HISTOGRAM_BOOLEAN("Settings.EnforcementGroupDeterminedFromTrial", - group_determined_from_trial); - return enforcement_group; } // Returns the effective preference tracking configuration. diff --git a/chromium/chrome/browser/prefs/incognito_mode_prefs.cc b/chromium/chrome/browser/prefs/incognito_mode_prefs.cc index 203efcee12a..98f6ab2937f 100644 --- a/chromium/chrome/browser/prefs/incognito_mode_prefs.cc +++ b/chromium/chrome/browser/prefs/incognito_mode_prefs.cc @@ -77,18 +77,15 @@ bool IncognitoModePrefs::ShouldLaunchIncognito( // static bool IncognitoModePrefs::CanOpenBrowser(Profile* profile) { - if (profile->IsGuestSession()) - return true; - switch (GetAvailability(profile->GetPrefs())) { case IncognitoModePrefs::ENABLED: return true; case IncognitoModePrefs::DISABLED: - return !profile->IsOffTheRecord(); + return !profile->IsIncognitoProfile(); case IncognitoModePrefs::FORCED: - return profile->IsOffTheRecord(); + return profile->IsIncognitoProfile(); default: NOTREACHED(); diff --git a/chromium/chrome/browser/prefs/pref_service_incognito_whitelist.cc b/chromium/chrome/browser/prefs/pref_service_incognito_allowlist.cc index 3cfc0bc885b..34a671cf0b3 100644 --- a/chromium/chrome/browser/prefs/pref_service_incognito_whitelist.cc +++ b/chromium/chrome/browser/prefs/pref_service_incognito_allowlist.cc @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "chrome/browser/prefs/pref_service_incognito_whitelist.h" +#include "chrome/browser/prefs/pref_service_incognito_allowlist.h" #include <vector> @@ -50,6 +50,8 @@ const char* const kPersistentPrefNames[] = { ash::prefs::kAccessibilityAutoclickMovementThreshold, ash::prefs::kAccessibilityCaretHighlightEnabled, ash::prefs::kAccessibilityCursorHighlightEnabled, + ash::prefs::kAccessibilityCursorColorEnabled, + ash::prefs::kAccessibilityCursorColor, ash::prefs::kAccessibilityFocusHighlightEnabled, ash::prefs::kAccessibilitySelectToSpeakEnabled, ash::prefs::kAccessibilitySwitchAccessEnabled, @@ -165,7 +167,7 @@ const char* const kPersistentPrefNames[] = { namespace prefs { -std::vector<const char*> GetIncognitoPersistentPrefsWhitelist() { +std::vector<const char*> GetIncognitoPersistentPrefsAllowlist() { std::vector<const char*> whitelist; whitelist.insert(whitelist.end(), kPersistentPrefNames, kPersistentPrefNames + base::size(kPersistentPrefNames)); diff --git a/chromium/chrome/browser/prefs/pref_service_incognito_whitelist.h b/chromium/chrome/browser/prefs/pref_service_incognito_allowlist.h index 78123f6c04a..d9a12213347 100644 --- a/chromium/chrome/browser/prefs/pref_service_incognito_whitelist.h +++ b/chromium/chrome/browser/prefs/pref_service_incognito_allowlist.h @@ -2,8 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#ifndef CHROME_BROWSER_PREFS_PREF_SERVICE_INCOGNITO_WHITELIST_H_ -#define CHROME_BROWSER_PREFS_PREF_SERVICE_INCOGNITO_WHITELIST_H_ +#ifndef CHROME_BROWSER_PREFS_PREF_SERVICE_INCOGNITO_ALLOWLIST_H_ +#define CHROME_BROWSER_PREFS_PREF_SERVICE_INCOGNITO_ALLOWLIST_H_ #include <vector> @@ -12,8 +12,8 @@ namespace prefs { // Populate a list of all preferences that are stored in user profile in // incognito mode. // Please refer to the comments in .cc file. -std::vector<const char*> GetIncognitoPersistentPrefsWhitelist(); +std::vector<const char*> GetIncognitoPersistentPrefsAllowlist(); } // namespace prefs -#endif // CHROME_BROWSER_PREFS_PREF_SERVICE_INCOGNITO_WHITELIST_H_ +#endif // CHROME_BROWSER_PREFS_PREF_SERVICE_INCOGNITO_ALLOWLIST_H_ diff --git a/chromium/chrome/browser/prefs/pref_service_syncable_util.cc b/chromium/chrome/browser/prefs/pref_service_syncable_util.cc index 3008bb06f8d..b9e590838a8 100644 --- a/chromium/chrome/browser/prefs/pref_service_syncable_util.cc +++ b/chromium/chrome/browser/prefs/pref_service_syncable_util.cc @@ -6,7 +6,7 @@ #include <utility> -#include "chrome/browser/prefs/pref_service_incognito_whitelist.h" +#include "chrome/browser/prefs/pref_service_incognito_allowlist.h" #include "chrome/browser/profiles/profile.h" #include "components/sync_preferences/pref_service_syncable.h" @@ -23,5 +23,5 @@ CreateIncognitoPrefServiceSyncable( PrefStore* incognito_extension_pref_store) { return pref_service->CreateIncognitoPrefService( incognito_extension_pref_store, - prefs::GetIncognitoPersistentPrefsWhitelist()); + prefs::GetIncognitoPersistentPrefsAllowlist()); } diff --git a/chromium/chrome/browser/prefs/tracked/pref_hash_browsertest.cc b/chromium/chrome/browser/prefs/tracked/pref_hash_browsertest.cc index 5e192f0f61c..39a1d677fcc 100644 --- a/chromium/chrome/browser/prefs/tracked/pref_hash_browsertest.cc +++ b/chromium/chrome/browser/prefs/tracked/pref_hash_browsertest.cc @@ -84,6 +84,20 @@ base::string16 GetRegistryPathForTestProfile() { base::FilePath profile_dir; EXPECT_TRUE(base::PathService::Get(chrome::DIR_USER_DATA, &profile_dir)); + // |DIR_USER_DATA| usually has format %TMP%\12345_6789012345\user_data + // (unless running with --single-process-tests, where the format is + // %TMP%\scoped_dir12345_6789012345). Use the parent directory name instead of + // the leaf directory name "user_data" to avoid conflicts in parallel tests, + // which would try to modify the same registry key otherwise. + if (profile_dir.BaseName().value() == L"user_data") { + profile_dir = profile_dir.DirName(); + } + // Try to detect regressions when |DIR_USER_DATA| test location changes, which + // could cause this test to become flaky. See http://crbug/1091409 for more + // details. + DCHECK(profile_dir.BaseName().value().find_first_of(L"0123456789") != + std::string::npos); + // Use a location under the real PreferenceMACs path so that the backup // cleanup logic in ChromeTestLauncherDelegate::PreSharding() for interrupted // tests covers this test key as well. @@ -162,17 +176,9 @@ bool SupportsRegistryValidation() { } #define PREF_HASH_BROWSER_TEST(fixture, test_name) \ - IN_PROC_BROWSER_TEST_P(fixture, PRE_##test_name) { SetupPreferences(); } \ - IN_PROC_BROWSER_TEST_P(fixture, test_name) { VerifyReactionToPrefAttack(); } \ - INSTANTIATE_TEST_SUITE_P( \ - fixture##Instance, fixture, \ - testing::Values( \ - chrome_prefs::internals::kSettingsEnforcementGroupNoEnforcement, \ - chrome_prefs::internals::kSettingsEnforcementGroupEnforceAlways, \ - chrome_prefs::internals:: \ - kSettingsEnforcementGroupEnforceAlwaysWithDSE, \ - chrome_prefs::internals:: \ - kSettingsEnforcementGroupEnforceAlwaysWithExtensionsAndDSE)) + IN_PROC_BROWSER_TEST_F(fixture, PRE_##test_name) { SetupPreferences(); } \ + IN_PROC_BROWSER_TEST_F(fixture, test_name) { VerifyReactionToPrefAttack(); } \ + static_assert(true, "") // A base fixture designed such that implementations do two things: // 1) Override all three pure-virtual methods below to setup, attack, and @@ -180,9 +186,7 @@ bool SupportsRegistryValidation() { // 2) Instantiate their test via the PREF_HASH_BROWSER_TEST macro above. // Based on top of ExtensionBrowserTest to allow easy interaction with the // ExtensionRegistry. -class PrefHashBrowserTestBase - : public extensions::ExtensionBrowserTest, - public testing::WithParamInterface<std::string> { +class PrefHashBrowserTestBase : public extensions::ExtensionBrowserTest { public: // List of potential protection levels for this test in strict increasing // order of protection levels. @@ -197,17 +201,10 @@ class PrefHashBrowserTestBase PROTECTION_ENABLED_ALL }; - PrefHashBrowserTestBase() - : protection_level_(GetProtectionLevelFromTrialGroup(GetParam())) { - } + PrefHashBrowserTestBase() : protection_level_(GetProtectionLevel()) {} void SetUpCommandLine(base::CommandLine* command_line) override { extensions::ExtensionBrowserTest::SetUpCommandLine(command_line); - EXPECT_FALSE(command_line->HasSwitch(switches::kForceFieldTrials)); - command_line->AppendSwitchASCII( - switches::kForceFieldTrials, - std::string(chrome_prefs::internals::kSettingsEnforcementTrialName) + - "/" + GetParam() + "/"); #if defined(OS_CHROMEOS) command_line->AppendSwitch( chromeos::switches::kIgnoreUserProfileMappingForTests); @@ -414,15 +411,10 @@ class PrefHashBrowserTestBase const SettingsProtectionLevel protection_level_; private: - SettingsProtectionLevel GetProtectionLevelFromTrialGroup( - const std::string& trial_group) { + SettingsProtectionLevel GetProtectionLevel() { if (!ProfilePrefStoreManager::kPlatformSupportsPreferenceTracking) return PROTECTION_DISABLED_ON_PLATFORM; -// Protection levels can't be adjusted via --force-fieldtrials in official -// builds. -#if defined(OFFICIAL_BUILD) - #if defined(OS_WIN) || defined(OS_MACOSX) // The strongest mode is enforced on Windows and MacOS in the absence of a // field trial. @@ -430,23 +422,6 @@ class PrefHashBrowserTestBase #else return PROTECTION_DISABLED_FOR_GROUP; #endif // defined(OS_WIN) || defined(OS_MACOSX) - -#else // defined(OFFICIAL_BUILD) - - namespace internals = chrome_prefs::internals; - if (trial_group == internals::kSettingsEnforcementGroupNoEnforcement) - return PROTECTION_DISABLED_FOR_GROUP; - if (trial_group == internals::kSettingsEnforcementGroupEnforceAlways) - return PROTECTION_ENABLED_BASIC; - if (trial_group == internals::kSettingsEnforcementGroupEnforceAlwaysWithDSE) - return PROTECTION_ENABLED_DSE; - if (trial_group == - internals::kSettingsEnforcementGroupEnforceAlwaysWithExtensionsAndDSE) { - return PROTECTION_ENABLED_EXTENSIONS; - } - ADD_FAILURE(); - return static_cast<SettingsProtectionLevel>(-1); -#endif // defined(OFFICIAL_BUILD) } int num_tracked_prefs_; |