2014-10-31 11:17:05 -07:00
|
|
|
// Copyright (c) 2013 GitHub, Inc.
|
2014-04-25 17:49:37 +08:00
|
|
|
// Use of this source code is governed by the MIT license that can be
|
2013-04-12 09:46:58 +08:00
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2021-11-22 08:34:31 +01:00
|
|
|
#ifndef ELECTRON_SHELL_APP_ELECTRON_MAIN_DELEGATE_H_
|
|
|
|
#define ELECTRON_SHELL_APP_ELECTRON_MAIN_DELEGATE_H_
|
2013-04-12 09:46:58 +08:00
|
|
|
|
2018-09-12 19:25:56 -05:00
|
|
|
#include <memory>
|
2016-06-01 18:22:14 +09:00
|
|
|
#include <string>
|
|
|
|
|
2018-10-23 14:16:13 +02:00
|
|
|
#include "content/public/app/content_main_delegate.h"
|
2018-10-22 19:04:23 +02:00
|
|
|
#include "content/public/common/content_client.h"
|
2013-04-12 09:46:58 +08:00
|
|
|
|
2019-11-21 18:05:41 -08:00
|
|
|
namespace tracing {
|
|
|
|
class TracingSamplerProfiler;
|
|
|
|
}
|
|
|
|
|
2019-06-19 14:23:04 -07:00
|
|
|
namespace electron {
|
2013-04-12 09:46:58 +08:00
|
|
|
|
2020-10-29 01:18:47 +09:00
|
|
|
std::string LoadResourceBundle(const std::string& locale);
|
2018-10-23 14:16:13 +02:00
|
|
|
|
2020-02-04 12:19:40 -08:00
|
|
|
class ElectronMainDelegate : public content::ContentMainDelegate {
|
2013-04-12 23:16:16 +08:00
|
|
|
public:
|
2020-01-13 14:55:58 -08:00
|
|
|
static const char* const kNonWildcardDomainNonPortSchemes[];
|
|
|
|
static const size_t kNonWildcardDomainNonPortSchemesSize;
|
2020-02-04 12:19:40 -08:00
|
|
|
ElectronMainDelegate();
|
|
|
|
~ElectronMainDelegate() override;
|
2013-04-12 09:46:58 +08:00
|
|
|
|
2021-11-03 12:41:45 +01:00
|
|
|
// disable copy
|
|
|
|
ElectronMainDelegate(const ElectronMainDelegate&) = delete;
|
|
|
|
ElectronMainDelegate& operator=(const ElectronMainDelegate&) = delete;
|
|
|
|
|
2013-04-20 14:03:55 +08:00
|
|
|
protected:
|
2014-07-16 15:05:02 +08:00
|
|
|
// content::ContentMainDelegate:
|
2014-11-21 16:40:47 +08:00
|
|
|
bool BasicStartupComplete(int* exit_code) override;
|
|
|
|
void PreSandboxStartup() override;
|
2021-06-17 16:17:25 -05:00
|
|
|
void SandboxInitialized(const std::string& process_type) override;
|
2021-05-19 16:15:47 -07:00
|
|
|
void PreBrowserMain() override;
|
2014-11-21 16:40:47 +08:00
|
|
|
content::ContentBrowserClient* CreateContentBrowserClient() override;
|
2019-04-30 18:45:48 +02:00
|
|
|
content::ContentGpuClient* CreateContentGpuClient() override;
|
2014-11-21 16:40:47 +08:00
|
|
|
content::ContentRendererClient* CreateContentRendererClient() override;
|
2015-04-30 11:31:17 +08:00
|
|
|
content::ContentUtilityClient* CreateContentUtilityClient() override;
|
2021-11-24 09:45:59 +01:00
|
|
|
absl::variant<int, content::MainFunctionParams> RunProcess(
|
2016-06-01 18:22:14 +09:00
|
|
|
const std::string& process_type,
|
2021-11-24 09:45:59 +01:00
|
|
|
content::MainFunctionParams main_function_params) override;
|
2019-01-12 06:30:43 +05:30
|
|
|
bool ShouldCreateFeatureList() override;
|
2020-03-03 13:35:05 -08:00
|
|
|
bool ShouldLockSchemeRegistry() override;
|
2022-02-09 18:58:52 -08:00
|
|
|
#if BUILDFLAG(IS_LINUX)
|
2020-05-07 13:31:26 -07:00
|
|
|
void ZygoteForked() override;
|
|
|
|
#endif
|
2013-09-12 17:51:45 +08:00
|
|
|
|
2013-04-12 23:16:16 +08:00
|
|
|
private:
|
2022-02-09 18:58:52 -08:00
|
|
|
#if BUILDFLAG(IS_MAC)
|
2018-10-23 14:16:13 +02:00
|
|
|
void OverrideChildProcessPath();
|
|
|
|
void OverrideFrameworkBundlePath();
|
2016-05-18 16:42:26 +09:00
|
|
|
void SetUpBundleOverrides();
|
|
|
|
#endif
|
|
|
|
|
2016-05-23 10:59:39 +09:00
|
|
|
std::unique_ptr<content::ContentBrowserClient> browser_client_;
|
2018-10-22 19:04:23 +02:00
|
|
|
std::unique_ptr<content::ContentClient> content_client_;
|
2019-04-30 18:45:48 +02:00
|
|
|
std::unique_ptr<content::ContentGpuClient> gpu_client_;
|
2016-05-23 10:59:39 +09:00
|
|
|
std::unique_ptr<content::ContentRendererClient> renderer_client_;
|
|
|
|
std::unique_ptr<content::ContentUtilityClient> utility_client_;
|
2019-11-21 18:05:41 -08:00
|
|
|
std::unique_ptr<tracing::TracingSamplerProfiler> tracing_sampler_profiler_;
|
2013-04-12 09:46:58 +08:00
|
|
|
};
|
|
|
|
|
2019-06-19 14:23:04 -07:00
|
|
|
} // namespace electron
|
2013-04-12 09:46:58 +08:00
|
|
|
|
2021-11-22 08:34:31 +01:00
|
|
|
#endif // ELECTRON_SHELL_APP_ELECTRON_MAIN_DELEGATE_H_
|