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 <stdint.h> |
| 8 |
7 #include <queue> | 9 #include <queue> |
8 | 10 |
9 #include "base/bind.h" | 11 #include "base/bind.h" |
10 #include "base/command_line.h" | 12 #include "base/command_line.h" |
11 #include "base/files/file.h" | 13 #include "base/files/file.h" |
12 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
13 #include "base/files/file_util.h" | 15 #include "base/files/file_util.h" |
14 #include "base/files/scoped_temp_dir.h" | 16 #include "base/files/scoped_temp_dir.h" |
15 #include "base/logging.h" | 17 #include "base/logging.h" |
| 18 #include "base/macros.h" |
16 #include "base/metrics/histogram.h" | 19 #include "base/metrics/histogram.h" |
17 #include "base/process/launch.h" | 20 #include "base/process/launch.h" |
18 #include "base/task_runner_util.h" | 21 #include "base/task_runner_util.h" |
19 #include "base/thread_task_runner_handle.h" | 22 #include "base/thread_task_runner_handle.h" |
| 23 #include "build/build_config.h" |
20 #include "chrome/common/chrome_switches.h" | 24 #include "chrome/common/chrome_switches.h" |
21 #include "chrome/common/chrome_utility_printing_messages.h" | 25 #include "chrome/common/chrome_utility_printing_messages.h" |
22 #include "content/public/common/child_process_host.h" | 26 #include "content/public/common/child_process_host.h" |
23 #include "content/public/common/content_switches.h" | 27 #include "content/public/common/content_switches.h" |
24 #include "content/public/common/result_codes.h" | 28 #include "content/public/common/result_codes.h" |
25 #include "content/public/common/sandbox_init.h" | 29 #include "content/public/common/sandbox_init.h" |
26 #include "content/public/common/sandboxed_process_launcher_delegate.h" | 30 #include "content/public/common/sandboxed_process_launcher_delegate.h" |
27 #include "ipc/ipc_switches.h" | 31 #include "ipc/ipc_switches.h" |
28 #include "printing/emf_win.h" | 32 #include "printing/emf_win.h" |
29 #include "sandbox/win/src/sandbox_policy.h" | 33 #include "sandbox/win/src/sandbox_policy.h" |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 waiting_for_reply_ = false; | 400 waiting_for_reply_ = false; |
397 client_task_runner_->PostTask( | 401 client_task_runner_->PostTask( |
398 FROM_HERE, base::Bind(&Client::OnGetPrinterSemanticCapsAndDefaults, | 402 FROM_HERE, base::Bind(&Client::OnGetPrinterSemanticCapsAndDefaults, |
399 client_.get(), false, printer_name, | 403 client_.get(), false, printer_name, |
400 printing::PrinterSemanticCapsAndDefaults())); | 404 printing::PrinterSemanticCapsAndDefaults())); |
401 } | 405 } |
402 | 406 |
403 bool ServiceUtilityProcessHost::Client::MetafileAvailable(float scale_factor, | 407 bool ServiceUtilityProcessHost::Client::MetafileAvailable(float scale_factor, |
404 base::File file) { | 408 base::File file) { |
405 file.Seek(base::File::FROM_BEGIN, 0); | 409 file.Seek(base::File::FROM_BEGIN, 0); |
406 int64 size = file.GetLength(); | 410 int64_t size = file.GetLength(); |
407 if (size <= 0) { | 411 if (size <= 0) { |
408 OnRenderPDFPagesToMetafileDone(false); | 412 OnRenderPDFPagesToMetafileDone(false); |
409 return false; | 413 return false; |
410 } | 414 } |
411 std::vector<char> data(size); | 415 std::vector<char> data(size); |
412 if (file.ReadAtCurrentPos(data.data(), data.size()) != size) { | 416 if (file.ReadAtCurrentPos(data.data(), data.size()) != size) { |
413 OnRenderPDFPagesToMetafileDone(false); | 417 OnRenderPDFPagesToMetafileDone(false); |
414 return false; | 418 return false; |
415 } | 419 } |
416 printing::Emf emf; | 420 printing::Emf emf; |
417 if (!emf.InitFromData(data.data(), data.size())) { | 421 if (!emf.InitFromData(data.data(), data.size())) { |
418 OnRenderPDFPagesToMetafileDone(false); | 422 OnRenderPDFPagesToMetafileDone(false); |
419 return false; | 423 return false; |
420 } | 424 } |
421 OnRenderPDFPagesToMetafilePageDone(scale_factor, emf); | 425 OnRenderPDFPagesToMetafilePageDone(scale_factor, emf); |
422 return true; | 426 return true; |
423 } | 427 } |
OLD | NEW |