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

Unified Diff: chrome/browser/prefs/pref_service.cc

Issue 9015012: Get rid of trivial IncognitoUserPrefStore and PerTabUserPrefStore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years 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
« no previous file with comments | « chrome/browser/prefs/per_tab_user_pref_store.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/prefs/pref_service.cc
diff --git a/chrome/browser/prefs/pref_service.cc b/chrome/browser/prefs/pref_service.cc
index 215fbd3bbf91b5c7300260a31899ee0d2c81bfe8..1e9b5e311274c2109c34d42865f2f2023e333cf8 100644
--- a/chrome/browser/prefs/pref_service.cc
+++ b/chrome/browser/prefs/pref_service.cc
@@ -24,13 +24,13 @@
#include "chrome/browser/policy/configuration_policy_pref_store.h"
#include "chrome/browser/prefs/command_line_pref_store.h"
#include "chrome/browser/prefs/default_pref_store.h"
-#include "chrome/browser/prefs/incognito_user_pref_store.h"
-#include "chrome/browser/prefs/per_tab_user_pref_store.h"
+#include "chrome/browser/prefs/overlay_user_pref_store.h"
#include "chrome/browser/prefs/pref_model_associator.h"
#include "chrome/browser/prefs/pref_notifier_impl.h"
#include "chrome/browser/prefs/pref_value_store.h"
#include "chrome/browser/ui/profile_error_dialog.h"
#include "chrome/common/json_pref_store.h"
+#include "chrome/common/pref_names.h"
#include "content/public/browser/browser_thread.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
@@ -111,6 +111,66 @@ class ReadErrorHandler : public PersistentPrefStore::ReadErrorDelegate {
}
};
+static void InitIncognitoUserPrefStore(OverlayUserPrefStore* pref_store) {
Bernhard Bauer 2011/12/30 17:54:16 You could move this into browser_prefs.cc, where t
+ // List of keys that cannot be changed in the user prefs file by the incognito
+ // profile. All preferences that store information about the browsing history
+ // or behavior of the user should have this property.
+ pref_store->RegisterOverlayPref(prefs::kBrowserWindowPlacement);
+}
+
+static void InitPerTabUserPrefStore(OverlayUserPrefStore* pref_store) {
+ // List of keys that have per-tab and per-profile (Global) counterpart.
+ // Setting a per-profile preference affects all tabs sharing the profile,
+ // unless a tab has specified its own per-tab property value. Changing a
+ // per-profile preference on a per-tab pref store delegates to underlay
+ // per-profile pref store.
+ pref_store->RegisterOverlayPref(
+ prefs::kWebKitJavascriptEnabled,
+ prefs::kWebKitGlobalJavascriptEnabled);
+ pref_store->RegisterOverlayPref(
+ prefs::kWebKitJavascriptCanOpenWindowsAutomatically,
+ prefs::kWebKitGlobalJavascriptCanOpenWindowsAutomatically);
+ pref_store->RegisterOverlayPref(
+ prefs::kWebKitLoadsImagesAutomatically,
+ prefs::kWebKitGlobalLoadsImagesAutomatically);
+ pref_store->RegisterOverlayPref(
+ prefs::kWebKitPluginsEnabled,
+ prefs::kWebKitGlobalPluginsEnabled);
+ pref_store->RegisterOverlayPref(
+ prefs::kDefaultCharset,
+ prefs::kGlobalDefaultCharset);
+ pref_store->RegisterOverlayPref(
+ prefs::kWebKitStandardFontFamily,
+ prefs::kWebKitGlobalStandardFontFamily);
+ pref_store->RegisterOverlayPref(
+ prefs::kWebKitFixedFontFamily,
+ prefs::kWebKitGlobalFixedFontFamily);
+ pref_store->RegisterOverlayPref(
+ prefs::kWebKitSerifFontFamily,
+ prefs::kWebKitGlobalSerifFontFamily);
+ pref_store->RegisterOverlayPref(
+ prefs::kWebKitSansSerifFontFamily,
+ prefs::kWebKitGlobalSansSerifFontFamily);
+ pref_store->RegisterOverlayPref(
+ prefs::kWebKitCursiveFontFamily,
+ prefs::kWebKitGlobalCursiveFontFamily);
+ pref_store->RegisterOverlayPref(
+ prefs::kWebKitFantasyFontFamily,
+ prefs::kWebKitGlobalFantasyFontFamily);
+ pref_store->RegisterOverlayPref(
+ prefs::kWebKitDefaultFontSize,
+ prefs::kWebKitGlobalDefaultFontSize);
+ pref_store->RegisterOverlayPref(
+ prefs::kWebKitDefaultFixedFontSize,
+ prefs::kWebKitGlobalDefaultFixedFontSize);
+ pref_store->RegisterOverlayPref(
+ prefs::kWebKitMinimumFontSize,
+ prefs::kWebKitGlobalMinimumFontSize);
+ pref_store->RegisterOverlayPref(
+ prefs::kWebKitMinimumLogicalFontSize,
+ prefs::kWebKitGlobalMinimumLogicalFontSize);
+}
+
} // namespace
// static
@@ -180,8 +240,9 @@ PrefService* PrefService::CreatePrefService(const FilePath& pref_filename,
PrefService* PrefService::CreateIncognitoPrefService(
PrefStore* incognito_extension_prefs) {
PrefNotifierImpl* pref_notifier = new PrefNotifierImpl();
- PersistentPrefStore* incognito_pref_store =
- new IncognitoUserPrefStore(user_pref_store_.get());
+ OverlayUserPrefStore* incognito_pref_store =
+ new OverlayUserPrefStore(user_pref_store_.get());
+ InitIncognitoUserPrefStore(incognito_pref_store);
return new PrefService(
pref_notifier,
pref_value_store_->CloneAndSpecialize(
@@ -203,8 +264,9 @@ PrefService* PrefService::CreateIncognitoPrefService(
PrefService* PrefService::CreatePrefServiceWithPerTabPrefStore() {
PrefNotifierImpl* pref_notifier = new PrefNotifierImpl();
- PersistentPrefStore* per_tab_pref_store =
- new PerTabUserPrefStore(user_pref_store_.get());
+ OverlayUserPrefStore* per_tab_pref_store =
+ new OverlayUserPrefStore(user_pref_store_.get());
+ InitPerTabUserPrefStore(per_tab_pref_store);
DefaultPrefStore* default_store = new DefaultPrefStore();
return new PrefService(
pref_notifier,
« no previous file with comments | « chrome/browser/prefs/per_tab_user_pref_store.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698