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

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

Issue 1332283003: Remove dependency of PrefSyncableService on PrefsTabHelper. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pref_service_syncable_util
Patch Set: Pass a list of preferences instead of a callback Created 5 years, 3 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: chrome/browser/prefs/pref_service_syncable_util.cc
diff --git a/chrome/browser/prefs/pref_service_syncable_util.cc b/chrome/browser/prefs/pref_service_syncable_util.cc
index e3b099cbc1bd585ba8046f26c1960cf232f68cc1..5871af23beff0744695585b8cfbd994e1f8ae6b2 100644
--- a/chrome/browser/prefs/pref_service_syncable_util.cc
+++ b/chrome/browser/prefs/pref_service_syncable_util.cc
@@ -4,8 +4,17 @@
#include "chrome/browser/prefs/pref_service_syncable_util.h"
+#include <vector>
+
+#include "base/logging.h"
+#include "build/build_config.h"
#include "chrome/browser/prefs/pref_service_syncable.h"
#include "chrome/browser/profiles/profile.h"
+#include "chrome/common/pref_names.h"
+
+#if defined(OS_ANDROID) || defined(OS_IOS)
+#include "components/proxy_config/proxy_config_pref_names.h"
+#endif
PrefServiceSyncable* PrefServiceSyncableFromProfile(Profile* profile) {
return static_cast<PrefServiceSyncable*>(profile->GetPrefs());
@@ -14,3 +23,19 @@ PrefServiceSyncable* PrefServiceSyncableFromProfile(Profile* profile) {
PrefServiceSyncable* PrefServiceSyncableIncognitoFromProfile(Profile* profile) {
return static_cast<PrefServiceSyncable*>(profile->GetOffTheRecordPrefs());
}
+
+PrefServiceSyncable* CreateIncognitoPrefServiceSyncable(
+ PrefServiceSyncable* pref_service,
+ PrefStore* incognito_extension_prefs) {
+ // 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.
+ std::vector<const char*> overlay_pref_names;
+ overlay_pref_names.push_back(prefs::kBrowserWindowPlacement);
+ overlay_pref_names.push_back(prefs::kSaveFileDefaultDirectory);
+#if defined(OS_ANDROID) || defined(OS_IOS)
+ overlay_pref_names.push_back(proxy_config::prefs::kProxy);
+#endif
+ return pref_service->CreateIncognitoPrefService(incognito_extension_prefs,
+ overlay_pref_names);
+}

Powered by Google App Engine
This is Rietveld 408576698