blob: fb79904b7408d7c7dc9e999b50b1490b7740543e (
plain)
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
// 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.
#include "content/shell/shell_main_delegate.h"
#include "base/command_line.h"
#include "content/public/common/content_switches.h"
#include "content/shell/shell_content_browser_client.h"
#include "content/shell/shell_content_plugin_client.h"
#include "content/shell/shell_content_renderer_client.h"
#include "content/shell/shell_content_utility_client.h"
ShellMainDelegate::ShellMainDelegate() {
}
ShellMainDelegate::~ShellMainDelegate() {
}
bool ShellMainDelegate::BasicStartupComplete(int* exit_code) {
return false;
}
void ShellMainDelegate::PreSandboxStartup() {
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
std::string process_type =
command_line.GetSwitchValueASCII(switches::kProcessType);
content::SetContentClient(&content_client_);
InitializeShellContentClient(process_type);
}
void ShellMainDelegate::SandboxInitialized(const std::string& process_type) {
}
int ShellMainDelegate::RunProcess(
const std::string& process_type,
const content::MainFunctionParams& main_function_params) {
NOTREACHED();
return -1;
}
void ShellMainDelegate::ProcessExiting(const std::string& process_type) {
}
#if defined(OS_MACOSX)
bool ShellMainDelegate::ProcessRegistersWithSystemProcess(
const std::string& process_type) {
return false;
}
bool ShellMainDelegate::ShouldSendMachPort(const std::string& process_type) {
return false;
}
bool ShellMainDelegate::DelaySandboxInitialization(
const std::string& process_type) {
return false;
}
#elif defined(OS_POSIX)
content::ZygoteForkDelegate* ShellMainDelegate::ZygoteStarting() {
return NULL;
}
void ShellMainDelegate::ZygoteForked() {
const CommandLine& command_line = *CommandLine::ForCurrentProcess();
std::string process_type =
command_line.GetSwitchValueASCII(switches::kProcessType);
InitializeShellContentClient(process_type);
}
#endif // OS_MACOSX
void ShellMainDelegate::InitializeShellContentClient(
const std::string& process_type) {
if (process_type.empty()) {
browser_client_.reset(new content::ShellContentBrowserClient);
content::GetContentClient()->set_browser(browser_client_.get());
} else if (process_type == switches::kRendererProcess) {
renderer_client_.reset(new content::ShellContentRendererClient);
content::GetContentClient()->set_renderer(renderer_client_.get());
} else if (process_type == switches::kPluginProcess) {
plugin_client_.reset(new content::ShellContentPluginClient);
content::GetContentClient()->set_plugin(plugin_client_.get());
} else if (process_type == switches::kUtilityProcess) {
utility_client_.reset(new content::ShellContentUtilityClient);
content::GetContentClient()->set_utility(utility_client_.get());
}
}
|