From 3cef0dd98c783729cea3ec58b0795eb4f24e4f03 Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Mon, 1 Apr 2013 20:10:00 -0400 Subject: [PATCH] Allow embedders to provide their own BrowserContext implementation --- brightray/browser/browser_main_parts.cc | 6 +++++- brightray/browser/browser_main_parts.h | 4 ++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/brightray/browser/browser_main_parts.cc b/brightray/browser/browser_main_parts.cc index fcfb82af6d..cb58d93be3 100644 --- a/brightray/browser/browser_main_parts.cc +++ b/brightray/browser/browser_main_parts.cc @@ -21,7 +21,7 @@ BrowserMainParts::~BrowserMainParts() { } void BrowserMainParts::PreMainMessageLoopRun() { - browser_context_.reset(new BrowserContext); + browser_context_.reset(CreateBrowserContext()); // These two objects are owned by devtools_http_handler_. auto delegate = new DevToolsDelegate; @@ -30,4 +30,8 @@ void BrowserMainParts::PreMainMessageLoopRun() { devtools_http_handler_ = content::DevToolsHttpHandler::Start(factory, std::string(), delegate); } +BrowserContext* BrowserMainParts::CreateBrowserContext() { + return new BrowserContext; +} + } diff --git a/brightray/browser/browser_main_parts.h b/brightray/browser/browser_main_parts.h index 0268dc0402..7120c619b0 100644 --- a/brightray/browser/browser_main_parts.h +++ b/brightray/browser/browser_main_parts.h @@ -26,6 +26,10 @@ public: content::DevToolsHttpHandler* devtools_http_handler() { return devtools_http_handler_; } protected: + // Subclasses should override this to provide their own BrowserContxt implementation. The caller + // takes ownership of the returned object. + virtual BrowserContext* CreateBrowserContext(); + #if defined(OS_MACOSX) virtual void PreMainMessageLoopStart() OVERRIDE; #endif