-
Notifications
You must be signed in to change notification settings - Fork 15k
/
electron_main_delegate.h
71 lines (57 loc) · 2.44 KB
/
electron_main_delegate.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
// Copyright (c) 2013 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ELECTRON_SHELL_APP_ELECTRON_MAIN_DELEGATE_H_
#define ELECTRON_SHELL_APP_ELECTRON_MAIN_DELEGATE_H_
#include <memory>
#include <string>
#include "content/public/app/content_main_delegate.h"
#include "content/public/common/content_client.h"
namespace tracing {
class TracingSamplerProfiler;
}
namespace electron {
std::string LoadResourceBundle(const std::string& locale);
class ElectronMainDelegate : public content::ContentMainDelegate {
public:
static const char* const kNonWildcardDomainNonPortSchemes[];
static const size_t kNonWildcardDomainNonPortSchemesSize;
ElectronMainDelegate();
~ElectronMainDelegate() override;
// disable copy
ElectronMainDelegate(const ElectronMainDelegate&) = delete;
ElectronMainDelegate& operator=(const ElectronMainDelegate&) = delete;
base::StringPiece GetBrowserV8SnapshotFilename() override;
protected:
// content::ContentMainDelegate:
absl::optional<int> BasicStartupComplete() override;
void PreSandboxStartup() override;
void SandboxInitialized(const std::string& process_type) override;
absl::optional<int> PreBrowserMain() override;
content::ContentBrowserClient* CreateContentBrowserClient() override;
content::ContentGpuClient* CreateContentGpuClient() override;
content::ContentRendererClient* CreateContentRendererClient() override;
content::ContentUtilityClient* CreateContentUtilityClient() override;
absl::variant<int, content::MainFunctionParams> RunProcess(
const std::string& process_type,
content::MainFunctionParams main_function_params) override;
bool ShouldCreateFeatureList(InvokedIn invoked_in) override;
bool ShouldLockSchemeRegistry() override;
#if BUILDFLAG(IS_LINUX)
void ZygoteForked() override;
#endif
private:
#if BUILDFLAG(IS_MAC)
void OverrideChildProcessPath();
void OverrideFrameworkBundlePath();
void SetUpBundleOverrides();
#endif
std::unique_ptr<content::ContentBrowserClient> browser_client_;
std::unique_ptr<content::ContentClient> content_client_;
std::unique_ptr<content::ContentGpuClient> gpu_client_;
std::unique_ptr<content::ContentRendererClient> renderer_client_;
std::unique_ptr<content::ContentUtilityClient> utility_client_;
std::unique_ptr<tracing::TracingSamplerProfiler> tracing_sampler_profiler_;
};
} // namespace electron
#endif // ELECTRON_SHELL_APP_ELECTRON_MAIN_DELEGATE_H_