1// Copyright 2014 The Chromium Authors. All rights reserved. 2// Use of this source code is governed by a BSD-style license that can be 3// found in the LICENSE file. 4 5#ifndef CHROMECAST_SHELL_APP_CAST_MAIN_DELEGATE_H_ 6#define CHROMECAST_SHELL_APP_CAST_MAIN_DELEGATE_H_ 7 8#include "base/macros.h" 9#include "base/memory/scoped_ptr.h" 10#include "chromecast/shell/common/cast_content_client.h" 11#include "content/public/app/content_main_delegate.h" 12 13namespace content { 14class BrowserMainRunner; 15} // namespace content 16 17namespace chromecast { 18 19class CastResourceDelegate; 20 21namespace shell { 22 23class CastContentBrowserClient; 24class CastContentRendererClient; 25 26class CastMainDelegate : public content::ContentMainDelegate { 27 public: 28 CastMainDelegate(); 29 virtual ~CastMainDelegate(); 30 31 // content::ContentMainDelegate implementation: 32 virtual bool BasicStartupComplete(int* exit_code) OVERRIDE; 33 virtual void PreSandboxStartup() OVERRIDE; 34 virtual int RunProcess( 35 const std::string& process_type, 36 const content::MainFunctionParams& main_function_params) OVERRIDE; 37#if !defined(OS_ANDROID) 38 virtual void ZygoteForked() OVERRIDE; 39#endif // !defined(OS_ANDROID) 40 virtual content::ContentBrowserClient* CreateContentBrowserClient() OVERRIDE; 41 virtual content::ContentRendererClient* 42 CreateContentRendererClient() OVERRIDE; 43 44 private: 45 void InitializeResourceBundle(); 46 47 scoped_ptr<CastContentBrowserClient> browser_client_; 48 scoped_ptr<CastContentRendererClient> renderer_client_; 49 scoped_ptr<CastResourceDelegate> resource_delegate_; 50 CastContentClient content_client_; 51 52#if defined(OS_ANDROID) 53 scoped_ptr<content::BrowserMainRunner> browser_runner_; 54#endif // defined(OS_ANDROID) 55 56 DISALLOW_COPY_AND_ASSIGN(CastMainDelegate); 57}; 58 59} // namespace shell 60} // namespace chromecast 61 62#endif // CHROMECAST_SHELL_APP_CAST_MAIN_DELEGATE_H_ 63