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

Side by Side Diff: content/browser/utility_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: do not call base class from chrome's contentbrowserclient Created 5 years, 5 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 (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/utility_process_host_impl.h" 5 #include "content/browser/utility_process_host_impl.h"
6 6
7 #include "base/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/lazy_instance.h" 11 #include "base/lazy_instance.h"
12 #include "base/message_loop/message_loop.h" 12 #include "base/message_loop/message_loop.h"
13 #include "base/process/process_handle.h" 13 #include "base/process/process_handle.h"
14 #include "base/run_loop.h" 14 #include "base/run_loop.h"
15 #include "base/sequenced_task_runner.h" 15 #include "base/sequenced_task_runner.h"
16 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
17 #include "base/synchronization/lock.h" 17 #include "base/synchronization/lock.h"
18 #include "base/synchronization/waitable_event.h" 18 #include "base/synchronization/waitable_event.h"
19 #include "content/browser/browser_child_process_host_impl.h" 19 #include "content/browser/browser_child_process_host_impl.h"
20 #include "content/browser/mojo/mojo_application_host.h" 20 #include "content/browser/mojo/mojo_application_host.h"
21 #include "content/browser/renderer_host/render_process_host_impl.h" 21 #include "content/browser/renderer_host/render_process_host_impl.h"
22 #include "content/common/child_process_host_impl.h" 22 #include "content/common/child_process_host_impl.h"
23 #include "content/common/in_process_child_thread_params.h" 23 #include "content/common/in_process_child_thread_params.h"
24 #include "content/common/utility_messages.h" 24 #include "content/common/utility_messages.h"
25 #include "content/public/browser/browser_thread.h" 25 #include "content/public/browser/browser_thread.h"
26 #include "content/public/browser/content_browser_client.h" 26 #include "content/public/browser/content_browser_client.h"
27 #include "content/public/browser/utility_process_host_client.h" 27 #include "content/public/browser/utility_process_host_client.h"
28 #include "content/public/common/content_switches.h" 28 #include "content/public/common/content_switches.h"
29 #include "content/public/common/process_type.h" 29 #include "content/public/common/process_type.h"
30 #include "content/public/common/sandbox_type.h"
30 #include "content/public/common/sandboxed_process_launcher_delegate.h" 31 #include "content/public/common/sandboxed_process_launcher_delegate.h"
31 #include "ipc/ipc_switches.h" 32 #include "ipc/ipc_switches.h"
32 #include "ui/base/ui_base_switches.h" 33 #include "ui/base/ui_base_switches.h"
33 34
34 namespace content { 35 namespace content {
35 36
36 // NOTE: changes to this class need to be reviewed by the security team. 37 // NOTE: changes to this class need to be reviewed by the security team.
37 class UtilitySandboxedProcessLauncherDelegate 38 class UtilitySandboxedProcessLauncherDelegate
38 : public SandboxedProcessLauncherDelegate { 39 : public SandboxedProcessLauncherDelegate {
39 public: 40 public:
(...skipping 22 matching lines...) Expand all
62 } 63 }
63 #elif defined(OS_POSIX) 64 #elif defined(OS_POSIX)
64 65
65 bool ShouldUseZygote() override { 66 bool ShouldUseZygote() override {
66 return !no_sandbox_ && exposed_dir_.empty(); 67 return !no_sandbox_ && exposed_dir_.empty();
67 } 68 }
68 base::EnvironmentMap GetEnvironment() override { return env_; } 69 base::EnvironmentMap GetEnvironment() override { return env_; }
69 base::ScopedFD TakeIpcFd() override { return ipc_fd_.Pass(); } 70 base::ScopedFD TakeIpcFd() override { return ipc_fd_.Pass(); }
70 #endif // OS_WIN 71 #endif // OS_WIN
71 72
73 SandboxType GetSandboxType() override {
74 return SANDBOX_TYPE_UTILITY;
75 }
76
72 private: 77 private:
73 base::FilePath exposed_dir_; 78 base::FilePath exposed_dir_;
74 79
75 #if defined(OS_WIN) 80 #if defined(OS_WIN)
76 bool launch_elevated_; 81 bool launch_elevated_;
77 #elif defined(OS_POSIX) 82 #elif defined(OS_POSIX)
78 base::EnvironmentMap env_; 83 base::EnvironmentMap env_;
79 bool no_sandbox_; 84 bool no_sandbox_;
80 base::ScopedFD ipc_fd_; 85 base::ScopedFD ipc_fd_;
81 #endif // OS_WIN 86 #endif // OS_WIN
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 if (RenderProcessHost::run_renderer_in_process()) 346 if (RenderProcessHost::run_renderer_in_process())
342 handle = base::GetCurrentProcessHandle(); 347 handle = base::GetCurrentProcessHandle();
343 else 348 else
344 handle = process_->GetData().handle; 349 handle = process_->GetData().handle;
345 350
346 mojo_application_host_->Activate(this, handle); 351 mojo_application_host_->Activate(this, handle);
347 } 352 }
348 } 353 }
349 354
350 } // namespace content 355 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698