OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/browser/printing/pdf_to_emf_converter.h" | 5 #include "chrome/browser/printing/pdf_to_emf_converter.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 #include <queue> | 10 #include <queue> |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 void Start(const scoped_refptr<base::RefCountedMemory>& data, | 106 void Start(const scoped_refptr<base::RefCountedMemory>& data, |
107 const PdfToEmfConverter::StartCallback& start_callback); | 107 const PdfToEmfConverter::StartCallback& start_callback); |
108 | 108 |
109 void GetPage(int page_number, | 109 void GetPage(int page_number, |
110 const PdfToEmfConverter::GetPageCallback& get_page_callback); | 110 const PdfToEmfConverter::GetPageCallback& get_page_callback); |
111 | 111 |
112 void Stop(); | 112 void Stop(); |
113 | 113 |
114 // UtilityProcessHostClient implementation. | 114 // UtilityProcessHostClient implementation. |
115 void OnProcessCrashed(int exit_code) override; | 115 void OnProcessCrashed(int exit_code) override; |
116 void OnProcessLaunchFailed() override; | 116 void OnProcessLaunchFailed(int exit_code) override; |
117 bool OnMessageReceived(const IPC::Message& message) override; | 117 bool OnMessageReceived(const IPC::Message& message) override; |
118 | 118 |
119 private: | 119 private: |
120 class GetPageCallbackData { | 120 class GetPageCallbackData { |
121 MOVE_ONLY_TYPE_FOR_CPP_03(GetPageCallbackData); | 121 MOVE_ONLY_TYPE_FOR_CPP_03(GetPageCallbackData); |
122 | 122 |
123 public: | 123 public: |
124 GetPageCallbackData(int page_number, | 124 GetPageCallbackData(int page_number, |
125 PdfToEmfConverter::GetPageCallback callback) | 125 PdfToEmfConverter::GetPageCallback callback) |
126 : page_number_(page_number), callback_(callback) {} | 126 : page_number_(page_number), callback_(callback) {} |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
418 base::Bind(&PdfToEmfUtilityProcessHostClient::Stop, this)); | 418 base::Bind(&PdfToEmfUtilityProcessHostClient::Stop, this)); |
419 return; | 419 return; |
420 } | 420 } |
421 Send(new ChromeUtilityMsg_RenderPDFPagesToMetafiles_Stop()); | 421 Send(new ChromeUtilityMsg_RenderPDFPagesToMetafiles_Stop()); |
422 } | 422 } |
423 | 423 |
424 void PdfToEmfUtilityProcessHostClient::OnProcessCrashed(int exit_code) { | 424 void PdfToEmfUtilityProcessHostClient::OnProcessCrashed(int exit_code) { |
425 OnFailed(); | 425 OnFailed(); |
426 } | 426 } |
427 | 427 |
428 void PdfToEmfUtilityProcessHostClient::OnProcessLaunchFailed() { | 428 void PdfToEmfUtilityProcessHostClient::OnProcessLaunchFailed(int exit_code) { |
429 OnFailed(); | 429 OnFailed(); |
430 } | 430 } |
431 | 431 |
432 bool PdfToEmfUtilityProcessHostClient::OnMessageReceived( | 432 bool PdfToEmfUtilityProcessHostClient::OnMessageReceived( |
433 const IPC::Message& message) { | 433 const IPC::Message& message) { |
434 bool handled = true; | 434 bool handled = true; |
435 IPC_BEGIN_MESSAGE_MAP(PdfToEmfUtilityProcessHostClient, message) | 435 IPC_BEGIN_MESSAGE_MAP(PdfToEmfUtilityProcessHostClient, message) |
436 IPC_MESSAGE_HANDLER( | 436 IPC_MESSAGE_HANDLER( |
437 ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_PageCount, OnPageCount) | 437 ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_PageCount, OnPageCount) |
438 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_PageDone, | 438 IPC_MESSAGE_HANDLER(ChromeUtilityHostMsg_RenderPDFPagesToMetafiles_PageDone, |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
490 | 490 |
491 PdfToEmfConverter::~PdfToEmfConverter() { | 491 PdfToEmfConverter::~PdfToEmfConverter() { |
492 } | 492 } |
493 | 493 |
494 // static | 494 // static |
495 std::unique_ptr<PdfToEmfConverter> PdfToEmfConverter::CreateDefault() { | 495 std::unique_ptr<PdfToEmfConverter> PdfToEmfConverter::CreateDefault() { |
496 return std::unique_ptr<PdfToEmfConverter>(new PdfToEmfConverterImpl()); | 496 return std::unique_ptr<PdfToEmfConverter>(new PdfToEmfConverterImpl()); |
497 } | 497 } |
498 | 498 |
499 } // namespace printing | 499 } // namespace printing |
OLD | NEW |