Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(65)

Side by Side Diff: content/browser/renderer_host/render_process_host_impl.cc

Issue 1185333003: Implement GetSandboxType() on all platforms and implement for all process types. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: keep rebasing keep rebasing... Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 base::win::GetVersion() == base::win::VERSION_WIN8_1) { 352 GetContentClient()->browser()->GetAppContainerSidForSandboxType(
353 const base::CommandLine& command_line = 353 GetSandboxType());
354 *base::CommandLine::ForCurrentProcess(); 354 if (!sid.empty())
355 if (!command_line.HasSwitch(switches::kDisableAppContainer)) { 355 AddAppContainerPolicy(policy, sid.c_str());
356 // TODO(shrikant): Check if these constants should be different across
357 // various versions of Chromium code base or could be same.
358 // If there should be different SID per channel then move this code
359 // in chrome rather than content and assign SID based on
360 // VersionInfo::GetChannel().
361 const wchar_t kAppContainerSid[] =
362 L"S-1-15-2-3251537155-1984446955-2931258699-841473695-1938553385-"
363 L"924012148-129201922";
364
365 policy->SetLowBox(kAppContainerSid);
366 }
367 }
368 356
369 GetContentClient()->browser()->PreSpawnRenderer(policy, success); 357 GetContentClient()->browser()->PreSpawnRenderer(policy, success);
370 } 358 }
371 359
372 #elif defined(OS_POSIX) 360 #elif defined(OS_POSIX)
373 bool ShouldUseZygote() override { 361 bool ShouldUseZygote() override {
374 const base::CommandLine& browser_command_line = 362 const base::CommandLine& browser_command_line =
375 *base::CommandLine::ForCurrentProcess(); 363 *base::CommandLine::ForCurrentProcess();
376 base::CommandLine::StringType renderer_prefix = 364 base::CommandLine::StringType renderer_prefix =
377 browser_command_line.GetSwitchValueNative(switches::kRendererCmdPrefix); 365 browser_command_line.GetSwitchValueNative(switches::kRendererCmdPrefix);
378 return renderer_prefix.empty(); 366 return renderer_prefix.empty();
379 } 367 }
380 base::ScopedFD TakeIpcFd() override { return ipc_fd_.Pass(); } 368 base::ScopedFD TakeIpcFd() override { return ipc_fd_.Pass(); }
381 #endif // OS_WIN 369 #endif // OS_WIN
382 370
371 SandboxType GetSandboxType() override {
372 return SANDBOX_TYPE_RENDERER;
373 }
374
383 private: 375 private:
384 #if defined(OS_POSIX) 376 #if defined(OS_POSIX)
385 base::ScopedFD ipc_fd_; 377 base::ScopedFD ipc_fd_;
386 #endif // OS_POSIX 378 #endif // OS_POSIX
387 }; 379 };
388 380
389 const char kSessionStorageHolderKey[] = "kSessionStorageHolderKey"; 381 const char kSessionStorageHolderKey[] = "kSessionStorageHolderKey";
390 382
391 class SessionStorageHolder : public base::SupportsUserData::Data { 383 class SessionStorageHolder : public base::SupportsUserData::Data {
392 public: 384 public:
(...skipping 2126 matching lines...) Expand 10 before | Expand all | Expand 10 after
2519 void RenderProcessHostImpl::GetAudioOutputControllers( 2511 void RenderProcessHostImpl::GetAudioOutputControllers(
2520 const GetAudioOutputControllersCallback& callback) const { 2512 const GetAudioOutputControllersCallback& callback) const {
2521 audio_renderer_host()->GetOutputControllers(callback); 2513 audio_renderer_host()->GetOutputControllers(callback);
2522 } 2514 }
2523 2515
2524 BluetoothDispatcherHost* RenderProcessHostImpl::GetBluetoothDispatcherHost() { 2516 BluetoothDispatcherHost* RenderProcessHostImpl::GetBluetoothDispatcherHost() {
2525 return bluetooth_dispatcher_host_.get(); 2517 return bluetooth_dispatcher_host_.get();
2526 } 2518 }
2527 2519
2528 } // namespace content 2520 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/ppapi_plugin_process_host.cc ('k') | content/browser/utility_process_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698