blob: 6305501969ffe1adcdc5942970943afdc3abc5fe [file] [log] [blame]
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include <stddef.h>
#include "base/callback_forward.h"
#include "build/build_config.h"
#include "content/common/content_export.h"
#if defined(OS_WIN)
#include <windows.h>
#if defined(USE_AURA)
#include "ui/aura/env.h"
namespace base {
namespace mac {
class ScopedNSAutoreleasePool;
namespace sandbox {
struct SandboxInterfaceInfo;
namespace content {
class ContentMainDelegate;
struct ContentMainParams {
explicit ContentMainParams(ContentMainDelegate* delegate)
: delegate(delegate) {}
ContentMainDelegate* delegate;
#if defined(OS_WIN)
HINSTANCE instance = nullptr;
// |sandbox_info| should be initialized using InitializeSandboxInfo from
// content_main_win.h
sandbox::SandboxInterfaceInfo* sandbox_info = nullptr;
#elif !defined(OS_ANDROID)
int argc = 0;
const char** argv = nullptr;
// Used by browser_tests. If non-null BrowserMain schedules this task to run
// on the MessageLoop. It's owned by the test code.
base::Closure* ui_task = nullptr;
#if defined(USE_AURA)
aura::Env::Mode env_mode = aura::Env::Mode::LOCAL;
#if defined(OS_MACOSX)
// The outermost autorelease pool to pass to main entry points.
base::mac::ScopedNSAutoreleasePool* autorelease_pool = nullptr;
#if defined(OS_ANDROID)
// In the Android, the content main starts from, This function
// provides a way to set the |delegate| as ContentMainDelegate for
// ContentMainRunner.
// This should only be called once before ContentMainRunner actually running.
// The ownership of |delegate| is transferred.
CONTENT_EXPORT void SetContentMainDelegate(ContentMainDelegate* delegate);
// ContentMain should be called from the embedder's main() function to do the
// initial setup for every process. The embedder has a chance to customize
// startup using the ContentMainDelegate interface. The embedder can also pass
// in NULL for |delegate| if they don't want to override default startup.
CONTENT_EXPORT int ContentMain(const ContentMainParams& params);
} // namespace content