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

Side by Side Diff: chrome/service/service_utility_process_host.cc

Issue 1415483008: Get rid of SandboxedProcessLauncherDelegate::PreSandbox. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove curly braces Created 5 years, 1 month 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 "chrome/service/service_utility_process_host.h" 5 #include "chrome/service/service_utility_process_host.h"
6 6
7 #include <queue> 7 #include <queue>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/files/file.h" 11 #include "base/files/file.h"
12 #include "base/files/file_path.h" 12 #include "base/files/file_path.h"
13 #include "base/files/file_util.h" 13 #include "base/files/file_util.h"
14 #include "base/files/scoped_temp_dir.h" 14 #include "base/files/scoped_temp_dir.h"
15 #include "base/logging.h" 15 #include "base/logging.h"
16 #include "base/metrics/histogram.h" 16 #include "base/metrics/histogram.h"
17 #include "base/process/launch.h" 17 #include "base/process/launch.h"
18 #include "base/task_runner_util.h" 18 #include "base/task_runner_util.h"
19 #include "base/thread_task_runner_handle.h" 19 #include "base/thread_task_runner_handle.h"
20 #include "chrome/common/chrome_switches.h" 20 #include "chrome/common/chrome_switches.h"
21 #include "chrome/common/chrome_utility_printing_messages.h" 21 #include "chrome/common/chrome_utility_printing_messages.h"
22 #include "content/public/common/child_process_host.h" 22 #include "content/public/common/child_process_host.h"
23 #include "content/public/common/content_switches.h" 23 #include "content/public/common/content_switches.h"
24 #include "content/public/common/result_codes.h" 24 #include "content/public/common/result_codes.h"
25 #include "content/public/common/sandbox_init.h" 25 #include "content/public/common/sandbox_init.h"
26 #include "content/public/common/sandboxed_process_launcher_delegate.h" 26 #include "content/public/common/sandboxed_process_launcher_delegate.h"
27 #include "ipc/ipc_switches.h" 27 #include "ipc/ipc_switches.h"
28 #include "printing/emf_win.h" 28 #include "printing/emf_win.h"
29 #include "sandbox/win/src/sandbox_policy_base.h" 29 #include "sandbox/win/src/sandbox_policy.h"
30 #include "sandbox/win/src/sandbox_types.h"
30 #include "ui/base/ui_base_switches.h" 31 #include "ui/base/ui_base_switches.h"
31 32
32 namespace { 33 namespace {
33 34
34 using content::ChildProcessHost; 35 using content::ChildProcessHost;
35 36
36 enum ServiceUtilityProcessHostEvent { 37 enum ServiceUtilityProcessHostEvent {
37 SERVICE_UTILITY_STARTED, 38 SERVICE_UTILITY_STARTED,
38 SERVICE_UTILITY_DISCONNECTED, 39 SERVICE_UTILITY_DISCONNECTED,
39 SERVICE_UTILITY_METAFILE_REQUEST, 40 SERVICE_UTILITY_METAFILE_REQUEST,
(...skipping 14 matching lines...) Expand all
54 id, 55 id,
55 SERVICE_UTILITY_EVENT_MAX); 56 SERVICE_UTILITY_EVENT_MAX);
56 } 57 }
57 58
58 // NOTE: changes to this class need to be reviewed by the security team. 59 // NOTE: changes to this class need to be reviewed by the security team.
59 class ServiceSandboxedProcessLauncherDelegate 60 class ServiceSandboxedProcessLauncherDelegate
60 : public content::SandboxedProcessLauncherDelegate { 61 : public content::SandboxedProcessLauncherDelegate {
61 public: 62 public:
62 ServiceSandboxedProcessLauncherDelegate() {} 63 ServiceSandboxedProcessLauncherDelegate() {}
63 64
64 void PreSpawnTarget(sandbox::TargetPolicy* policy, bool* success) override { 65 bool PreSpawnTarget(sandbox::TargetPolicy* policy) override {
65 // Service process may run as windows service and it fails to create a 66 // Service process may run as windows service and it fails to create a
66 // window station. 67 // window station.
67 policy->SetAlternateDesktop(false); 68 return policy->SetAlternateDesktop(false) == sandbox::SBOX_ALL_OK;
68 } 69 }
69 70
70 private: 71 private:
71 DISALLOW_COPY_AND_ASSIGN(ServiceSandboxedProcessLauncherDelegate); 72 DISALLOW_COPY_AND_ASSIGN(ServiceSandboxedProcessLauncherDelegate);
72 }; 73 };
73 74
74 } // namespace 75 } // namespace
75 76
76 class ServiceUtilityProcessHost::PdfToEmfState { 77 class ServiceUtilityProcessHost::PdfToEmfState {
77 public: 78 public:
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 return false; 414 return false;
414 } 415 }
415 printing::Emf emf; 416 printing::Emf emf;
416 if (!emf.InitFromData(data.data(), data.size())) { 417 if (!emf.InitFromData(data.data(), data.size())) {
417 OnRenderPDFPagesToMetafileDone(false); 418 OnRenderPDFPagesToMetafileDone(false);
418 return false; 419 return false;
419 } 420 }
420 OnRenderPDFPagesToMetafilePageDone(scale_factor, emf); 421 OnRenderPDFPagesToMetafilePageDone(scale_factor, emf);
421 return true; 422 return true;
422 } 423 }
OLDNEW
« no previous file with comments | « chrome/browser/chrome_content_browser_client.cc ('k') | components/nacl/broker/nacl_broker_listener.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698