OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 // Represents the browser side of the browser <--> renderer communication | 5 // Represents the browser side of the browser <--> renderer communication |
6 // channel. There will be one RenderProcessHost per renderer process. | 6 // channel. There will be one RenderProcessHost per renderer process. |
7 | 7 |
8 #include "content/browser/renderer_host/render_process_host_impl.h" | 8 #include "content/browser/renderer_host/render_process_host_impl.h" |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 : ipc_fd_(channel->TakeClientFileDescriptor()) | 341 : ipc_fd_(channel->TakeClientFileDescriptor()) |
342 #endif // OS_POSIX | 342 #endif // OS_POSIX |
343 {} | 343 {} |
344 | 344 |
345 ~RendererSandboxedProcessLauncherDelegate() override {} | 345 ~RendererSandboxedProcessLauncherDelegate() override {} |
346 | 346 |
347 #if defined(OS_WIN) | 347 #if defined(OS_WIN) |
348 void PreSpawnTarget(sandbox::TargetPolicy* policy, bool* success) override { | 348 void PreSpawnTarget(sandbox::TargetPolicy* policy, bool* success) override { |
349 AddBaseHandleClosePolicy(policy); | 349 AddBaseHandleClosePolicy(policy); |
350 | 350 |
351 if (base::win::GetVersion() >= base::win::VERSION_WIN8) { | 351 const base::string16& sid = |
352 const base::CommandLine& command_line = | 352 GetContentClient()->browser()->GetAppContainerSidForSandboxType( |
353 *base::CommandLine::ForCurrentProcess(); | 353 GetSandboxType()); |
354 if (!command_line.HasSwitch(switches::kDisableAppContainer)) { | 354 if (!sid.empty()) |
355 // TODO(shrikant): Check if these constants should be different across | 355 AddAppContainerPolicy(policy, sid.c_str()); |
356 // various versions of Chromium code base or could be same. | |
357 // If there should be different SID per channel then move this code | |
358 // in chrome rather than content and assign SID based on | |
359 // VersionInfo::GetChannel(). | |
360 const wchar_t kAppContainerSid[] = | |
361 L"S-1-15-2-3251537155-1984446955-2931258699-841473695-1938553385-" | |
362 L"924012148-129201922"; | |
363 | |
364 policy->SetLowBox(kAppContainerSid); | |
365 } | |
366 } | |
367 | 356 |
368 GetContentClient()->browser()->PreSpawnRenderer(policy, success); | 357 GetContentClient()->browser()->PreSpawnRenderer(policy, success); |
369 } | 358 } |
370 | 359 |
371 #elif defined(OS_POSIX) | 360 #elif defined(OS_POSIX) |
372 bool ShouldUseZygote() override { | 361 bool ShouldUseZygote() override { |
373 const base::CommandLine& browser_command_line = | 362 const base::CommandLine& browser_command_line = |
374 *base::CommandLine::ForCurrentProcess(); | 363 *base::CommandLine::ForCurrentProcess(); |
375 base::CommandLine::StringType renderer_prefix = | 364 base::CommandLine::StringType renderer_prefix = |
376 browser_command_line.GetSwitchValueNative(switches::kRendererCmdPrefix); | 365 browser_command_line.GetSwitchValueNative(switches::kRendererCmdPrefix); |
377 return renderer_prefix.empty(); | 366 return renderer_prefix.empty(); |
378 } | 367 } |
379 base::ScopedFD TakeIpcFd() override { return ipc_fd_.Pass(); } | 368 base::ScopedFD TakeIpcFd() override { return ipc_fd_.Pass(); } |
380 #endif // OS_WIN | 369 #endif // OS_WIN |
381 | 370 |
| 371 SandboxType GetSandboxType() override { |
| 372 return SANDBOX_TYPE_RENDERER; |
| 373 } |
| 374 |
382 private: | 375 private: |
383 #if defined(OS_POSIX) | 376 #if defined(OS_POSIX) |
384 base::ScopedFD ipc_fd_; | 377 base::ScopedFD ipc_fd_; |
385 #endif // OS_POSIX | 378 #endif // OS_POSIX |
386 }; | 379 }; |
387 | 380 |
388 const char kSessionStorageHolderKey[] = "kSessionStorageHolderKey"; | 381 const char kSessionStorageHolderKey[] = "kSessionStorageHolderKey"; |
389 | 382 |
390 class SessionStorageHolder : public base::SupportsUserData::Data { | 383 class SessionStorageHolder : public base::SupportsUserData::Data { |
391 public: | 384 public: |
(...skipping 2126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2518 void RenderProcessHostImpl::GetAudioOutputControllers( | 2511 void RenderProcessHostImpl::GetAudioOutputControllers( |
2519 const GetAudioOutputControllersCallback& callback) const { | 2512 const GetAudioOutputControllersCallback& callback) const { |
2520 audio_renderer_host()->GetOutputControllers(callback); | 2513 audio_renderer_host()->GetOutputControllers(callback); |
2521 } | 2514 } |
2522 | 2515 |
2523 BluetoothDispatcherHost* RenderProcessHostImpl::GetBluetoothDispatcherHost() { | 2516 BluetoothDispatcherHost* RenderProcessHostImpl::GetBluetoothDispatcherHost() { |
2524 return bluetooth_dispatcher_host_.get(); | 2517 return bluetooth_dispatcher_host_.get(); |
2525 } | 2518 } |
2526 | 2519 |
2527 } // namespace content | 2520 } // namespace content |
OLD | NEW |