| OLD | NEW |
| 1 // Copyright (c) 2011 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/chrome_content_utility_client.h" | 5 #include "chrome/utility/chrome_content_utility_client.h" |
| 6 | 6 |
| 7 #include "base/base64.h" | 7 #include "base/base64.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/json/json_reader.h" | 9 #include "base/json/json_reader.h" |
| 10 #include "chrome/common/chrome_paths.h" | 10 #include "chrome/common/chrome_paths.h" |
| 11 #include "chrome/common/chrome_utility_messages.h" | 11 #include "chrome/common/chrome_utility_messages.h" |
| 12 #include "chrome/common/extensions/extension_l10n_util.h" | 12 #include "chrome/common/extensions/extension_l10n_util.h" |
| 13 #include "chrome/common/extensions/extension_unpacker.h" | 13 #include "chrome/common/extensions/extension_unpacker.h" |
| 14 #include "chrome/common/extensions/update_manifest.h" | 14 #include "chrome/common/extensions/update_manifest.h" |
| 15 #include "chrome/common/web_resource/web_resource_unpacker.h" | 15 #include "chrome/common/web_resource/web_resource_unpacker.h" |
| 16 #include "content/utility/utility_thread.h" | 16 #include "content/utility/utility_thread.h" |
| 17 #include "printing/backend/print_backend.h" | 17 #include "printing/backend/print_backend.h" |
| 18 #include "printing/page_range.h" | 18 #include "printing/page_range.h" |
| 19 #include "third_party/skia/include/core/SkBitmap.h" | 19 #include "third_party/skia/include/core/SkBitmap.h" |
| 20 #include "ui/base/ui_base_switches.h" | 20 #include "ui/base/ui_base_switches.h" |
| 21 #include "ui/gfx/rect.h" | 21 #include "ui/gfx/rect.h" |
| 22 #include "webkit/glue/image_decoder.h" | 22 #include "webkit/glue/image_decoder.h" |
| 23 | 23 |
| 24 #if defined(OS_WIN) | 24 #if defined(OS_WIN) |
| 25 #include "base/file_util.h" | 25 #include "base/file_util.h" |
| 26 #include "base/memory/scoped_ptr.h" | 26 #include "base/memory/scoped_ptr.h" |
| 27 #include "base/path_service.h" | 27 #include "base/path_service.h" |
| 28 #include "base/win/iat_patch_function.h" | 28 #include "base/win/iat_patch_function.h" |
| 29 #include "base/win/scoped_handle.h" | 29 #include "base/win/scoped_handle.h" |
| 30 #include "content/common/child_process_messages.h" |
| 30 #include "content/common/content_switches.h" | 31 #include "content/common/content_switches.h" |
| 31 #include "content/common/sandbox_init_wrapper.h" | 32 #include "content/common/sandbox_init_wrapper.h" |
| 32 #include "printing/emf_win.h" | 33 #include "printing/emf_win.h" |
| 33 #endif // defined(OS_WIN) | 34 #endif // defined(OS_WIN) |
| 34 | 35 |
| 35 namespace chrome { | 36 namespace chrome { |
| 36 | 37 |
| 37 ChromeContentUtilityClient::ChromeContentUtilityClient() { | 38 ChromeContentUtilityClient::ChromeContentUtilityClient() { |
| 38 } | 39 } |
| 39 | 40 |
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 DWORD WINAPI UtilityProcess_GetFontDataPatch( | 217 DWORD WINAPI UtilityProcess_GetFontDataPatch( |
| 217 HDC hdc, DWORD table, DWORD offset, LPVOID buffer, DWORD length) { | 218 HDC hdc, DWORD table, DWORD offset, LPVOID buffer, DWORD length) { |
| 218 int rv = GetFontData(hdc, table, offset, buffer, length); | 219 int rv = GetFontData(hdc, table, offset, buffer, length); |
| 219 if (rv == GDI_ERROR && hdc) { | 220 if (rv == GDI_ERROR && hdc) { |
| 220 HFONT font = static_cast<HFONT>(GetCurrentObject(hdc, OBJ_FONT)); | 221 HFONT font = static_cast<HFONT>(GetCurrentObject(hdc, OBJ_FONT)); |
| 221 | 222 |
| 222 LOGFONT logfont; | 223 LOGFONT logfont; |
| 223 if (GetObject(font, sizeof(LOGFONT), &logfont)) { | 224 if (GetObject(font, sizeof(LOGFONT), &logfont)) { |
| 224 std::vector<char> font_data; | 225 std::vector<char> font_data; |
| 225 if (UtilityThread::current()->Send( | 226 if (UtilityThread::current()->Send( |
| 226 new ChromeUtilityHostMsg_PreCacheFont(logfont))) | 227 new ChromeUtilityHostMsg_PreCacheFont(logfont))) { |
| 227 rv = GetFontData(hdc, table, offset, buffer, length); | 228 rv = GetFontData(hdc, table, offset, buffer, length); |
| 229 UtilityThread::current()->Send( |
| 230 new ChromeUtilityHostMsg_ReleaseCachedFonts()); |
| 231 } |
| 228 } | 232 } |
| 229 } | 233 } |
| 230 return rv; | 234 return rv; |
| 231 } | 235 } |
| 232 | 236 |
| 233 bool ChromeContentUtilityClient::RenderPDFToWinMetafile( | 237 bool ChromeContentUtilityClient::RenderPDFToWinMetafile( |
| 234 base::PlatformFile pdf_file, | 238 base::PlatformFile pdf_file, |
| 235 const FilePath& metafile_path, | 239 const FilePath& metafile_path, |
| 236 const gfx::Rect& render_area, | 240 const gfx::Rect& render_area, |
| 237 int render_dpi, | 241 int render_dpi, |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 Send(new ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Succeeded( | 350 Send(new ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Succeeded( |
| 347 printer_name, printer_info)); | 351 printer_name, printer_info)); |
| 348 } else { | 352 } else { |
| 349 Send(new ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Failed( | 353 Send(new ChromeUtilityHostMsg_GetPrinterCapsAndDefaults_Failed( |
| 350 printer_name)); | 354 printer_name)); |
| 351 } | 355 } |
| 352 UtilityThread::current()->ReleaseProcessIfNeeded(); | 356 UtilityThread::current()->ReleaseProcessIfNeeded(); |
| 353 } | 357 } |
| 354 | 358 |
| 355 } // namespace chrome | 359 } // namespace chrome |
| OLD | NEW |