OLD | NEW |
---|---|
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 "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
10 #include "base/files/scoped_temp_dir.h" | 10 #include "base/files/scoped_temp_dir.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
13 #include "base/message_loop/message_loop_proxy.h" | 13 #include "base/message_loop/message_loop_proxy.h" |
14 #include "base/metrics/histogram.h" | 14 #include "base/metrics/histogram.h" |
15 #include "base/process/kill.h" | 15 #include "base/process/kill.h" |
16 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
17 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
18 #include "chrome/common/chrome_utility_printing_messages.h" | 18 #include "chrome/common/chrome_utility_printing_messages.h" |
19 #include "content/public/common/child_process_host.h" | 19 #include "content/public/common/child_process_host.h" |
20 #include "content/public/common/result_codes.h" | 20 #include "content/public/common/result_codes.h" |
21 #include "content/public/common/sandbox_init.h" | 21 #include "content/public/common/sandbox_init.h" |
22 #include "ipc/ipc_switches.h" | 22 #include "ipc/ipc_switches.h" |
23 #include "printing/page_range.h" | 23 #include "printing/page_range.h" |
24 #include "ui/base/ui_base_switches.h" | 24 #include "ui/base/ui_base_switches.h" |
25 #include "ui/gfx/rect.h" | 25 #include "ui/gfx/rect.h" |
26 | 26 |
27 #if defined(OS_WIN) | 27 #if defined(OS_WIN) |
28 | |
jam
2014/09/04 18:06:38
nit: no change needed
Vitaly Buka (NO REVIEWS)
2014/09/04 18:19:39
Done.
| |
28 #include "base/files/file_path.h" | 29 #include "base/files/file_path.h" |
29 #include "base/memory/scoped_ptr.h" | 30 #include "base/memory/scoped_ptr.h" |
30 #include "base/process/launch.h" | 31 #include "base/process/launch.h" |
31 #include "base/win/scoped_handle.h" | 32 #include "base/win/scoped_handle.h" |
32 #include "content/public/common/sandbox_init.h" | 33 #include "content/public/common/sandbox_init.h" |
33 #include "content/public/common/sandboxed_process_launcher_delegate.h" | 34 #include "content/public/common/sandboxed_process_launcher_delegate.h" |
34 #include "printing/emf_win.h" | 35 #include "printing/emf_win.h" |
36 #include "sandbox/win/src/sandbox_policy_base.h" | |
35 | 37 |
36 namespace { | 38 namespace { |
37 | 39 |
38 // NOTE: changes to this class need to be reviewed by the security team. | 40 // NOTE: changes to this class need to be reviewed by the security team. |
39 class ServiceSandboxedProcessLauncherDelegate | 41 class ServiceSandboxedProcessLauncherDelegate |
40 : public content::SandboxedProcessLauncherDelegate { | 42 : public content::SandboxedProcessLauncherDelegate { |
41 public: | 43 public: |
42 explicit ServiceSandboxedProcessLauncherDelegate( | 44 explicit ServiceSandboxedProcessLauncherDelegate( |
43 const base::FilePath& exposed_dir) | 45 const base::FilePath& exposed_dir) |
44 : exposed_dir_(exposed_dir) { | 46 : exposed_dir_(exposed_dir) { |
45 } | 47 } |
46 | 48 |
47 virtual void PreSandbox(bool* disable_default_policy, | 49 virtual void PreSandbox(bool* disable_default_policy, |
48 base::FilePath* exposed_dir) OVERRIDE { | 50 base::FilePath* exposed_dir) OVERRIDE { |
49 *exposed_dir = exposed_dir_; | 51 *exposed_dir = exposed_dir_; |
50 } | 52 } |
51 | 53 |
54 virtual void PreSpawnTarget(sandbox::TargetPolicy* policy, | |
55 bool* success) OVERRIDE { | |
56 // Service process may run as windows service and it would fail to create | |
57 // ::CreateWindowStation. | |
58 policy->SetAlternateDesktop(false); | |
59 } | |
60 | |
52 private: | 61 private: |
53 base::FilePath exposed_dir_; | 62 base::FilePath exposed_dir_; |
54 }; | 63 }; |
55 | 64 |
56 } // namespace | 65 } // namespace |
57 | 66 |
58 #endif // OS_WIN | 67 #endif // OS_WIN |
59 | 68 |
60 using content::ChildProcessHost; | 69 using content::ChildProcessHost; |
61 | 70 |
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
383 if (!metafile.InitFromFile(metafile_path)) { | 392 if (!metafile.InitFromFile(metafile_path)) { |
384 OnRenderPDFPagesToMetafileFailed(); | 393 OnRenderPDFPagesToMetafileFailed(); |
385 } else { | 394 } else { |
386 OnRenderPDFPagesToMetafileSucceeded(metafile, | 395 OnRenderPDFPagesToMetafileSucceeded(metafile, |
387 highest_rendered_page_number, | 396 highest_rendered_page_number, |
388 scale_factor); | 397 scale_factor); |
389 } | 398 } |
390 #endif // defined(OS_WIN) | 399 #endif // defined(OS_WIN) |
391 } | 400 } |
392 | 401 |
OLD | NEW |