From 3b879a6178ba94eed512bff6e1ddcdb211a2951d Mon Sep 17 00:00:00 2001 From: Adam Roben Date: Wed, 24 Apr 2013 18:30:47 -0400 Subject: [PATCH] Allow embedders to provide their own ContentClient subclass --- brightray/common/main_delegate.cc | 8 ++++++-- brightray/common/main_delegate.h | 3 +++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/brightray/common/main_delegate.cc b/brightray/common/main_delegate.cc index 13ace6f6321e..7c1fa903bcb5 100644 --- a/brightray/common/main_delegate.cc +++ b/brightray/common/main_delegate.cc @@ -12,14 +12,18 @@ namespace brightray { -MainDelegate::MainDelegate() - : content_client_(new ContentClient) { +MainDelegate::MainDelegate() { } MainDelegate::~MainDelegate() { } +scoped_ptr MainDelegate::CreateContentClient() { + return make_scoped_ptr(new ContentClient).Pass(); +} + bool MainDelegate::BasicStartupComplete(int* exit_code) { + content_client_ = CreateContentClient().Pass(); SetContentClient(content_client_.get()); return false; } diff --git a/brightray/common/main_delegate.h b/brightray/common/main_delegate.h index 19d1306191c3..6037ab3eaf36 100644 --- a/brightray/common/main_delegate.h +++ b/brightray/common/main_delegate.h @@ -19,6 +19,9 @@ public: ~MainDelegate(); protected: + // Subclasses can override this to provide their own ContentClient implementation. + virtual scoped_ptr CreateContentClient(); + virtual bool BasicStartupComplete(int* exit_code) OVERRIDE; virtual void PreSandboxStartup() OVERRIDE;