diff options
author | sdefresne <sdefresne@chromium.org> | 2015-09-14 11:12:12 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-09-14 18:12:47 +0000 |
commit | 0b1722f004e4424b18585a29234408b7112815cf (patch) | |
tree | 89a425ecdb7cc66d3c6cfd782d3d93b8245ceaaf /chrome/browser/prefs/pref_service_syncable_util.cc | |
parent | d12a62df87f73b6ee73c0a0169c9f2716dd4ee17 (diff) | |
download | chromium_src-0b1722f004e4424b18585a29234408b7112815cf.zip chromium_src-0b1722f004e4424b18585a29234408b7112815cf.tar.gz chromium_src-0b1722f004e4424b18585a29234408b7112815cf.tar.bz2 |
Remove dependency of PrefSyncableService on PrefsTabHelper.
In preparation of the componentization of PrefSyncableService (with the
goal of sharing the code on iOS), remove the dependency on PrefsTabHelper
by passing a list of preferences to register as overlaid.
Add a helper method in chrome/browser/prefspref_service_syncable_util.cc
to pass the list of preferences previously registered in PrefsTabHelper.
Remove the method PrefsTabHelper::InitIncognitoUserPrefStore().
BUG=522536
TBR=jochen@chromium.org
Review URL: https://codereview.chromium.org/1332283003
Cr-Commit-Position: refs/heads/master@{#348656}
Diffstat (limited to 'chrome/browser/prefs/pref_service_syncable_util.cc')
-rw-r--r-- | chrome/browser/prefs/pref_service_syncable_util.cc | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/chrome/browser/prefs/pref_service_syncable_util.cc b/chrome/browser/prefs/pref_service_syncable_util.cc index e3b099c..eac0df9 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_pref_store) { + // 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_pref_store, overlay_pref_names); +} |