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

Unified Diff: chrome/child/pdf_child_init.cc

Issue 799643004: Combine PDF plugin into the Chromium binary. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: chrome/child/pdf_child_init.cc
diff --git a/chrome/child/pdf_child_init.cc b/chrome/child/pdf_child_init.cc
index ac17072a22aa3edc72ca11f75211c3ba6722c9a3..1178f4698b2b1e75d7902211b804bdcb421b897d 100644
--- a/chrome/child/pdf_child_init.cc
+++ b/chrome/child/pdf_child_init.cc
@@ -59,15 +59,20 @@ void InitializePDF() {
#if defined(OS_WIN)
// Need to patch a few functions for font loading to work correctly. This can
// be removed once we switch PDF to use Skia.
- base::FilePath pdf;
- if (PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf) &&
- base::PathExists(pdf)) {
- g_iat_patch_createdca.Patch(pdf.value().c_str(), "gdi32.dll", "CreateDCA",
- CreateDCAPatch);
- g_iat_patch_get_font_data.Patch(pdf.value().c_str(), "gdi32.dll",
- "GetFontData", GetFontDataPatch);
- }
-#endif
+ HMODULE current_module = NULL;
+ wchar_t current_module_name[MAX_PATH];
+ CHECK(GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,
+ reinterpret_cast<LPCWSTR>(InitializePDF),
+ &current_module));
+ DWORD result = GetModuleFileNameW(current_module, current_module_name,
+ MAX_PATH);
+ if (!result || result == MAX_PATH)
+ return;
+ g_iat_patch_createdca.Patch(current_module_name, "gdi32.dll", "CreateDCA",
+ CreateDCAPatch);
+ g_iat_patch_get_font_data.Patch(current_module_name, "gdi32.dll",
+ "GetFontData", GetFontDataPatch);
+#endif // OS_WIN
}
} // namespace chrome

Powered by Google App Engine
This is Rietveld 408576698