2012-04-03 03:34:16 +02:00
|
|
|
// Copyright (c) 2011 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.
|
|
|
|
|
|
|
|
#ifndef CEF_LIBCEF_COMMON_MAIN_DELEGATE_H_
|
|
|
|
#define CEF_LIBCEF_COMMON_MAIN_DELEGATE_H_
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include "include/cef_app.h"
|
2017-05-17 11:29:28 +02:00
|
|
|
#include "libcef/common/content_client.h"
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
#include "base/compiler_specific.h"
|
|
|
|
#include "content/public/app/content_main_delegate.h"
|
|
|
|
|
2012-04-11 20:00:55 +02:00
|
|
|
namespace base {
|
2016-10-17 20:14:44 +02:00
|
|
|
class CommandLine;
|
2018-09-06 14:40:36 +02:00
|
|
|
class MessageLoop;
|
2012-04-11 20:00:55 +02:00
|
|
|
class Thread;
|
2017-12-07 22:44:24 +01:00
|
|
|
} // namespace base
|
2012-04-11 20:00:55 +02:00
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
namespace content {
|
|
|
|
class BrowserMainRunner;
|
|
|
|
}
|
|
|
|
|
|
|
|
class CefContentBrowserClient;
|
|
|
|
class CefContentRendererClient;
|
|
|
|
class CefContentUtilityClient;
|
2019-03-13 22:27:37 +01:00
|
|
|
class CefUIThread;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
class CefMainDelegate : public content::ContentMainDelegate {
|
|
|
|
public:
|
|
|
|
explicit CefMainDelegate(CefRefPtr<CefApp> application);
|
2014-11-12 20:25:15 +01:00
|
|
|
~CefMainDelegate() override;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2018-09-06 14:40:36 +02:00
|
|
|
void PreCreateMainMessageLoop() override;
|
2014-11-12 20:25:15 +01:00
|
|
|
bool BasicStartupComplete(int* exit_code) override;
|
|
|
|
void PreSandboxStartup() override;
|
2015-07-16 23:40:01 +02:00
|
|
|
void SandboxInitialized(const std::string& process_type) override;
|
2014-11-12 20:25:15 +01:00
|
|
|
int RunProcess(
|
2012-04-03 03:34:16 +02:00
|
|
|
const std::string& process_type,
|
2014-11-12 20:25:15 +01:00
|
|
|
const content::MainFunctionParams& main_function_params) override;
|
|
|
|
void ProcessExiting(const std::string& process_type) override;
|
2017-12-07 22:44:24 +01:00
|
|
|
#if defined(OS_LINUX)
|
2014-11-12 20:25:15 +01:00
|
|
|
void ZygoteForked() override;
|
2013-11-21 23:43:36 +01:00
|
|
|
#endif
|
2014-11-12 20:25:15 +01:00
|
|
|
content::ContentBrowserClient* CreateContentBrowserClient() override;
|
2017-05-17 11:29:28 +02:00
|
|
|
content::ContentRendererClient* CreateContentRendererClient() override;
|
2014-11-12 20:25:15 +01:00
|
|
|
content::ContentUtilityClient* CreateContentUtilityClient() override;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2019-03-13 22:27:37 +01:00
|
|
|
bool CreateUIThread(base::OnceClosure setup_callback);
|
2019-01-09 01:50:55 +01:00
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
// Shut down the browser runner.
|
|
|
|
void ShutdownBrowser();
|
|
|
|
|
|
|
|
CefContentBrowserClient* browser_client() { return browser_client_.get(); }
|
|
|
|
CefContentClient* content_client() { return &content_client_; }
|
|
|
|
|
|
|
|
private:
|
|
|
|
void InitializeResourceBundle();
|
|
|
|
|
2016-04-27 22:38:52 +02:00
|
|
|
std::unique_ptr<content::BrowserMainRunner> browser_runner_;
|
2019-03-13 22:27:37 +01:00
|
|
|
std::unique_ptr<CefUIThread> ui_thread_;
|
2012-04-11 20:00:55 +02:00
|
|
|
|
2016-04-27 22:38:52 +02:00
|
|
|
std::unique_ptr<CefContentBrowserClient> browser_client_;
|
|
|
|
std::unique_ptr<CefContentRendererClient> renderer_client_;
|
|
|
|
std::unique_ptr<CefContentUtilityClient> utility_client_;
|
2012-04-03 03:34:16 +02:00
|
|
|
CefContentClient content_client_;
|
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(CefMainDelegate);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CEF_LIBCEF_COMMON_MAIN_DELEGATE_H_
|