OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/shell/browser/shell_content_browser_client.h" | 5 #include "extensions/shell/browser/shell_content_browser_client.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "components/guest_view/browser/guest_view_message_filter.h" | 8 #include "components/guest_view/browser/guest_view_message_filter.h" |
9 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
10 #include "content/public/browser/render_process_host.h" | 10 #include "content/public/browser/render_process_host.h" |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 | 205 |
206 void ShellContentBrowserClient::AppendExtraCommandLineSwitches( | 206 void ShellContentBrowserClient::AppendExtraCommandLineSwitches( |
207 base::CommandLine* command_line, | 207 base::CommandLine* command_line, |
208 int child_process_id) { | 208 int child_process_id) { |
209 std::string process_type = | 209 std::string process_type = |
210 command_line->GetSwitchValueASCII(::switches::kProcessType); | 210 command_line->GetSwitchValueASCII(::switches::kProcessType); |
211 | 211 |
212 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 212 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
213 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) | 213 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) |
214 if (process_type != ::switches::kZygoteProcess) { | 214 if (process_type != ::switches::kZygoteProcess) { |
215 command_line->AppendSwitch(::switches::kV8NativesPassedByFD); | 215 if (v8_natives_fd_.get() != -1) { |
216 command_line->AppendSwitch(::switches::kV8SnapshotPassedByFD); | 216 command_line->AppendSwitch(::switches::kV8NativesPassedByFD); |
| 217 } |
| 218 if (v8_snapshot_fd_.get() != -1) { |
| 219 command_line->AppendSwitch(::switches::kV8SnapshotPassedByFD); |
| 220 } |
217 } | 221 } |
218 #endif // V8_USE_EXTERNAL_STARTUP_DATA | 222 #endif // V8_USE_EXTERNAL_STARTUP_DATA |
219 #endif // OS_POSIX && !OS_MACOSX | 223 #endif // OS_POSIX && !OS_MACOSX |
220 | 224 |
221 if (process_type == ::switches::kRendererProcess) | 225 if (process_type == ::switches::kRendererProcess) |
222 AppendRendererSwitches(command_line); | 226 AppendRendererSwitches(command_line); |
223 } | 227 } |
224 | 228 |
225 content::SpeechRecognitionManagerDelegate* | 229 content::SpeechRecognitionManagerDelegate* |
226 ShellContentBrowserClient::CreateSpeechRecognitionManagerDelegate() { | 230 ShellContentBrowserClient::CreateSpeechRecognitionManagerDelegate() { |
(...skipping 24 matching lines...) Expand all Loading... |
251 additional_allowed_schemes); | 255 additional_allowed_schemes); |
252 additional_allowed_schemes->push_back(kExtensionScheme); | 256 additional_allowed_schemes->push_back(kExtensionScheme); |
253 } | 257 } |
254 | 258 |
255 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 259 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
256 void ShellContentBrowserClient::GetAdditionalMappedFilesForChildProcess( | 260 void ShellContentBrowserClient::GetAdditionalMappedFilesForChildProcess( |
257 const base::CommandLine& command_line, | 261 const base::CommandLine& command_line, |
258 int child_process_id, | 262 int child_process_id, |
259 content::FileDescriptorInfo* mappings) { | 263 content::FileDescriptorInfo* mappings) { |
260 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) | 264 #if defined(V8_USE_EXTERNAL_STARTUP_DATA) |
261 if (v8_natives_fd_.get() == -1 || v8_snapshot_fd_.get() == -1) { | 265 if (v8_natives_fd_.get() == -1) { |
262 int v8_natives_fd = -1; | 266 int v8_natives_fd = -1; |
263 int v8_snapshot_fd = -1; | 267 int v8_snapshot_fd = -1; |
264 if (gin::V8Initializer::OpenV8FilesForChildProcesses(&v8_natives_fd, | 268 if (gin::V8Initializer::OpenV8FilesForChildProcesses(&v8_natives_fd, |
265 &v8_snapshot_fd)) { | 269 &v8_snapshot_fd)) { |
266 v8_natives_fd_.reset(v8_natives_fd); | 270 v8_natives_fd_.reset(v8_natives_fd); |
267 v8_snapshot_fd_.reset(v8_snapshot_fd); | 271 v8_snapshot_fd_.reset(v8_snapshot_fd); |
268 } | 272 } |
269 } | 273 } |
270 DCHECK(v8_natives_fd_.get() != -1 && v8_snapshot_fd_.get() != -1); | 274 DCHECK(v8_natives_fd_.get() != -1); |
271 mappings->Share(kV8NativesDataDescriptor, v8_natives_fd_.get()); | 275 mappings->Share(kV8NativesDataDescriptor, v8_natives_fd_.get()); |
272 mappings->Share(kV8SnapshotDataDescriptor, v8_snapshot_fd_.get()); | 276 mappings->Share(kV8SnapshotDataDescriptor, v8_snapshot_fd_.get()); |
273 #endif // V8_USE_EXTERNAL_STARTUP_DATA | 277 #endif // V8_USE_EXTERNAL_STARTUP_DATA |
274 } | 278 } |
275 #endif // OS_POSIX && !OS_MACOSX | 279 #endif // OS_POSIX && !OS_MACOSX |
276 | 280 |
277 content::DevToolsManagerDelegate* | 281 content::DevToolsManagerDelegate* |
278 ShellContentBrowserClient::GetDevToolsManagerDelegate() { | 282 ShellContentBrowserClient::GetDevToolsManagerDelegate() { |
279 return new content::ShellDevToolsManagerDelegate(GetBrowserContext()); | 283 return new content::ShellDevToolsManagerDelegate(GetBrowserContext()); |
280 } | 284 } |
(...skipping 24 matching lines...) Expand all Loading... |
305 | 309 |
306 const Extension* ShellContentBrowserClient::GetExtension( | 310 const Extension* ShellContentBrowserClient::GetExtension( |
307 content::SiteInstance* site_instance) { | 311 content::SiteInstance* site_instance) { |
308 ExtensionRegistry* registry = | 312 ExtensionRegistry* registry = |
309 ExtensionRegistry::Get(site_instance->GetBrowserContext()); | 313 ExtensionRegistry::Get(site_instance->GetBrowserContext()); |
310 return registry->enabled_extensions().GetExtensionOrAppByURL( | 314 return registry->enabled_extensions().GetExtensionOrAppByURL( |
311 site_instance->GetSiteURL()); | 315 site_instance->GetSiteURL()); |
312 } | 316 } |
313 | 317 |
314 } // namespace extensions | 318 } // namespace extensions |
OLD | NEW |