| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/local_discovery/pwg_raster_converter.h" | 5 #include "chrome/browser/local_discovery/pwg_raster_converter.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind_helpers.h" | 9 #include "base/bind_helpers.h" |
| 10 #include "base/cancelable_callback.h" | 10 #include "base/cancelable_callback.h" |
| 11 #include "base/files/file.h" | 11 #include "base/files/file.h" |
| 12 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
| 13 #include "base/files/scoped_temp_dir.h" | 13 #include "base/files/scoped_temp_dir.h" |
| 14 #include "base/location.h" |
| 14 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "base/single_thread_task_runner.h" |
| 15 #include "chrome/common/chrome_utility_messages.h" | 17 #include "chrome/common/chrome_utility_messages.h" |
| 16 #include "chrome/common/chrome_utility_printing_messages.h" | 18 #include "chrome/common/chrome_utility_printing_messages.h" |
| 17 #include "chrome/grit/generated_resources.h" | 19 #include "chrome/grit/generated_resources.h" |
| 18 #include "components/cloud_devices/common/cloud_device_description.h" | 20 #include "components/cloud_devices/common/cloud_device_description.h" |
| 19 #include "components/cloud_devices/common/printer_description.h" | 21 #include "components/cloud_devices/common/printer_description.h" |
| 20 #include "content/public/browser/browser_thread.h" | 22 #include "content/public/browser/browser_thread.h" |
| 21 #include "content/public/browser/child_process_data.h" | 23 #include "content/public/browser/child_process_data.h" |
| 22 #include "content/public/browser/utility_process_host.h" | 24 #include "content/public/browser/utility_process_host.h" |
| 23 #include "content/public/browser/utility_process_host_client.h" | 25 #include "content/public/browser/utility_process_host_client.h" |
| 24 #include "printing/pdf_render_settings.h" | 26 #include "printing/pdf_render_settings.h" |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 } | 221 } |
| 220 BrowserThread::PostTask( | 222 BrowserThread::PostTask( |
| 221 BrowserThread::IO, FROM_HERE, | 223 BrowserThread::IO, FROM_HERE, |
| 222 base::Bind(&PwgUtilityProcessHostClient::StartProcessOnIOThread, this)); | 224 base::Bind(&PwgUtilityProcessHostClient::StartProcessOnIOThread, this)); |
| 223 } | 225 } |
| 224 | 226 |
| 225 void PwgUtilityProcessHostClient::StartProcessOnIOThread() { | 227 void PwgUtilityProcessHostClient::StartProcessOnIOThread() { |
| 226 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 228 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 227 utility_process_host_ = | 229 utility_process_host_ = |
| 228 content::UtilityProcessHost::Create( | 230 content::UtilityProcessHost::Create( |
| 229 this, | 231 this, base::MessageLoop::current()->task_runner())->AsWeakPtr(); |
| 230 base::MessageLoop::current()->message_loop_proxy())->AsWeakPtr(); | |
| 231 utility_process_host_->SetName(l10n_util::GetStringUTF16( | 232 utility_process_host_->SetName(l10n_util::GetStringUTF16( |
| 232 IDS_UTILITY_PROCESS_PWG_RASTER_CONVERTOR_NAME)); | 233 IDS_UTILITY_PROCESS_PWG_RASTER_CONVERTOR_NAME)); |
| 233 utility_process_host_->Send(new ChromeUtilityMsg_StartupPing); | 234 utility_process_host_->Send(new ChromeUtilityMsg_StartupPing); |
| 234 } | 235 } |
| 235 | 236 |
| 236 void PwgUtilityProcessHostClient::RunCallback(bool success) { | 237 void PwgUtilityProcessHostClient::RunCallback(bool success) { |
| 237 BrowserThread::PostTask( | 238 BrowserThread::PostTask( |
| 238 BrowserThread::UI, FROM_HERE, | 239 BrowserThread::UI, FROM_HERE, |
| 239 base::Bind(&PwgUtilityProcessHostClient::RunCallbackOnUIThread, this, | 240 base::Bind(&PwgUtilityProcessHostClient::RunCallbackOnUIThread, this, |
| 240 success)); | 241 success)); |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 354 } | 355 } |
| 355 } | 356 } |
| 356 | 357 |
| 357 result.rotate_all_pages = raster_capability.value().rotate_all_pages; | 358 result.rotate_all_pages = raster_capability.value().rotate_all_pages; |
| 358 | 359 |
| 359 result.reverse_page_order = raster_capability.value().reverse_order_streaming; | 360 result.reverse_page_order = raster_capability.value().reverse_order_streaming; |
| 360 return result; | 361 return result; |
| 361 } | 362 } |
| 362 | 363 |
| 363 } // namespace local_discovery | 364 } // namespace local_discovery |
| OLD | NEW |