Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: chrome/child/pdf_child_init.cc

Issue 899033002: Revert of Combine PDF plugin into the Chromium binary. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/resources/pdf/pdf_extension_test.cc ('k') | chrome/chrome.isolate » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/child/pdf_child_init.h" 5 #include "chrome/child/pdf_child_init.h"
6 6
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "chrome/common/chrome_paths.h" 10 #include "chrome/common/chrome_paths.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 return rv; 52 return rv;
53 } 53 }
54 #endif // OS_WIN 54 #endif // OS_WIN
55 55
56 } // namespace 56 } // namespace
57 57
58 void InitializePDF() { 58 void InitializePDF() {
59 #if defined(OS_WIN) 59 #if defined(OS_WIN)
60 // Need to patch a few functions for font loading to work correctly. This can 60 // Need to patch a few functions for font loading to work correctly. This can
61 // be removed once we switch PDF to use Skia. 61 // be removed once we switch PDF to use Skia.
62 HMODULE current_module = NULL; 62 base::FilePath pdf;
63 wchar_t current_module_name[MAX_PATH]; 63 if (PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf) &&
64 CHECK(GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS, 64 base::PathExists(pdf)) {
65 reinterpret_cast<LPCWSTR>(InitializePDF), 65 g_iat_patch_createdca.Patch(pdf.value().c_str(), "gdi32.dll", "CreateDCA",
66 &current_module)); 66 CreateDCAPatch);
67 DWORD result = GetModuleFileNameW(current_module, current_module_name, 67 g_iat_patch_get_font_data.Patch(pdf.value().c_str(), "gdi32.dll",
68 MAX_PATH); 68 "GetFontData", GetFontDataPatch);
69 if (!result || result == MAX_PATH) 69 }
70 return; 70 #endif
71 g_iat_patch_createdca.Patch(current_module_name, "gdi32.dll", "CreateDCA",
72 CreateDCAPatch);
73 g_iat_patch_get_font_data.Patch(current_module_name, "gdi32.dll",
74 "GetFontData", GetFontDataPatch);
75 #endif // OS_WIN
76 } 71 }
77 72
78 } // namespace chrome 73 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/resources/pdf/pdf_extension_test.cc ('k') | chrome/chrome.isolate » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698