| 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 <queue> | 7 #include <queue> |
| 8 | 8 |
| 9 #include "base/files/file.h" | 9 #include "base/files/file.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 data_ = data; | 299 data_ = data; |
| 300 | 300 |
| 301 // Store callback before any OnFailed() call to make it called on failure. | 301 // Store callback before any OnFailed() call to make it called on failure. |
| 302 start_callback_ = start_callback; | 302 start_callback_ = start_callback; |
| 303 | 303 |
| 304 // NOTE: This process _must_ be sandboxed, otherwise the pdf dll will load | 304 // NOTE: This process _must_ be sandboxed, otherwise the pdf dll will load |
| 305 // gdiplus.dll, change how rendering happens, and not be able to correctly | 305 // gdiplus.dll, change how rendering happens, and not be able to correctly |
| 306 // generate when sent to a metafile DC. | 306 // generate when sent to a metafile DC. |
| 307 utility_process_host_ = | 307 utility_process_host_ = |
| 308 content::UtilityProcessHost::Create( | 308 content::UtilityProcessHost::Create( |
| 309 this, base::MessageLoop::current()->message_loop_proxy()) | 309 this, base::MessageLoop::current()->task_runner())->AsWeakPtr(); |
| 310 ->AsWeakPtr(); | |
| 311 utility_process_host_->SetName(l10n_util::GetStringUTF16( | 310 utility_process_host_->SetName(l10n_util::GetStringUTF16( |
| 312 IDS_UTILITY_PROCESS_EMF_CONVERTOR_NAME)); | 311 IDS_UTILITY_PROCESS_EMF_CONVERTOR_NAME)); |
| 313 // Should reply with OnProcessStarted(). | 312 // Should reply with OnProcessStarted(). |
| 314 Send(new ChromeUtilityMsg_StartupPing); | 313 Send(new ChromeUtilityMsg_StartupPing); |
| 315 } | 314 } |
| 316 | 315 |
| 317 void PdfToEmfUtilityProcessHostClient::OnProcessStarted() { | 316 void PdfToEmfUtilityProcessHostClient::OnProcessStarted() { |
| 318 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 317 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 319 if (!utility_process_host_) | 318 if (!utility_process_host_) |
| 320 return OnFailed(); | 319 return OnFailed(); |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 | 501 |
| 503 PdfToEmfConverter::~PdfToEmfConverter() { | 502 PdfToEmfConverter::~PdfToEmfConverter() { |
| 504 } | 503 } |
| 505 | 504 |
| 506 // static | 505 // static |
| 507 scoped_ptr<PdfToEmfConverter> PdfToEmfConverter::CreateDefault() { | 506 scoped_ptr<PdfToEmfConverter> PdfToEmfConverter::CreateDefault() { |
| 508 return scoped_ptr<PdfToEmfConverter>(new PdfToEmfConverterImpl()); | 507 return scoped_ptr<PdfToEmfConverter>(new PdfToEmfConverterImpl()); |
| 509 } | 508 } |
| 510 | 509 |
| 511 } // namespace printing | 510 } // namespace printing |
| OLD | NEW |