diff options
author | benwells <benwells@chromium.org> | 2015-06-25 18:25:57 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-06-26 01:26:38 +0000 |
commit | cb74965e5aab713293d9ba6dffa1b87ab1da872e (patch) | |
tree | bbb80792b16e478929d05a8d92afcd1b1865f6f4 /components/content_settings | |
parent | da8ec4a1a7d36de6f0ad1c34739f2f15a750be2a (diff) | |
download | chromium_src-cb74965e5aab713293d9ba6dffa1b87ab1da872e.zip chromium_src-cb74965e5aab713293d9ba6dffa1b87ab1da872e.tar.gz chromium_src-cb74965e5aab713293d9ba6dffa1b87ab1da872e.tar.bz2 |
Store site engagement values in a new content settings type.
The are currently not persisted anywhere.
BUG=464234
Review URL: https://codereview.chromium.org/1187113002
Cr-Commit-Position: refs/heads/master@{#336312}
Diffstat (limited to 'components/content_settings')
9 files changed, 42 insertions, 26 deletions
diff --git a/components/content_settings/core/browser/content_settings_default_provider.cc b/components/content_settings/core/browser/content_settings_default_provider.cc index 587e892..45a9fd6 100644 --- a/components/content_settings/core/browser/content_settings_default_provider.cc +++ b/components/content_settings/core/browser/content_settings_default_provider.cc @@ -36,9 +36,8 @@ struct DefaultContentSettingInfo { const ContentSetting default_value; }; -// The corresponding preference, default value and syncability for each -// default content setting. This array must be kept in sync with the enum -// |ContentSettingsType|. +// The corresponding preference and default value for each default content +// setting. This array must be kept in sync with the enum |ContentSettingsType|. const DefaultContentSettingInfo kDefaultSettings[] = { {prefs::kDefaultCookiesSetting, CONTENT_SETTING_ALLOW}, {prefs::kDefaultImagesSetting, CONTENT_SETTING_ALLOW}, @@ -65,7 +64,8 @@ const DefaultContentSettingInfo kDefaultSettings[] = { #elif defined(OS_ANDROID) || defined(OS_CHROMEOS) {prefs::kDefaultProtectedMediaIdentifierSetting, CONTENT_SETTING_ASK}, #endif - {prefs::kDefaultAppBannerSetting, CONTENT_SETTING_DEFAULT} + {prefs::kDefaultAppBannerSetting, CONTENT_SETTING_DEFAULT}, + {prefs::kDefaultSiteEngagementSetting, CONTENT_SETTING_DEFAULT}, }; static_assert(arraysize(kDefaultSettings) == CONTENT_SETTINGS_NUM_TYPES, "kDefaultSettings should have CONTENT_SETTINGS_NUM_TYPES " diff --git a/components/content_settings/core/browser/content_settings_policy_provider.cc b/components/content_settings/core/browser/content_settings_policy_provider.cc index 6be1a81..7b3faee 100644 --- a/components/content_settings/core/browser/content_settings_policy_provider.cc +++ b/components/content_settings/core/browser/content_settings_policy_provider.cc @@ -28,25 +28,26 @@ const char* kPrefToManageType[] = { prefs::kManagedDefaultPopupsSetting, prefs::kManagedDefaultGeolocationSetting, prefs::kManagedDefaultNotificationsSetting, - NULL, // No policy for default value of content type auto-select-certificate - NULL, // No policy for default value of fullscreen requests - NULL, // No policy for default value of mouse lock requests - NULL, // No policy for default value of mixed script blocking - NULL, // The MEDIASTREAM setting is deprecated + nullptr, // No policy for default value of auto select certificate + nullptr, // No policy for default value of fullscreen requests + nullptr, // No policy for default value of mouse lock requests + nullptr, // No policy for default value of mixed script blocking + nullptr, // The MEDIASTREAM setting is deprecated prefs::kManagedDefaultMediaStreamSetting, prefs::kManagedDefaultMediaStreamSetting, - NULL, // No policy for default value of protocol handlers - NULL, // No policy for default value of PPAPI broker - NULL, // No policy for default value of multiple automatic downloads - NULL, // No policy for default value of MIDI system exclusive requests - NULL, // No policy for default value of push messaging requests - NULL, // No policy for default value of SSL certificate decisions + nullptr, // No policy for default value of protocol handlers + nullptr, // No policy for default value of PPAPI broker + nullptr, // No policy for default value of multiple automatic downloads + nullptr, // No policy for default value of MIDI system exclusive requests + nullptr, // No policy for default value of push messaging requests + nullptr, // No policy for default value of SSL certificate decisions #if defined(OS_WIN) - NULL, // No policy for default value of "switch to desktop" + nullptr, // No policy for default value of "switch to desktop" #elif defined(OS_ANDROID) || defined(OS_CHROMEOS) - NULL, // No policy for default value of protected media identifier + nullptr, // No policy for default value of protected media identifier #endif - NULL, // No policy for default value of app banners + nullptr, // No policy for default value of app banners + nullptr, // No policy for default value of site engagement }; static_assert(arraysize(kPrefToManageType) == CONTENT_SETTINGS_NUM_TYPES, "kPrefToManageType should have CONTENT_SETTINGS_NUM_TYPES " @@ -226,7 +227,7 @@ void PolicyProvider::GetContentSettingsFromPreferences( DCHECK(pref); DCHECK(pref->IsManaged()); - const base::ListValue* pattern_str_list = NULL; + const base::ListValue* pattern_str_list = nullptr; if (!pref->GetValue()->GetAsList(&pattern_str_list)) { NOTREACHED(); return; @@ -275,7 +276,7 @@ void PolicyProvider::GetAutoSelectCertificateSettingsFromPreferences( DCHECK(pref); DCHECK(pref->IsManaged()); - const base::ListValue* pattern_filter_str_list = NULL; + const base::ListValue* pattern_filter_str_list = nullptr; if (!pref->GetValue()->GetAsList(&pattern_filter_str_list)) { NOTREACHED(); return; @@ -318,7 +319,7 @@ void PolicyProvider::GetAutoSelectCertificateSettingsFromPreferences( std::string pattern_str; bool pattern_read = pattern_filter_pair->GetStringWithoutPathExpansion( "pattern", &pattern_str); - base::DictionaryValue* cert_filter = NULL; + base::DictionaryValue* cert_filter = nullptr; pattern_filter_pair->GetDictionaryWithoutPathExpansion("filter", &cert_filter); if (!pattern_read || !cert_filter) { @@ -348,7 +349,7 @@ void PolicyProvider::GetAutoSelectCertificateSettingsFromPreferences( void PolicyProvider::ReadManagedDefaultSettings() { for (size_t type = 0; type < arraysize(kPrefToManageType); ++type) { - if (kPrefToManageType[type] == NULL) { + if (kPrefToManageType[type] == nullptr) { continue; } UpdateManagedDefaultSetting(ContentSettingsType(type)); @@ -413,7 +414,7 @@ void PolicyProvider::ShutdownOnUIThread() { if (!prefs_) return; pref_change_registrar_.RemoveAll(); - prefs_ = NULL; + prefs_ = nullptr; } void PolicyProvider::OnPreferenceChanged(const std::string& name) { diff --git a/components/content_settings/core/browser/content_settings_pref_provider.cc b/components/content_settings/core/browser/content_settings_pref_provider.cc index 8f8d8d3..118cabf 100644 --- a/components/content_settings/core/browser/content_settings_pref_provider.cc +++ b/components/content_settings/core/browser/content_settings_pref_provider.cc @@ -93,7 +93,8 @@ const char* kContentSettingsExceptionsPrefs[] = { #elif defined(OS_ANDROID) || defined(OS_CHROMEOS) prefs::kContentSettingsProtectedMediaIdentifierPatternPairs, #endif - prefs::kContentSettingsAppBannerPatternPairs + prefs::kContentSettingsAppBannerPatternPairs, + prefs::kContentSettingsSiteEngagementPatternPairs, }; static_assert(arraysize(kContentSettingsExceptionsPrefs) == CONTENT_SETTINGS_NUM_TYPES, diff --git a/components/content_settings/core/browser/content_settings_utils.cc b/components/content_settings/core/browser/content_settings_utils.cc index eed02d9..fc4b47a 100644 --- a/components/content_settings/core/browser/content_settings_utils.cc +++ b/components/content_settings/core/browser/content_settings_utils.cc @@ -50,6 +50,7 @@ const char* kTypeNames[] = { "protected-media-identifier", #endif "app-banner", + "site-engagement", }; static_assert(arraysize(kTypeNames) == CONTENT_SETTINGS_NUM_TYPES, "kTypeNames should have CONTENT_SETTINGS_NUM_TYPES elements"); diff --git a/components/content_settings/core/browser/host_content_settings_map.cc b/components/content_settings/core/browser/host_content_settings_map.cc index 9b906cf..b76fd31 100644 --- a/components/content_settings/core/browser/host_content_settings_map.cc +++ b/components/content_settings/core/browser/host_content_settings_map.cc @@ -567,12 +567,13 @@ bool HostContentSettingsMap::IsSettingAllowedForType( bool HostContentSettingsMap::ContentTypeHasCompoundValue( ContentSettingsType type) { // Values for content type CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, - // CONTENT_SETTINGS_TYPE_APP_BANNER, and + // CONTENT_SETTINGS_TYPE_APP_BANNER, CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT and // CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS are of type dictionary/map. // Compound types like dictionaries can't be mapped to the type // |ContentSetting|. return (type == CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE || type == CONTENT_SETTINGS_TYPE_APP_BANNER || + type == CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT || type == CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS); } diff --git a/components/content_settings/core/common/content_settings.cc b/components/content_settings/core/common/content_settings.cc index 91dd091..4840aa2 100644 --- a/components/content_settings/core/common/content_settings.cc +++ b/components/content_settings/core/common/content_settings.cc @@ -66,6 +66,8 @@ ContentSettingsTypeHistogram ContentSettingTypeToHistogramValue( #endif case CONTENT_SETTINGS_TYPE_APP_BANNER: return CONTENT_SETTINGS_TYPE_HISTOGRAM_APP_BANNER; + case CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT: + return CONTENT_SETTINGS_TYPE_HISTOGRAM_SITE_ENGAGEMENT; case CONTENT_SETTINGS_NUM_TYPES: return CONTENT_SETTINGS_TYPE_HISTOGRAM_INVALID; } @@ -104,6 +106,7 @@ bool IsContentSettingsTypeSyncable(ContentSettingsType content_setting) { case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER: #endif case CONTENT_SETTINGS_TYPE_APP_BANNER: + case CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT: return false; case CONTENT_SETTINGS_TYPE_DEFAULT: @@ -116,7 +119,8 @@ bool IsContentSettingsTypeSyncable(ContentSettingsType content_setting) { } bool IsContentSettingsTypeLossy(ContentSettingsType content_setting) { - return content_setting == CONTENT_SETTINGS_TYPE_APP_BANNER; + return content_setting == CONTENT_SETTINGS_TYPE_APP_BANNER || + content_setting == CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT; } ContentSettingPatternSource::ContentSettingPatternSource( diff --git a/components/content_settings/core/common/content_settings_types.h b/components/content_settings/core/common/content_settings_types.h index b1cf04c..155cfd9 100644 --- a/components/content_settings/core/common/content_settings_types.h +++ b/components/content_settings/core/common/content_settings_types.h @@ -47,6 +47,7 @@ enum ContentSettingsType { CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER, #endif CONTENT_SETTINGS_TYPE_APP_BANNER, + CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT, CONTENT_SETTINGS_NUM_TYPES, }; @@ -79,6 +80,7 @@ enum ContentSettingsTypeHistogram { CONTENT_SETTINGS_TYPE_HISTOGRAM_METRO_SWITCH_TO_DESKTOP, CONTENT_SETTINGS_TYPE_HISTOGRAM_PROTECTED_MEDIA_IDENTIFIER, CONTENT_SETTINGS_TYPE_HISTOGRAM_APP_BANNER, + CONTENT_SETTINGS_TYPE_HISTOGRAM_SITE_ENGAGEMENT, CONTENT_SETTINGS_HISTOGRAM_NUM_TYPES, }; diff --git a/components/content_settings/core/common/pref_names.cc b/components/content_settings/core/common/pref_names.cc index bffdc49..c8de238 100644 --- a/components/content_settings/core/common/pref_names.cc +++ b/components/content_settings/core/common/pref_names.cc @@ -79,6 +79,8 @@ const char kDefaultProtectedMediaIdentifierSetting[] = #endif const char kDefaultAppBannerSetting[] = "profile.default_content_setting_values.app_banner"; +const char kDefaultSiteEngagementSetting[] = + "profile.default_content_setting_values.site_engagement"; // Boolean indicating whether the media stream default setting had been // migrated into two separate microphone and camera settings. @@ -140,6 +142,8 @@ const char kContentSettingsProtectedMediaIdentifierPatternPairs[] = #endif const char kContentSettingsAppBannerPatternPairs[] = "profile.content_settings.exceptions.app_banner"; +const char kContentSettingsSiteEngagementPatternPairs[] = + "profile.content_settings.exceptions.site_engagement"; // Whether the patern pairs have been migrated from the deprecated aggregate // preference |kContentSettingsPatternPairs| to the separate preferences diff --git a/components/content_settings/core/common/pref_names.h b/components/content_settings/core/common/pref_names.h index 69591d5..3ee44b2 100644 --- a/components/content_settings/core/common/pref_names.h +++ b/components/content_settings/core/common/pref_names.h @@ -42,6 +42,7 @@ extern const char kDefaultMetroSwitchToDesktopSetting[]; extern const char kDefaultProtectedMediaIdentifierSetting[]; #endif extern const char kDefaultAppBannerSetting[]; +extern const char kDefaultSiteEngagementSetting[]; extern const char kMigratedDefaultMediaStreamSetting[]; @@ -72,6 +73,7 @@ extern const char kContentSettingsMetroSwitchToDesktopPatternPairs[]; extern const char kContentSettingsProtectedMediaIdentifierPatternPairs[]; #endif extern const char kContentSettingsAppBannerPatternPairs[]; +extern const char kContentSettingsSiteEngagementPatternPairs[]; extern const char kMigratedContentSettingsPatternPairs[]; |