mirror of
https://github.com/electron/electron.git
synced 2026-01-28 08:48:14 -05:00
Fix RegisterPrefs not working in subclass.
Don't call virtual function in subclass's constructor.
This commit is contained in:
@@ -88,6 +88,7 @@ scoped_refptr<BrowserContext> 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,
|
||||
|
||||
@@ -62,6 +62,7 @@ class BrowserContext : public base::RefCounted<BrowserContext>,
|
||||
return url_request_getter_.get();
|
||||
}
|
||||
|
||||
void InitPrefs();
|
||||
PrefService* prefs() { return prefs_.get(); }
|
||||
|
||||
protected:
|
||||
|
||||
Reference in New Issue
Block a user