OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/utility/utility_thread.h" | 5 #include "chrome/utility/utility_thread.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
11 #include "base/values.h" | 11 #include "base/values.h" |
(...skipping 10 matching lines...) Expand all Loading... |
22 #include "printing/native_metafile.h" | 22 #include "printing/native_metafile.h" |
23 #include "printing/page_range.h" | 23 #include "printing/page_range.h" |
24 #include "printing/units.h" | 24 #include "printing/units.h" |
25 #include "third_party/skia/include/core/SkBitmap.h" | 25 #include "third_party/skia/include/core/SkBitmap.h" |
26 #include "third_party/WebKit/WebKit/chromium/public/WebSerializedScriptValue.h" | 26 #include "third_party/WebKit/WebKit/chromium/public/WebSerializedScriptValue.h" |
27 #include "webkit/glue/idb_bindings.h" | 27 #include "webkit/glue/idb_bindings.h" |
28 #include "webkit/glue/image_decoder.h" | 28 #include "webkit/glue/image_decoder.h" |
29 | 29 |
30 #if defined(OS_WIN) | 30 #if defined(OS_WIN) |
31 #include "app/win/iat_patch_function.h" | 31 #include "app/win/iat_patch_function.h" |
| 32 #include "base/win/scoped_handle.h" |
32 #endif | 33 #endif |
33 | 34 |
34 namespace { | 35 namespace { |
35 | 36 |
36 template<typename SRC, typename DEST> | 37 template<typename SRC, typename DEST> |
37 void ConvertVector(const SRC& src, DEST* dest) { | 38 void ConvertVector(const SRC& src, DEST* dest) { |
38 dest->reserve(src.size()); | 39 dest->reserve(src.size()); |
39 for (typename SRC::const_iterator i = src.begin(); i != src.end(); ++i) | 40 for (typename SRC::const_iterator i = src.begin(); i != src.end(); ++i) |
40 dest->push_back(typename DEST::value_type(*i)); | 41 dest->push_back(typename DEST::value_type(*i)); |
41 } | 42 } |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 | 198 |
198 bool UtilityThread::RenderPDFToWinMetafile( | 199 bool UtilityThread::RenderPDFToWinMetafile( |
199 base::PlatformFile pdf_file, | 200 base::PlatformFile pdf_file, |
200 const FilePath& metafile_path, | 201 const FilePath& metafile_path, |
201 const gfx::Rect& render_area, | 202 const gfx::Rect& render_area, |
202 int render_dpi, | 203 int render_dpi, |
203 const std::vector<printing::PageRange>& page_ranges, | 204 const std::vector<printing::PageRange>& page_ranges, |
204 printing::NativeMetafile* metafile, | 205 printing::NativeMetafile* metafile, |
205 int* highest_rendered_page_number) { | 206 int* highest_rendered_page_number) { |
206 *highest_rendered_page_number = -1; | 207 *highest_rendered_page_number = -1; |
207 ScopedHandle file(pdf_file); | 208 base::win::ScopedHandle file(pdf_file); |
208 FilePath pdf_module_path; | 209 FilePath pdf_module_path; |
209 PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf_module_path); | 210 PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf_module_path); |
210 HMODULE pdf_module = GetModuleHandle(pdf_module_path.value().c_str()); | 211 HMODULE pdf_module = GetModuleHandle(pdf_module_path.value().c_str()); |
211 if (!pdf_module) | 212 if (!pdf_module) |
212 return false; | 213 return false; |
213 | 214 |
214 RenderPDFPageToDCProc render_proc = | 215 RenderPDFPageToDCProc render_proc = |
215 reinterpret_cast<RenderPDFPageToDCProc>( | 216 reinterpret_cast<RenderPDFPageToDCProc>( |
216 GetProcAddress(pdf_module, "RenderPDFPageToDC")); | 217 GetProcAddress(pdf_module, "RenderPDFPageToDC")); |
217 if (!render_proc) | 218 if (!render_proc) |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
323 Send(new UtilityHostMsg_GetPrinterCapsAndDefaults_Failed(printer_name)); | 324 Send(new UtilityHostMsg_GetPrinterCapsAndDefaults_Failed(printer_name)); |
324 } | 325 } |
325 ReleaseProcessIfNeeded(); | 326 ReleaseProcessIfNeeded(); |
326 } | 327 } |
327 | 328 |
328 void UtilityThread::ReleaseProcessIfNeeded() { | 329 void UtilityThread::ReleaseProcessIfNeeded() { |
329 if (!batch_mode_) | 330 if (!batch_mode_) |
330 ChildProcess::current()->ReleaseProcess(); | 331 ChildProcess::current()->ReleaseProcess(); |
331 } | 332 } |
332 | 333 |
OLD | NEW |