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

Unified Diff: components/content_settings/core/browser/content_settings_pref_provider.h

Issue 1257093002: Remove the migration code from content_settings::PrefProvider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Lock testing function. Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: components/content_settings/core/browser/content_settings_pref_provider.h
diff --git a/components/content_settings/core/browser/content_settings_pref_provider.h b/components/content_settings/core/browser/content_settings_pref_provider.h
index ec235a9407d9fe4950dcc4fcdc783cedcedbdb9f..7a6460334b77b5e6b1f81f816bc4703100bc618c 100644
--- a/components/content_settings/core/browser/content_settings_pref_provider.h
+++ b/components/content_settings/core/browser/content_settings_pref_provider.h
@@ -39,6 +39,10 @@ class PrefProvider : public ObservableProvider {
PrefProvider(PrefService* prefs, bool incognito);
~PrefProvider() override;
+ // Whether |pref_name| is a name of one of the preferences for content
+ // settings exceptions.
+ static bool IsContentSettingsExceptionsPref(const std::string& pref_name);
+
// ProviderInterface implementations.
RuleIterator* GetRuleIterator(ContentSettingsType content_type,
const ResourceIdentifier& resource_identifier,
@@ -72,18 +76,10 @@ class PrefProvider : public ObservableProvider {
void SetClockForTesting(scoped_ptr<base::Clock> clock);
private:
- friend class DeadlockCheckerThread; // For testing.
-
- // Migrate the old media setting into new mic/camera content settings.
- void MigrateObsoleteMediaContentSetting();
+ friend class DeadlockCheckerObserver; // For testing.
- // Migrate the settings from the old aggregate dictionary into the new format.
- void MigrateAllExceptions();
-
- // Writes the contents of the old aggregate dictionary preferences into
- // separate dictionaries for content types. If |syncable_only| is true,
- // only syncable content types will be written.
- void WriteSettingsToNewPreferences(bool syncable_only);
+ // Clean up the obsolete preferences from the user's profile.
+ void DiscardObsoletePreferences();
// Weak; owned by the Profile and reset in ShutdownOnUIThread.
PrefService* prefs_;
@@ -97,54 +93,9 @@ class PrefProvider : public ObservableProvider {
ScopedVector<ContentSettingsPref> content_settings_prefs_;
- DISALLOW_COPY_AND_ASSIGN(PrefProvider);
-
- bool TestAllLocks() const;
-
- // All functionality regarding reading and writing of preferences has been
- // moved to |ContentSettingsPref|, which manages one content type per
- // instance. However, for backward compatibility, we need to be able to write
- // to the old and deprecated aggregate dictionary preference which maintains
- // all content types. Therefore, |ContentSettingsPrefProvider| must still
- // retain some of the functionality of |ContentSettingsPref|. The following
- // attributes and methods serve this purpose.
- // TODO(msramek): Remove this migration code after two stable releases.
- struct ContentSettingsPrefEntry {
- ContentSettingsPrefEntry(const ContentSettingsPattern primary_pattern,
- const ContentSettingsPattern secondary_pattern,
- const ResourceIdentifier resource_identifier,
- base::Value* value);
- ContentSettingsPrefEntry(const ContentSettingsPrefEntry& entry);
- ContentSettingsPrefEntry& operator=(const ContentSettingsPrefEntry& entry);
- ~ContentSettingsPrefEntry();
-
- ContentSettingsPattern primary_pattern;
- ContentSettingsPattern secondary_pattern;
- ResourceIdentifier resource_identifier;
- scoped_ptr<base::Value> value;
- };
-
- // Stores exceptions read from the old preference before writing them
- // to the new one.
- ScopedVector<ContentSettingsPrefEntry>
- pref_entry_map_[CONTENT_SETTINGS_NUM_TYPES];
-
- // Clears |pref_entry_map_|.
- void ClearPrefEntryMap();
-
- // Guards access to |pref_entry_map_|.
- mutable base::Lock old_lock_;
-
- // Indicates whether the old preferences are updated.
- bool updating_old_preferences_;
-
- // Called when the old preference changes.
- void OnOldContentSettingsPatternPairsChanged();
-
- // Reads the old preference and writes it to |pref_entry_map_|.
- void ReadContentSettingsFromOldPref();
-
base::ThreadChecker thread_checker_;
+
+ DISALLOW_COPY_AND_ASSIGN(PrefProvider);
};
} // namespace content_settings

Powered by Google App Engine
This is Rietveld 408576698