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 "base/threading/thread.h" | 10 #include "base/threading/thread.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "ui/base/ui_base_switches.h" | 24 #include "ui/base/ui_base_switches.h" |
25 #include "ui/gfx/rect.h" | 25 #include "ui/gfx/rect.h" |
26 #include "webkit/glue/image_decoder.h" | 26 #include "webkit/glue/image_decoder.h" |
27 | 27 |
28 #if defined(OS_WIN) | 28 #if defined(OS_WIN) |
29 #include "base/file_util.h" | 29 #include "base/file_util.h" |
30 #include "base/memory/scoped_ptr.h" | 30 #include "base/memory/scoped_ptr.h" |
31 #include "base/path_service.h" | 31 #include "base/path_service.h" |
32 #include "base/win/iat_patch_function.h" | 32 #include "base/win/iat_patch_function.h" |
33 #include "base/win/scoped_handle.h" | 33 #include "base/win/scoped_handle.h" |
34 #include "content/common/child_process_messages.h" | |
35 #include "content/common/sandbox_init_wrapper.h" | |
36 #include "content/public/common/content_switches.h" | 34 #include "content/public/common/content_switches.h" |
37 #include "printing/emf_win.h" | 35 #include "printing/emf_win.h" |
38 #endif // defined(OS_WIN) | 36 #endif // defined(OS_WIN) |
39 | 37 |
40 namespace chrome { | 38 namespace chrome { |
41 | 39 |
42 ChromeContentUtilityClient::ChromeContentUtilityClient() : items_to_import_(0) { | 40 ChromeContentUtilityClient::ChromeContentUtilityClient() : items_to_import_(0) { |
43 } | 41 } |
44 | 42 |
45 ChromeContentUtilityClient::~ChromeContentUtilityClient() { | 43 ChromeContentUtilityClient::~ChromeContentUtilityClient() { |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
227 static base::win::IATPatchFunction g_iat_patch_get_font_data; | 225 static base::win::IATPatchFunction g_iat_patch_get_font_data; |
228 DWORD WINAPI UtilityProcess_GetFontDataPatch( | 226 DWORD WINAPI UtilityProcess_GetFontDataPatch( |
229 HDC hdc, DWORD table, DWORD offset, LPVOID buffer, DWORD length) { | 227 HDC hdc, DWORD table, DWORD offset, LPVOID buffer, DWORD length) { |
230 int rv = GetFontData(hdc, table, offset, buffer, length); | 228 int rv = GetFontData(hdc, table, offset, buffer, length); |
231 if (rv == GDI_ERROR && hdc) { | 229 if (rv == GDI_ERROR && hdc) { |
232 HFONT font = static_cast<HFONT>(GetCurrentObject(hdc, OBJ_FONT)); | 230 HFONT font = static_cast<HFONT>(GetCurrentObject(hdc, OBJ_FONT)); |
233 | 231 |
234 LOGFONT logfont; | 232 LOGFONT logfont; |
235 if (GetObject(font, sizeof(LOGFONT), &logfont)) { | 233 if (GetObject(font, sizeof(LOGFONT), &logfont)) { |
236 std::vector<char> font_data; | 234 std::vector<char> font_data; |
237 if (content::UtilityThread::Get()->Send( | 235 content::UtilityThread::Get()->PreCacheFont(logfont); |
238 new ChildProcessHostMsg_PreCacheFont(logfont))) { | 236 rv = GetFontData(hdc, table, offset, buffer, length); |
239 rv = GetFontData(hdc, table, offset, buffer, length); | 237 content::UtilityThread::Get()->ReleaseCachedFonts(); |
240 content::UtilityThread::Get()->Send( | |
241 new ChildProcessHostMsg_ReleaseCachedFonts()); | |
242 } | |
243 } | 238 } |
244 } | 239 } |
245 return rv; | 240 return rv; |
246 } | 241 } |
247 | 242 |
248 bool ChromeContentUtilityClient::RenderPDFToWinMetafile( | 243 bool ChromeContentUtilityClient::RenderPDFToWinMetafile( |
249 base::PlatformFile pdf_file, | 244 base::PlatformFile pdf_file, |
250 const FilePath& metafile_path, | 245 const FilePath& metafile_path, |
251 const gfx::Rect& render_area, | 246 const gfx::Rect& render_area, |
252 int render_dpi, | 247 int render_dpi, |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 | 409 |
415 void ChromeContentUtilityClient::ImporterCleanup() { | 410 void ChromeContentUtilityClient::ImporterCleanup() { |
416 importer_->Cancel(); | 411 importer_->Cancel(); |
417 importer_ = NULL; | 412 importer_ = NULL; |
418 bridge_ = NULL; | 413 bridge_ = NULL; |
419 import_thread_.reset(); | 414 import_thread_.reset(); |
420 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); | 415 content::UtilityThread::Get()->ReleaseProcessIfNeeded(); |
421 } | 416 } |
422 | 417 |
423 } // namespace chrome | 418 } // namespace chrome |
OLD | NEW |