Make overriding BrowserContext::RegisterPrefs actually work

We were calling it before derived classes' vtables were set up. Now we wait to
call it until the BrowserContext is fully constructed.
This commit is contained in:
Adam Roben 2013-08-15 16:07:14 -04:00
parent 1161da6527
commit 710d0fc6c5
3 changed files with 6 additions and 0 deletions

View file

@ -48,6 +48,9 @@ private:
};
BrowserContext::BrowserContext() : resource_context_(new ResourceContext) {
}
void BrowserContext::Initialize() {
auto prefs_path = GetPath().Append(FILE_PATH_LITERAL("Preferences"));
PrefServiceBuilder builder;
builder.WithUserFilePrefs(prefs_path,

View file

@ -22,6 +22,8 @@ public:
BrowserContext();
~BrowserContext();
void Initialize();
net::URLRequestContextGetter* CreateRequestContext(content::ProtocolHandlerMap*);
PrefService* prefs() { return prefs_.get(); }

View file

@ -22,6 +22,7 @@ BrowserMainParts::~BrowserMainParts() {
void BrowserMainParts::PreMainMessageLoopRun() {
browser_context_.reset(CreateBrowserContext());
browser_context_->Initialize();
// These two objects are owned by devtools_http_handler_.
auto delegate = new DevToolsDelegate;