| 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/logging.h" | 14 #include "base/logging.h" |
| 15 #include "chrome/common/chrome_utility_messages.h" | 15 #include "chrome/common/chrome_utility_messages.h" |
| 16 #include "chrome/common/chrome_utility_printing_messages.h" | 16 #include "chrome/common/chrome_utility_printing_messages.h" |
| 17 #include "chrome/grit/generated_resources.h" |
| 17 #include "components/cloud_devices/common/cloud_device_description.h" | 18 #include "components/cloud_devices/common/cloud_device_description.h" |
| 18 #include "components/cloud_devices/common/printer_description.h" | 19 #include "components/cloud_devices/common/printer_description.h" |
| 19 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
| 20 #include "content/public/browser/child_process_data.h" | 21 #include "content/public/browser/child_process_data.h" |
| 21 #include "content/public/browser/utility_process_host.h" | 22 #include "content/public/browser/utility_process_host.h" |
| 22 #include "content/public/browser/utility_process_host_client.h" | 23 #include "content/public/browser/utility_process_host_client.h" |
| 23 #include "printing/pdf_render_settings.h" | 24 #include "printing/pdf_render_settings.h" |
| 24 #include "printing/pwg_raster_settings.h" | 25 #include "printing/pwg_raster_settings.h" |
| 25 #include "printing/units.h" | 26 #include "printing/units.h" |
| 27 #include "ui/base/l10n/l10n_util.h" |
| 26 #include "ui/gfx/geometry/rect.h" | 28 #include "ui/gfx/geometry/rect.h" |
| 27 #include "ui/gfx/geometry/size.h" | 29 #include "ui/gfx/geometry/size.h" |
| 28 | 30 |
| 29 namespace local_discovery { | 31 namespace local_discovery { |
| 30 | 32 |
| 31 namespace { | 33 namespace { |
| 32 | 34 |
| 33 using content::BrowserThread; | 35 using content::BrowserThread; |
| 34 | 36 |
| 35 class FileHandlers { | 37 class FileHandlers { |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 BrowserThread::IO, FROM_HERE, | 221 BrowserThread::IO, FROM_HERE, |
| 220 base::Bind(&PwgUtilityProcessHostClient::StartProcessOnIOThread, this)); | 222 base::Bind(&PwgUtilityProcessHostClient::StartProcessOnIOThread, this)); |
| 221 } | 223 } |
| 222 | 224 |
| 223 void PwgUtilityProcessHostClient::StartProcessOnIOThread() { | 225 void PwgUtilityProcessHostClient::StartProcessOnIOThread() { |
| 224 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); | 226 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO)); |
| 225 utility_process_host_ = | 227 utility_process_host_ = |
| 226 content::UtilityProcessHost::Create( | 228 content::UtilityProcessHost::Create( |
| 227 this, | 229 this, |
| 228 base::MessageLoop::current()->message_loop_proxy())->AsWeakPtr(); | 230 base::MessageLoop::current()->message_loop_proxy())->AsWeakPtr(); |
| 231 utility_process_host_->SetName(l10n_util::GetStringUTF16( |
| 232 IDS_UTILITY_PROCESS_PWG_RASTER_CONVERTOR_NAME)); |
| 229 utility_process_host_->Send(new ChromeUtilityMsg_StartupPing); | 233 utility_process_host_->Send(new ChromeUtilityMsg_StartupPing); |
| 230 } | 234 } |
| 231 | 235 |
| 232 void PwgUtilityProcessHostClient::RunCallback(bool success) { | 236 void PwgUtilityProcessHostClient::RunCallback(bool success) { |
| 233 BrowserThread::PostTask( | 237 BrowserThread::PostTask( |
| 234 BrowserThread::UI, FROM_HERE, | 238 BrowserThread::UI, FROM_HERE, |
| 235 base::Bind(&PwgUtilityProcessHostClient::RunCallbackOnUIThread, this, | 239 base::Bind(&PwgUtilityProcessHostClient::RunCallbackOnUIThread, this, |
| 236 success)); | 240 success)); |
| 237 } | 241 } |
| 238 | 242 |
| (...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 } | 354 } |
| 351 } | 355 } |
| 352 | 356 |
| 353 result.rotate_all_pages = raster_capability.value().rotate_all_pages; | 357 result.rotate_all_pages = raster_capability.value().rotate_all_pages; |
| 354 | 358 |
| 355 result.reverse_page_order = raster_capability.value().reverse_order_streaming; | 359 result.reverse_page_order = raster_capability.value().reverse_order_streaming; |
| 356 return result; | 360 return result; |
| 357 } | 361 } |
| 358 | 362 |
| 359 } // namespace local_discovery | 363 } // namespace local_discovery |
| OLD | NEW |