content_main_runner.h revision 5821806d5e7f356e8fa4b058a389a808ea183019
1// Copyright (c) 2012 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 CONTENT_PUBLIC_APP_CONTENT_MAIN_RUNNER_H_ 6#define CONTENT_PUBLIC_APP_CONTENT_MAIN_RUNNER_H_ 7 8#include <string> 9 10#include "build/build_config.h" 11 12#if defined(OS_WIN) 13#include <windows.h> 14#endif 15 16namespace sandbox { 17struct SandboxInterfaceInfo; 18} 19 20namespace content { 21 22class ContentMainDelegate; 23 24// This class is responsible for content initialization, running and shutdown. 25class ContentMainRunner { 26 public: 27 virtual ~ContentMainRunner() {} 28 29 // Create a new ContentMainRunner object. 30 static ContentMainRunner* Create(); 31 32 // Initialize all necessary content state. 33#if defined(OS_WIN) 34 // The |sandbox_info| and |delegate| objects must outlive this class. 35 // |sandbox_info| should be initialized using InitializeSandboxInfo from 36 // content_main_win.h. 37 virtual int Initialize(HINSTANCE instance, 38 sandbox::SandboxInterfaceInfo* sandbox_info, 39 ContentMainDelegate* delegate) = 0; 40#else 41 // The |delegate| object must outlive this class. 42 virtual int Initialize(int argc, 43 const char** argv, 44 ContentMainDelegate* delegate) = 0; 45#endif 46 47 // Perform the default run logic. 48 virtual int Run() = 0; 49 50 // Shut down the content state. 51 virtual void Shutdown() = 0; 52}; 53 54} // namespace content 55 56#endif // CONTENT_PUBLIC_APP_CONTENT_MAIN_RUNNER_H_ 57