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> | 7 #include <stdint.h> |
8 | 8 |
9 #include <queue> | 9 #include <queue> |
10 #include <utility> | 10 #include <utility> |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "content/public/common/child_process_host.h" | 30 #include "content/public/common/child_process_host.h" |
31 #include "content/public/common/content_switches.h" | 31 #include "content/public/common/content_switches.h" |
32 #include "content/public/common/mojo_channel_switches.h" | 32 #include "content/public/common/mojo_channel_switches.h" |
33 #include "content/public/common/result_codes.h" | 33 #include "content/public/common/result_codes.h" |
34 #include "content/public/common/sandbox_init.h" | 34 #include "content/public/common/sandbox_init.h" |
35 #include "content/public/common/sandboxed_process_launcher_delegate.h" | 35 #include "content/public/common/sandboxed_process_launcher_delegate.h" |
36 #include "mojo/edk/embedder/embedder.h" | 36 #include "mojo/edk/embedder/embedder.h" |
37 #include "mojo/edk/embedder/named_platform_channel_pair.h" | 37 #include "mojo/edk/embedder/named_platform_channel_pair.h" |
38 #include "mojo/edk/embedder/platform_channel_pair.h" | 38 #include "mojo/edk/embedder/platform_channel_pair.h" |
39 #include "mojo/edk/embedder/scoped_platform_handle.h" | 39 #include "mojo/edk/embedder/scoped_platform_handle.h" |
40 #include "printing/emf_win.h" | |
41 #include "sandbox/win/src/sandbox_policy.h" | 40 #include "sandbox/win/src/sandbox_policy.h" |
42 #include "sandbox/win/src/sandbox_types.h" | 41 #include "sandbox/win/src/sandbox_types.h" |
43 #include "ui/base/ui_base_switches.h" | 42 #include "ui/base/ui_base_switches.h" |
44 | 43 |
45 namespace { | 44 namespace { |
46 | 45 |
47 using content::ChildProcessHost; | 46 using content::ChildProcessHost; |
48 | 47 |
49 enum ServiceUtilityProcessHostEvent { | 48 enum ServiceUtilityProcessHostEvent { |
50 SERVICE_UTILITY_STARTED, | 49 SERVICE_UTILITY_STARTED, |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 const std::string& printer_name) { | 421 const std::string& printer_name) { |
423 DCHECK(waiting_for_reply_); | 422 DCHECK(waiting_for_reply_); |
424 ReportUmaEvent(SERVICE_UTILITY_SEMANTIC_CAPS_FAILED); | 423 ReportUmaEvent(SERVICE_UTILITY_SEMANTIC_CAPS_FAILED); |
425 waiting_for_reply_ = false; | 424 waiting_for_reply_ = false; |
426 client_task_runner_->PostTask( | 425 client_task_runner_->PostTask( |
427 FROM_HERE, base::Bind(&Client::OnGetPrinterSemanticCapsAndDefaults, | 426 FROM_HERE, base::Bind(&Client::OnGetPrinterSemanticCapsAndDefaults, |
428 client_.get(), false, printer_name, | 427 client_.get(), false, printer_name, |
429 printing::PrinterSemanticCapsAndDefaults())); | 428 printing::PrinterSemanticCapsAndDefaults())); |
430 } | 429 } |
431 | 430 |
| 431 bool ServiceUtilityProcessHost::Client::OnRenderPDFPagesToMetafilePageDone( |
| 432 const std::vector<char>&, |
| 433 float) { |
| 434 return false; |
| 435 } |
| 436 |
432 bool ServiceUtilityProcessHost::Client::MetafileAvailable(float scale_factor, | 437 bool ServiceUtilityProcessHost::Client::MetafileAvailable(float scale_factor, |
433 base::File file) { | 438 base::File file) { |
434 file.Seek(base::File::FROM_BEGIN, 0); | 439 file.Seek(base::File::FROM_BEGIN, 0); |
435 int64_t size = file.GetLength(); | 440 int64_t size = file.GetLength(); |
436 if (size <= 0) { | 441 if (size <= 0) { |
437 OnRenderPDFPagesToMetafileDone(false); | 442 OnRenderPDFPagesToMetafileDone(false); |
438 return false; | 443 return false; |
439 } | 444 } |
440 std::vector<char> data(size); | 445 std::vector<char> data(size); |
441 if (file.ReadAtCurrentPos(data.data(), data.size()) != size) { | 446 if (file.ReadAtCurrentPos(data.data(), data.size()) != size) { |
442 OnRenderPDFPagesToMetafileDone(false); | 447 OnRenderPDFPagesToMetafileDone(false); |
443 return false; | 448 return false; |
444 } | 449 } |
445 printing::Emf emf; | 450 if (!OnRenderPDFPagesToMetafilePageDone(data, scale_factor)) { |
446 if (!emf.InitFromData(data.data(), data.size())) { | |
447 OnRenderPDFPagesToMetafileDone(false); | 451 OnRenderPDFPagesToMetafileDone(false); |
448 return false; | 452 return false; |
449 } | 453 } |
450 OnRenderPDFPagesToMetafilePageDone(scale_factor, emf); | |
451 return true; | 454 return true; |
452 } | 455 } |
OLD | NEW |