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

Unified Diff: chrome/browser/profiles/profile_impl.cc

Issue 2860683002: WIP: Pref service: use the incognito support from Chrome
Patch Set: Rebase Created 3 years, 8 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
« no previous file with comments | « chrome/browser/profiles/profile_impl.h ('k') | components/prefs/pref_value_store.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/profiles/profile_impl.cc
diff --git a/chrome/browser/profiles/profile_impl.cc b/chrome/browser/profiles/profile_impl.cc
index a3bcd2e1527a70942a00605cf7cfd6a5af998c0f..0a7d555dc8bb9a82612e7cf24b2117a11b69656f 100644
--- a/chrome/browser/profiles/profile_impl.cc
+++ b/chrome/browser/profiles/profile_impl.cc
@@ -106,6 +106,7 @@
#include "components/signin/core/common/signin_pref_names.h"
#include "components/ssl_config/ssl_config_service_manager.h"
#include "components/sync_preferences/pref_service_syncable.h"
+#include "components/sync_preferences/pref_service_syncable_factory.h"
#include "components/url_formatter/url_fixer.h"
#include "components/user_prefs/user_prefs.h"
#include "components/zoom/zoom_event_manager.h"
@@ -503,11 +504,12 @@ ProfileImpl::ProfileImpl(
if (features::PrefServiceEnabled()) {
connector = content::BrowserContext::GetConnectorFor(this);
}
- prefs_ = chrome_prefs::CreateProfilePrefs(
+ prefs_factory_ = chrome_prefs::CreateProfilePrefs(
path_, std::move(pref_validation_delegate),
profile_policy_connector_->policy_service(), supervised_user_settings,
CreateExtensionPrefStore(this, false), pref_registry_, async_prefs,
connector);
+ prefs_ = prefs_factory_->CreateSyncable(pref_registry_.get(), connector);
// Register on BrowserContext.
user_prefs::UserPrefs::Set(this, prefs_.get());
}
@@ -967,17 +969,40 @@ ChromeZoomLevelPrefs* ProfileImpl::GetZoomLevelPrefs() {
GetDefaultStoragePartition(this)->GetZoomLevelDelegate());
}
-PrefService* ProfileImpl::GetOffTheRecordPrefs() {
+sync_preferences::PrefServiceSyncable* ProfileImpl::CreateOffTheRecordPrefs(
+ service_manager::Connector* otr_connector) {
DCHECK(prefs_);
if (!otr_prefs_) {
+ service_manager::Connector* user_connector = nullptr;
+ if (otr_connector) {
+ user_connector = content::BrowserContext::GetConnectorFor(this);
+ }
+ // 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::kMediaRouterTabMirroringSources);
+ overlay_pref_names.push_back(prefs::kSaveFileDefaultDirectory);
+#if defined(OS_ANDROID)
+ overlay_pref_names.push_back(proxy_config::prefs::kProxy);
+#endif
+
// The new ExtensionPrefStore is ref_counted and the new PrefService
// stores a reference so that we do not leak memory here.
- otr_prefs_.reset(CreateIncognitoPrefServiceSyncable(
- prefs_.get(), CreateExtensionPrefStore(this, true)));
+ otr_prefs_ = prefs_factory_->CreateIncognitoSyncable(
+ pref_registry_.get(), CreateExtensionPrefStore(this, true),
+ overlay_pref_names, chrome::InProcessIncognitoPrefStores(),
+ otr_connector, user_connector);
}
return otr_prefs_.get();
}
+PrefService* ProfileImpl::GetOffTheRecordPrefs() {
+ return GetOffTheRecordProfile()->GetPrefs();
+}
+
content::ResourceContext* ProfileImpl::GetResourceContext() {
return io_data_.GetResourceContext();
}
« no previous file with comments | « chrome/browser/profiles/profile_impl.h ('k') | components/prefs/pref_value_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698