diff --git a/brightray/browser/browser_context.cc b/brightray/browser/browser_context.cc index f5d6effdeb..a0349809f7 100644 --- a/brightray/browser/browser_context.cc +++ b/brightray/browser/browser_context.cc @@ -88,6 +88,7 @@ scoped_refptr BrowserContext::From( return make_scoped_refptr(browser_context_map_[key].get()); auto browser_context = BrowserContext::Create(partition, in_memory); + browser_context->InitPrefs(); browser_context_map_[key] = browser_context->weak_factory_.GetWeakPtr(); return browser_context; } @@ -105,7 +106,9 @@ BrowserContext::BrowserContext(const std::string& partition, bool in_memory) if (!in_memory_ && !partition.empty()) path_ = path_.Append(FILE_PATH_LITERAL("Partitions")) .Append(base::FilePath::FromUTF8Unsafe(MakePartitionName(partition))); +} +void BrowserContext::InitPrefs() { auto prefs_path = GetPath().Append(FILE_PATH_LITERAL("Preferences")); base::PrefServiceFactory prefs_factory; prefs_factory.SetUserPrefsFile(prefs_path, diff --git a/brightray/browser/browser_context.h b/brightray/browser/browser_context.h index 836d17c84b..abfa860003 100644 --- a/brightray/browser/browser_context.h +++ b/brightray/browser/browser_context.h @@ -62,6 +62,7 @@ class BrowserContext : public base::RefCounted, return url_request_getter_.get(); } + void InitPrefs(); PrefService* prefs() { return prefs_.get(); } protected: