diff options
Diffstat (limited to 'components/content_settings')
12 files changed, 125 insertions, 142 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 e36cf7f..cf0943e 100644 --- a/components/content_settings/core/browser/content_settings_default_provider.cc +++ b/components/content_settings/core/browser/content_settings_default_provider.cc @@ -17,7 +17,6 @@ #include "base/prefs/scoped_user_pref_update.h" #include "components/content_settings/core/browser/content_settings_rule.h" #include "components/content_settings/core/browser/content_settings_utils.h" -#include "components/content_settings/core/browser/plugins_field_trial.h" #include "components/content_settings/core/browser/website_settings_info.h" #include "components/content_settings/core/browser/website_settings_registry.h" #include "components/content_settings/core/common/content_settings.h" @@ -39,12 +38,7 @@ const char kObsoleteMigratedDefaultContentSettings[] = const char kObsoleteMigratedDefaultMediaStreamSetting[] = "profile.migrated_default_media_stream_content_settings"; -ContentSetting GetDefaultValue(ContentSettingsType type) { - if (type == CONTENT_SETTINGS_TYPE_PLUGINS) - return PluginsFieldTrial::GetDefaultPluginsContentSetting(); - - const WebsiteSettingsInfo* info = - WebsiteSettingsRegistry::GetInstance()->Get(type); +ContentSetting GetDefaultValue(const WebsiteSettingsInfo* info) { const base::Value* initial_default = info->initial_default_value(); if (!initial_default) return CONTENT_SETTING_DEFAULT; @@ -54,6 +48,10 @@ ContentSetting GetDefaultValue(ContentSettingsType type) { return static_cast<ContentSetting>(result); } +ContentSetting GetDefaultValue(ContentSettingsType type) { + return GetDefaultValue(WebsiteSettingsRegistry::GetInstance()->Get(type)); +} + const std::string& GetPrefName(ContentSettingsType type) { return WebsiteSettingsRegistry::GetInstance() ->Get(type) @@ -86,10 +84,14 @@ class DefaultRuleIterator : public RuleIterator { void DefaultProvider::RegisterProfilePrefs( user_prefs::PrefRegistrySyncable* registry) { // Register the default settings' preferences. + WebsiteSettingsRegistry* website_settings = + WebsiteSettingsRegistry::GetInstance(); for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { ContentSettingsType type = static_cast<ContentSettingsType>(i); - registry->RegisterIntegerPref(GetPrefName(type), GetDefaultValue(type), - PrefRegistrationFlagsForType(type)); + const WebsiteSettingsInfo* info = website_settings->Get(type); + registry->RegisterIntegerPref(info->default_value_pref_name(), + GetDefaultValue(info), + info->GetPrefRegistrationFlags()); } // Obsolete prefs ------------------------------------------------------- @@ -243,10 +245,9 @@ RuleIterator* DefaultProvider::GetRuleIterator( bool incognito) const { base::AutoLock lock(lock_); if (resource_identifier.empty()) { - ValueMap::const_iterator it(default_settings_.find(content_type)); - if (it != default_settings_.end()) { - return new DefaultRuleIterator(it->second.get()); - } + auto it(default_settings_.find(content_type)); + if (it != default_settings_.end()) + return new DefaultRuleIterator(it->second); NOTREACHED(); } return new EmptyRuleIterator(); @@ -285,10 +286,10 @@ bool DefaultProvider::IsValueEmptyOrDefault(ContentSettingsType content_type, void DefaultProvider::ChangeSetting(ContentSettingsType content_type, base::Value* value) { if (!value) { - default_settings_[content_type].reset( - ContentSettingToValue(GetDefaultValue(content_type)).release()); + default_settings_.set(content_type, + ContentSettingToValue(GetDefaultValue(content_type))); } else { - default_settings_[content_type].reset(value->DeepCopy()); + default_settings_.set(content_type, make_scoped_ptr(value->DeepCopy())); } } @@ -352,16 +353,6 @@ scoped_ptr<base::Value> DefaultProvider::ReadFromPref( return ContentSettingToValue(IntToContentSetting(int_value)).Pass(); } -void DefaultProvider::ForceDefaultsToBeExplicit(ValueMap* value_map) { - for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { - ContentSettingsType type = static_cast<ContentSettingsType>(i); - if (!(*value_map)[type].get()) { - (*value_map)[type].reset(ContentSettingToValue( - GetDefaultValue(type)).release()); - } - } -} - void DefaultProvider::DiscardObsoletePreferences() { prefs_->ClearPref(kObsoleteDefaultContentSettings); prefs_->ClearPref(kObsoleteMigratedDefaultContentSettings); diff --git a/components/content_settings/core/browser/content_settings_default_provider.h b/components/content_settings/core/browser/content_settings_default_provider.h index 52b668c..0877c6f 100644 --- a/components/content_settings/core/browser/content_settings_default_provider.h +++ b/components/content_settings/core/browser/content_settings_default_provider.h @@ -10,7 +10,8 @@ #include <vector> #include "base/basictypes.h" -#include "base/memory/linked_ptr.h" +#include "base/containers/scoped_ptr_map.h" +#include "base/memory/scoped_ptr.h" #include "base/prefs/pref_change_registrar.h" #include "base/synchronization/lock.h" #include "components/content_settings/core/browser/content_settings_observable_provider.h" @@ -50,9 +51,6 @@ class DefaultProvider : public ObservableProvider { void ShutdownOnUIThread() override; private: - typedef linked_ptr<base::Value> ValuePtr; - typedef std::map<ContentSettingsType, ValuePtr> ValueMap; - // Reads all settings from the pref service. void ReadDefaultSettings(); @@ -63,10 +61,6 @@ class DefaultProvider : public ObservableProvider { bool IsValueEmptyOrDefault(ContentSettingsType content_type, base::Value* value); - // Forces the default settings in |value_map| to be explicitly set instead - // of themselves being CONTENT_SETTING_DEFAULT. - void ForceDefaultsToBeExplicit(ValueMap* value_map); - // Reads the preference corresponding to |content_type|. scoped_ptr<base::Value> ReadFromPref(ContentSettingsType content_type); @@ -82,7 +76,8 @@ class DefaultProvider : public ObservableProvider { void DiscardObsoletePreferences(); // Copies of the pref data, so that we can read it on the IO thread. - ValueMap default_settings_; + base::ScopedPtrMap<ContentSettingsType, scoped_ptr<base::Value>> + default_settings_; PrefService* prefs_; 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 352d32c..a961c2f 100644 --- a/components/content_settings/core/browser/content_settings_pref_provider.cc +++ b/components/content_settings/core/browser/content_settings_pref_provider.cc @@ -57,9 +57,10 @@ void PrefProvider::RegisterProfilePrefs( WebsiteSettingsRegistry* website_settings = WebsiteSettingsRegistry::GetInstance(); for (int i = 0; i < CONTENT_SETTINGS_NUM_TYPES; ++i) { - registry->RegisterDictionaryPref( - website_settings->Get(static_cast<ContentSettingsType>(i))->pref_name(), - PrefRegistrationFlagsForType(ContentSettingsType(i))); + const WebsiteSettingsInfo* info = + website_settings->Get(static_cast<ContentSettingsType>(i)); + registry->RegisterDictionaryPref(info->pref_name(), + info->GetPrefRegistrationFlags()); } // Obsolete prefs ---------------------------------------------------------- diff --git a/components/content_settings/core/browser/content_settings_utils.cc b/components/content_settings/core/browser/content_settings_utils.cc index 0b40d22..5e35a21 100644 --- a/components/content_settings/core/browser/content_settings_utils.cc +++ b/components/content_settings/core/browser/content_settings_utils.cc @@ -196,16 +196,4 @@ void GetRendererContentSettingRules(const HostContentSettingsMap* map, &(rules->script_rules)); } -uint32 PrefRegistrationFlagsForType(ContentSettingsType content_type) { - uint32 flags = PrefRegistry::NO_REGISTRATION_FLAGS; - - if (IsContentSettingsTypeSyncable(content_type)) - flags |= user_prefs::PrefRegistrySyncable::SYNCABLE_PREF; - - if (IsContentSettingsTypeLossy(content_type)) - flags |= PrefRegistry::LOSSY_PREF; - - return flags; -} - } // namespace content_settings diff --git a/components/content_settings/core/browser/content_settings_utils.h b/components/content_settings/core/browser/content_settings_utils.h index 39e39b4..d1bd9fe 100644 --- a/components/content_settings/core/browser/content_settings_utils.h +++ b/components/content_settings/core/browser/content_settings_utils.h @@ -74,10 +74,6 @@ base::Value* GetContentSettingValueAndPatterns( void GetRendererContentSettingRules(const HostContentSettingsMap* map, RendererContentSettingRules* rules); -// Get the flags to use when registering the preference to store |content_type| -// settings. -uint32 PrefRegistrationFlagsForType(ContentSettingsType content_type); - } // namespace content_settings #endif // COMPONENTS_CONTENT_SETTINGS_CORE_BROWSER_CONTENT_SETTINGS_UTILS_H_ diff --git a/components/content_settings/core/browser/website_settings_info.cc b/components/content_settings/core/browser/website_settings_info.cc index 7dd2f2d..20faa27 100644 --- a/components/content_settings/core/browser/website_settings_info.cc +++ b/components/content_settings/core/browser/website_settings_info.cc @@ -5,8 +5,10 @@ #include "components/content_settings/core/browser/website_settings_info.h" #include "base/logging.h" +#include "base/prefs/pref_registry.h" #include "base/strings/string_util.h" #include "base/values.h" +#include "components/pref_registry/pref_registry_syncable.h" namespace { @@ -26,12 +28,16 @@ namespace content_settings { WebsiteSettingsInfo::WebsiteSettingsInfo( ContentSettingsType type, const std::string& name, - scoped_ptr<base::Value> initial_default_value) + scoped_ptr<base::Value> initial_default_value, + SyncStatus sync_status, + LossyStatus lossy_status) : type_(type), name_(name), pref_name_(GetPrefName(name, kPrefPrefix)), default_value_pref_name_(GetPrefName(name, kDefaultPrefPrefix)), - initial_default_value_(initial_default_value.Pass()) { + initial_default_value_(initial_default_value.Pass()), + sync_status_(sync_status), + lossy_status_(lossy_status) { // For legacy reasons the default value is currently restricted to be an int. // TODO(raymes): We should migrate the underlying pref to be a dictionary // rather than an int. @@ -41,4 +47,16 @@ WebsiteSettingsInfo::WebsiteSettingsInfo( WebsiteSettingsInfo::~WebsiteSettingsInfo() {} +uint32 WebsiteSettingsInfo::GetPrefRegistrationFlags() const { + uint32 flags = PrefRegistry::NO_REGISTRATION_FLAGS; + + if (sync_status_ == SYNCABLE) + flags |= user_prefs::PrefRegistrySyncable::SYNCABLE_PREF; + + if (lossy_status_ == LOSSY) + flags |= PrefRegistry::LOSSY_PREF; + + return flags; +} + } // namespace content_settings diff --git a/components/content_settings/core/browser/website_settings_info.h b/components/content_settings/core/browser/website_settings_info.h index cdbe329..e947ba6 100644 --- a/components/content_settings/core/browser/website_settings_info.h +++ b/components/content_settings/core/browser/website_settings_info.h @@ -21,9 +21,15 @@ namespace content_settings { // TODO(raymes): Move more properties into this class. class WebsiteSettingsInfo { public: + enum SyncStatus { SYNCABLE, UNSYNCABLE }; + + enum LossyStatus { LOSSY, NOT_LOSSY }; + WebsiteSettingsInfo(ContentSettingsType type, const std::string& name, - scoped_ptr<base::Value> initial_default_value); + scoped_ptr<base::Value> initial_default_value, + SyncStatus sync_status, + LossyStatus lossy_status); ~WebsiteSettingsInfo(); ContentSettingsType type() const { return type_; } @@ -37,6 +43,8 @@ class WebsiteSettingsInfo { return initial_default_value_.get(); } + uint32 GetPrefRegistrationFlags() const; + private: const ContentSettingsType type_; const std::string name_; @@ -44,6 +52,8 @@ class WebsiteSettingsInfo { const std::string pref_name_; const std::string default_value_pref_name_; const scoped_ptr<base::Value> initial_default_value_; + const SyncStatus sync_status_; + const LossyStatus lossy_status_; DISALLOW_COPY_AND_ASSIGN(WebsiteSettingsInfo); }; diff --git a/components/content_settings/core/browser/website_settings_registry.cc b/components/content_settings/core/browser/website_settings_registry.cc index b10c66a..b8df7af 100644 --- a/components/content_settings/core/browser/website_settings_registry.cc +++ b/components/content_settings/core/browser/website_settings_registry.cc @@ -6,11 +6,12 @@ #include "base/logging.h" #include "base/values.h" +#include "components/content_settings/core/browser/plugins_field_trial.h" #include "components/content_settings/core/common/content_settings.h" namespace { -base::LazyInstance<content_settings::WebsiteSettingsRegistry>::Leaky +base::LazyInstance<content_settings::WebsiteSettingsRegistry> g_instance = LAZY_INSTANCE_INITIALIZER; } // namespace @@ -34,57 +35,68 @@ WebsiteSettingsRegistry::WebsiteSettingsRegistry() { // Content settings (those with allow/block/ask/etc. values). RegisterContentSetting(CONTENT_SETTINGS_TYPE_COOKIES, "cookies", - CONTENT_SETTING_ALLOW); + CONTENT_SETTING_ALLOW, WebsiteSettingsInfo::SYNCABLE); RegisterContentSetting(CONTENT_SETTINGS_TYPE_IMAGES, "images", - CONTENT_SETTING_ALLOW); + CONTENT_SETTING_ALLOW, WebsiteSettingsInfo::SYNCABLE); RegisterContentSetting(CONTENT_SETTINGS_TYPE_JAVASCRIPT, "javascript", - CONTENT_SETTING_ALLOW); + CONTENT_SETTING_ALLOW, WebsiteSettingsInfo::SYNCABLE); RegisterContentSetting(CONTENT_SETTINGS_TYPE_PLUGINS, "plugins", - CONTENT_SETTING_DEFAULT); + PluginsFieldTrial::GetDefaultPluginsContentSetting(), + WebsiteSettingsInfo::SYNCABLE); RegisterContentSetting(CONTENT_SETTINGS_TYPE_POPUPS, "popups", - CONTENT_SETTING_BLOCK); + CONTENT_SETTING_BLOCK, WebsiteSettingsInfo::SYNCABLE); RegisterContentSetting(CONTENT_SETTINGS_TYPE_GEOLOCATION, "geolocation", - CONTENT_SETTING_ASK); + CONTENT_SETTING_ASK, WebsiteSettingsInfo::UNSYNCABLE); RegisterContentSetting(CONTENT_SETTINGS_TYPE_NOTIFICATIONS, "notifications", - CONTENT_SETTING_ASK); + CONTENT_SETTING_ASK, WebsiteSettingsInfo::UNSYNCABLE); RegisterContentSetting(CONTENT_SETTINGS_TYPE_FULLSCREEN, "fullscreen", - CONTENT_SETTING_ASK); + CONTENT_SETTING_ASK, WebsiteSettingsInfo::SYNCABLE); RegisterContentSetting(CONTENT_SETTINGS_TYPE_MOUSELOCK, "mouselock", - CONTENT_SETTING_ASK); + CONTENT_SETTING_ASK, WebsiteSettingsInfo::SYNCABLE); RegisterContentSetting(CONTENT_SETTINGS_TYPE_MIXEDSCRIPT, "mixed-script", - CONTENT_SETTING_DEFAULT); + CONTENT_SETTING_DEFAULT, + WebsiteSettingsInfo::SYNCABLE); RegisterContentSetting(CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, - "media-stream-mic", CONTENT_SETTING_ASK); + "media-stream-mic", CONTENT_SETTING_ASK, + WebsiteSettingsInfo::UNSYNCABLE); RegisterContentSetting(CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, - "media-stream-camera", CONTENT_SETTING_ASK); + "media-stream-camera", CONTENT_SETTING_ASK, + WebsiteSettingsInfo::UNSYNCABLE); RegisterContentSetting(CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS, - "protocol-handler", CONTENT_SETTING_DEFAULT); + "protocol-handler", CONTENT_SETTING_DEFAULT, + WebsiteSettingsInfo::UNSYNCABLE); RegisterContentSetting(CONTENT_SETTINGS_TYPE_PPAPI_BROKER, "ppapi-broker", - CONTENT_SETTING_ASK); + CONTENT_SETTING_ASK, WebsiteSettingsInfo::UNSYNCABLE); RegisterContentSetting(CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS, - "automatic-downloads", CONTENT_SETTING_ASK); + "automatic-downloads", CONTENT_SETTING_ASK, + WebsiteSettingsInfo::SYNCABLE); RegisterContentSetting(CONTENT_SETTINGS_TYPE_MIDI_SYSEX, "midi-sysex", - CONTENT_SETTING_ASK); + CONTENT_SETTING_ASK, WebsiteSettingsInfo::SYNCABLE); RegisterContentSetting(CONTENT_SETTINGS_TYPE_PUSH_MESSAGING, "push-messaging", - CONTENT_SETTING_ASK); + CONTENT_SETTING_ASK, WebsiteSettingsInfo::SYNCABLE); #if defined(OS_ANDROID) || defined(OS_CHROMEOS) RegisterContentSetting(CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER, - "protected-media-identifier", CONTENT_SETTING_ASK); + "protected-media-identifier", CONTENT_SETTING_ASK, + WebsiteSettingsInfo::UNSYNCABLE); #endif RegisterContentSetting(CONTENT_SETTINGS_TYPE_DURABLE_STORAGE, - "durable-storage", CONTENT_SETTING_ASK); + "durable-storage", CONTENT_SETTING_ASK, + WebsiteSettingsInfo::UNSYNCABLE); // Website settings. RegisterWebsiteSetting(CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, - "auto-select-certificate"); + "auto-select-certificate", + WebsiteSettingsInfo::NOT_LOSSY); RegisterWebsiteSetting(CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS, - "ssl-cert-decisions"); - RegisterWebsiteSetting(CONTENT_SETTINGS_TYPE_APP_BANNER, "app-banner"); + "ssl-cert-decisions", WebsiteSettingsInfo::NOT_LOSSY); + RegisterWebsiteSetting(CONTENT_SETTINGS_TYPE_APP_BANNER, "app-banner", + WebsiteSettingsInfo::LOSSY); RegisterWebsiteSetting(CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT, - "site-engagement"); + "site-engagement", WebsiteSettingsInfo::LOSSY); // Deprecated. - RegisterWebsiteSetting(CONTENT_SETTINGS_TYPE_MEDIASTREAM, "media-stream"); + RegisterWebsiteSetting(CONTENT_SETTINGS_TYPE_MEDIASTREAM, "media-stream", + WebsiteSettingsInfo::NOT_LOSSY); } WebsiteSettingsRegistry::~WebsiteSettingsRegistry() {} @@ -105,19 +117,24 @@ const WebsiteSettingsInfo* WebsiteSettingsRegistry::GetByName( return nullptr; } -void WebsiteSettingsRegistry::RegisterWebsiteSetting(ContentSettingsType type, - const std::string& name) { - StoreWebsiteSettingsInfo(new WebsiteSettingsInfo(type, name, nullptr)); +void WebsiteSettingsRegistry::RegisterWebsiteSetting( + ContentSettingsType type, + const std::string& name, + WebsiteSettingsInfo::LossyStatus lossy_status) { + StoreWebsiteSettingsInfo(new WebsiteSettingsInfo( + type, name, nullptr, WebsiteSettingsInfo::UNSYNCABLE, lossy_status)); } void WebsiteSettingsRegistry::RegisterContentSetting( ContentSettingsType type, const std::string& name, - ContentSetting initial_default_value) { + ContentSetting initial_default_value, + WebsiteSettingsInfo::SyncStatus sync_status) { scoped_ptr<base::Value> default_value( new base::FundamentalValue(static_cast<int>(initial_default_value))); StoreWebsiteSettingsInfo( - new WebsiteSettingsInfo(type, name, default_value.Pass())); + new WebsiteSettingsInfo(type, name, default_value.Pass(), sync_status, + WebsiteSettingsInfo::NOT_LOSSY)); } void WebsiteSettingsRegistry::StoreWebsiteSettingsInfo( diff --git a/components/content_settings/core/browser/website_settings_registry.h b/components/content_settings/core/browser/website_settings_registry.h index e8ca8c3..099e6a0 100644 --- a/components/content_settings/core/browser/website_settings_registry.h +++ b/components/content_settings/core/browser/website_settings_registry.h @@ -35,14 +35,20 @@ class WebsiteSettingsRegistry { ~WebsiteSettingsRegistry(); // Register a new website setting. This maps an arbitrary base::Value to an - // origin. + // origin. NOTE: Currently we don't pass in WebsiteSettingsInfo::SyncStatus as + // a property of a WebsiteSetting here but this is only because there are + // currently no WebsiteSettings that need to be synced. We should add that as + // a parameter here in the future if a setting were to be added which needs to + // be synced. void RegisterWebsiteSetting(ContentSettingsType type, - const std::string& name); + const std::string& name, + WebsiteSettingsInfo::LossyStatus lossy_status); // Register a new content setting. This maps an ALLOW/ASK/BLOCK value (see the // ContentSetting enum) to an origin. void RegisterContentSetting(ContentSettingsType type, const std::string& name, - ContentSetting initial_default_value); + ContentSetting initial_default_value, + WebsiteSettingsInfo::SyncStatus sync_status); // Helper used by Register/RegisterPermission. void StoreWebsiteSettingsInfo(WebsiteSettingsInfo* info); diff --git a/components/content_settings/core/browser/website_settings_registry_unittest.cc b/components/content_settings/core/browser/website_settings_registry_unittest.cc index f9ae40b..9377065 100644 --- a/components/content_settings/core/browser/website_settings_registry_unittest.cc +++ b/components/content_settings/core/browser/website_settings_registry_unittest.cc @@ -3,11 +3,13 @@ // found in the LICENSE file. #include "base/logging.h" +#include "base/prefs/pref_registry.h" #include "base/values.h" #include "components/content_settings/core/browser/website_settings_info.h" #include "components/content_settings/core/browser/website_settings_registry.h" #include "components/content_settings/core/common/content_settings.h" #include "components/content_settings/core/common/content_settings_types.h" +#include "components/pref_registry/pref_registry_syncable.h" #include "testing/gtest/include/gtest/gtest.h" namespace content_settings { @@ -51,6 +53,8 @@ TEST_F(WebsiteSettingsRegistryTest, Properties) { int setting; ASSERT_TRUE(info->initial_default_value()->GetAsInteger(&setting)); EXPECT_EQ(CONTENT_SETTING_ALLOW, setting); + EXPECT_EQ(user_prefs::PrefRegistrySyncable::SYNCABLE_PREF, + info->GetPrefRegistrationFlags()); info = registry()->Get(CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA); ASSERT_TRUE(info); @@ -60,6 +64,15 @@ TEST_F(WebsiteSettingsRegistryTest, Properties) { info->default_value_pref_name()); ASSERT_TRUE(info->initial_default_value()->GetAsInteger(&setting)); EXPECT_EQ(CONTENT_SETTING_ASK, setting); + EXPECT_EQ(PrefRegistry::NO_REGISTRATION_FLAGS, + info->GetPrefRegistrationFlags()); + + info = registry()->Get(CONTENT_SETTINGS_TYPE_APP_BANNER); + EXPECT_EQ(PrefRegistry::LOSSY_PREF, info->GetPrefRegistrationFlags()); + + info = registry()->Get(CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE); + EXPECT_EQ(PrefRegistry::NO_REGISTRATION_FLAGS, + info->GetPrefRegistrationFlags()); } } // namespace content_settings diff --git a/components/content_settings/core/common/content_settings.cc b/components/content_settings/core/common/content_settings.cc index ef9d364..583bfa2 100644 --- a/components/content_settings/core/common/content_settings.cc +++ b/components/content_settings/core/common/content_settings.cc @@ -74,52 +74,6 @@ ContentSettingsTypeHistogram ContentSettingTypeToHistogramValue( return CONTENT_SETTINGS_TYPE_HISTOGRAM_INVALID; } -bool IsContentSettingsTypeSyncable(ContentSettingsType content_setting) { - switch (content_setting) { - case CONTENT_SETTINGS_TYPE_COOKIES: - case CONTENT_SETTINGS_TYPE_IMAGES: - case CONTENT_SETTINGS_TYPE_JAVASCRIPT: - case CONTENT_SETTINGS_TYPE_PLUGINS: - case CONTENT_SETTINGS_TYPE_POPUPS: - case CONTENT_SETTINGS_TYPE_FULLSCREEN: - case CONTENT_SETTINGS_TYPE_MOUSELOCK: - case CONTENT_SETTINGS_TYPE_MIXEDSCRIPT: - case CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS: - case CONTENT_SETTINGS_TYPE_AUTOMATIC_DOWNLOADS: - case CONTENT_SETTINGS_TYPE_MIDI_SYSEX: - case CONTENT_SETTINGS_TYPE_PUSH_MESSAGING: - return true; - - case CONTENT_SETTINGS_TYPE_GEOLOCATION: - case CONTENT_SETTINGS_TYPE_NOTIFICATIONS: - case CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE: - case CONTENT_SETTINGS_TYPE_MEDIASTREAM: - case CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC: - case CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA: - case CONTENT_SETTINGS_TYPE_PPAPI_BROKER: - case CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS: -#if defined(OS_ANDROID) || defined(OS_CHROMEOS) - case CONTENT_SETTINGS_TYPE_PROTECTED_MEDIA_IDENTIFIER: -#endif - case CONTENT_SETTINGS_TYPE_APP_BANNER: - case CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT: - case CONTENT_SETTINGS_TYPE_DURABLE_STORAGE: - return false; - - case CONTENT_SETTINGS_TYPE_DEFAULT: - case CONTENT_SETTINGS_NUM_TYPES: - NOTREACHED(); - return false; - } - NOTREACHED(); - return false; -} - -bool IsContentSettingsTypeLossy(ContentSettingsType content_setting) { - return content_setting == CONTENT_SETTINGS_TYPE_APP_BANNER || - content_setting == CONTENT_SETTINGS_TYPE_SITE_ENGAGEMENT; -} - ContentSettingPatternSource::ContentSettingPatternSource( const ContentSettingsPattern& primary_pattern, const ContentSettingsPattern& secondary_pattern, diff --git a/components/content_settings/core/common/content_settings.h b/components/content_settings/core/common/content_settings.h index 48f16e5..94b6900 100644 --- a/components/content_settings/core/common/content_settings.h +++ b/components/content_settings/core/common/content_settings.h @@ -34,12 +34,6 @@ ContentSetting IntToContentSetting(int content_setting); ContentSettingsTypeHistogram ContentSettingTypeToHistogramValue( ContentSettingsType content_setting); -// Whether this content setting should be synced. -bool IsContentSettingsTypeSyncable(ContentSettingsType content_setting); - -// Whether this content setting can tolerate data being lost. -bool IsContentSettingsTypeLossy(ContentSettingsType content_setting); - struct ContentSettingPatternSource { ContentSettingPatternSource(const ContentSettingsPattern& primary_pattern, const ContentSettingsPattern& secondary_patttern, |