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 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 : ipc_fd_(channel->TakeClientFileDescriptor()) | 338 : ipc_fd_(channel->TakeClientFileDescriptor()) |
339 #endif // OS_POSIX | 339 #endif // OS_POSIX |
340 {} | 340 {} |
341 | 341 |
342 ~RendererSandboxedProcessLauncherDelegate() override {} | 342 ~RendererSandboxedProcessLauncherDelegate() override {} |
343 | 343 |
344 #if defined(OS_WIN) | 344 #if defined(OS_WIN) |
345 void PreSpawnTarget(sandbox::TargetPolicy* policy, bool* success) override { | 345 void PreSpawnTarget(sandbox::TargetPolicy* policy, bool* success) override { |
346 AddBaseHandleClosePolicy(policy); | 346 AddBaseHandleClosePolicy(policy); |
347 | 347 |
348 if (base::win::GetVersion() == base::win::VERSION_WIN8 || | 348 const base::string16& sid = |
349 base::win::GetVersion() == base::win::VERSION_WIN8_1) { | 349 GetContentClient()->browser()->GetAppContainerSidForSandboxType( |
350 const base::CommandLine& command_line = | 350 GetSandboxType()); |
351 *base::CommandLine::ForCurrentProcess(); | 351 if (!sid.empty()) |
352 if (!command_line.HasSwitch(switches::kDisableAppContainer)) { | 352 MaybeAddAppContainerPolicy(policy, sid.c_str()); |
353 // TODO(shrikant): Check if these constants should be different across | |
354 // various versions of Chromium code base or could be same. | |
355 // If there should be different SID per channel then move this code | |
356 // in chrome rather than content and assign SID based on | |
357 // VersionInfo::GetChannel(). | |
358 const wchar_t kAppContainerSid[] = | |
359 L"S-1-15-2-3251537155-1984446955-2931258699-841473695-1938553385-" | |
360 L"924012148-129201922"; | |
361 | |
362 policy->SetLowBox(kAppContainerSid); | |
363 } | |
364 } | |
365 | 353 |
366 GetContentClient()->browser()->PreSpawnRenderer(policy, success); | 354 GetContentClient()->browser()->PreSpawnRenderer(policy, success); |
367 } | 355 } |
368 | 356 |
369 #elif defined(OS_POSIX) | 357 #elif defined(OS_POSIX) |
370 bool ShouldUseZygote() override { | 358 bool ShouldUseZygote() override { |
371 const base::CommandLine& browser_command_line = | 359 const base::CommandLine& browser_command_line = |
372 *base::CommandLine::ForCurrentProcess(); | 360 *base::CommandLine::ForCurrentProcess(); |
373 base::CommandLine::StringType renderer_prefix = | 361 base::CommandLine::StringType renderer_prefix = |
374 browser_command_line.GetSwitchValueNative(switches::kRendererCmdPrefix); | 362 browser_command_line.GetSwitchValueNative(switches::kRendererCmdPrefix); |
375 return renderer_prefix.empty(); | 363 return renderer_prefix.empty(); |
376 } | 364 } |
377 base::ScopedFD TakeIpcFd() override { return ipc_fd_.Pass(); } | 365 base::ScopedFD TakeIpcFd() override { return ipc_fd_.Pass(); } |
378 #endif // OS_WIN | 366 #endif // OS_WIN |
379 | 367 |
| 368 SandboxType GetSandboxType() override { |
| 369 return SANDBOX_TYPE_RENDERER; |
| 370 } |
| 371 |
380 private: | 372 private: |
381 #if defined(OS_POSIX) | 373 #if defined(OS_POSIX) |
382 base::ScopedFD ipc_fd_; | 374 base::ScopedFD ipc_fd_; |
383 #endif // OS_POSIX | 375 #endif // OS_POSIX |
384 }; | 376 }; |
385 | 377 |
386 const char kSessionStorageHolderKey[] = "kSessionStorageHolderKey"; | 378 const char kSessionStorageHolderKey[] = "kSessionStorageHolderKey"; |
387 | 379 |
388 class SessionStorageHolder : public base::SupportsUserData::Data { | 380 class SessionStorageHolder : public base::SupportsUserData::Data { |
389 public: | 381 public: |
(...skipping 2102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2492 void RenderProcessHostImpl::GetAudioOutputControllers( | 2484 void RenderProcessHostImpl::GetAudioOutputControllers( |
2493 const GetAudioOutputControllersCallback& callback) const { | 2485 const GetAudioOutputControllersCallback& callback) const { |
2494 audio_renderer_host()->GetOutputControllers(callback); | 2486 audio_renderer_host()->GetOutputControllers(callback); |
2495 } | 2487 } |
2496 | 2488 |
2497 BluetoothDispatcherHost* RenderProcessHostImpl::GetBluetoothDispatcherHost() { | 2489 BluetoothDispatcherHost* RenderProcessHostImpl::GetBluetoothDispatcherHost() { |
2498 return bluetooth_dispatcher_host_.get(); | 2490 return bluetooth_dispatcher_host_.get(); |
2499 } | 2491 } |
2500 | 2492 |
2501 } // namespace content | 2493 } // namespace content |
OLD | NEW |