OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/browser_main_loop.h" | 5 #include "content/browser/browser_main_loop.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 | 112 |
113 #if defined(OS_LINUX) && defined(USE_UDEV) | 113 #if defined(OS_LINUX) && defined(USE_UDEV) |
114 #include "content/browser/device_monitor_udev.h" | 114 #include "content/browser/device_monitor_udev.h" |
115 #elif defined(OS_MACOSX) && !defined(OS_IOS) | 115 #elif defined(OS_MACOSX) && !defined(OS_IOS) |
116 #include "content/browser/device_monitor_mac.h" | 116 #include "content/browser/device_monitor_mac.h" |
117 #endif | 117 #endif |
118 | 118 |
119 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 119 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
120 #include "content/browser/renderer_host/render_sandbox_host_linux.h" | 120 #include "content/browser/renderer_host/render_sandbox_host_linux.h" |
121 #include "content/browser/zygote_host/zygote_host_impl_linux.h" | 121 #include "content/browser/zygote_host/zygote_host_impl_linux.h" |
122 #include "sandbox/linux/suid/client/setuid_sandbox_client.h" | 122 #include "sandbox/linux/suid/client/setuid_sandbox_host.h" |
123 #endif | 123 #endif |
124 | 124 |
125 #if defined(ENABLE_PLUGINS) | 125 #if defined(ENABLE_PLUGINS) |
126 #include "content/browser/plugin_service_impl.h" | 126 #include "content/browser/plugin_service_impl.h" |
127 #endif | 127 #endif |
128 | 128 |
129 #if defined(TCMALLOC_TRACE_MEMORY_SUPPORTED) | 129 #if defined(TCMALLOC_TRACE_MEMORY_SUPPORTED) |
130 #include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h" | 130 #include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h" |
131 #endif | 131 #endif |
132 | 132 |
133 #if defined(USE_X11) | 133 #if defined(USE_X11) |
134 #include "ui/gfx/x/x11_connection.h" | 134 #include "ui/gfx/x/x11_connection.h" |
135 #include "ui/gfx/x/x11_types.h" | 135 #include "ui/gfx/x/x11_types.h" |
136 #endif | 136 #endif |
137 | 137 |
138 // One of the linux specific headers defines this as a macro. | 138 // One of the linux specific headers defines this as a macro. |
139 #ifdef DestroyAll | 139 #ifdef DestroyAll |
140 #undef DestroyAll | 140 #undef DestroyAll |
141 #endif | 141 #endif |
142 | 142 |
143 namespace content { | 143 namespace content { |
144 namespace { | 144 namespace { |
145 | 145 |
146 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) | 146 #if defined(OS_POSIX) && !defined(OS_MACOSX) && !defined(OS_ANDROID) |
147 void SetupSandbox(const base::CommandLine& parsed_command_line) { | 147 void SetupSandbox(const base::CommandLine& parsed_command_line) { |
148 TRACE_EVENT0("startup", "SetupSandbox"); | 148 TRACE_EVENT0("startup", "SetupSandbox"); |
149 base::FilePath sandbox_binary; | 149 base::FilePath sandbox_binary; |
150 | 150 |
151 scoped_ptr<sandbox::SetuidSandboxClient> setuid_sandbox_client( | 151 scoped_ptr<sandbox::SetuidSandboxHost> setuid_sandbox_host( |
152 sandbox::SetuidSandboxClient::Create()); | 152 sandbox::SetuidSandboxHost::Create()); |
153 | 153 |
154 const bool want_setuid_sandbox = | 154 const bool want_setuid_sandbox = |
155 !parsed_command_line.HasSwitch(switches::kNoSandbox) && | 155 !parsed_command_line.HasSwitch(switches::kNoSandbox) && |
156 !parsed_command_line.HasSwitch(switches::kDisableSetuidSandbox) && | 156 !parsed_command_line.HasSwitch(switches::kDisableSetuidSandbox) && |
157 !setuid_sandbox_client->IsDisabledViaEnvironment(); | 157 !setuid_sandbox_host->IsDisabledViaEnvironment(); |
158 | 158 |
159 static const char no_suid_error[] = | 159 static const char no_suid_error[] = |
160 "Running without the SUID sandbox! See " | 160 "Running without the SUID sandbox! See " |
161 "https://code.google.com/p/chromium/wiki/LinuxSUIDSandboxDevelopment " | 161 "https://code.google.com/p/chromium/wiki/LinuxSUIDSandboxDevelopment " |
162 "for more information on developing with the sandbox on."; | 162 "for more information on developing with the sandbox on."; |
163 if (want_setuid_sandbox) { | 163 if (want_setuid_sandbox) { |
164 sandbox_binary = setuid_sandbox_client->GetSandboxBinaryPath(); | 164 sandbox_binary = setuid_sandbox_host->GetSandboxBinaryPath(); |
165 if (sandbox_binary.empty()) { | 165 if (sandbox_binary.empty()) { |
166 // This needs to be fatal. Talk to security@chromium.org if you feel | 166 // This needs to be fatal. Talk to security@chromium.org if you feel |
167 // otherwise. | 167 // otherwise. |
168 LOG(FATAL) << no_suid_error; | 168 LOG(FATAL) << no_suid_error; |
169 } | 169 } |
170 } else { | 170 } else { |
171 LOG(ERROR) << no_suid_error; | 171 LOG(ERROR) << no_suid_error; |
172 } | 172 } |
173 | 173 |
174 // Tickle the sandbox host and zygote host so they fork now. | 174 // Tickle the sandbox host and zygote host so they fork now. |
(...skipping 1096 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1271 | 1271 |
1272 void BrowserMainLoop::EndStartupTracing() { | 1272 void BrowserMainLoop::EndStartupTracing() { |
1273 is_tracing_startup_ = false; | 1273 is_tracing_startup_ = false; |
1274 TracingController::GetInstance()->DisableRecording( | 1274 TracingController::GetInstance()->DisableRecording( |
1275 TracingController::CreateFileSink( | 1275 TracingController::CreateFileSink( |
1276 startup_trace_file_, | 1276 startup_trace_file_, |
1277 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); | 1277 base::Bind(OnStoppedStartupTracing, startup_trace_file_))); |
1278 } | 1278 } |
1279 | 1279 |
1280 } // namespace content | 1280 } // namespace content |
OLD | NEW |