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

Side by Side 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, 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
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 base::FilePath pdf; 62 HMODULE current_module = NULL;
63 if (PathService::Get(chrome::FILE_PDF_PLUGIN, &pdf) && 63 wchar_t current_module_name[MAX_PATH];
64 base::PathExists(pdf)) { 64 CHECK(GetModuleHandleEx(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS,
65 g_iat_patch_createdca.Patch(pdf.value().c_str(), "gdi32.dll", "CreateDCA", 65 reinterpret_cast<LPCWSTR>(InitializePDF),
66 CreateDCAPatch); 66 &current_module));
67 g_iat_patch_get_font_data.Patch(pdf.value().c_str(), "gdi32.dll", 67 DWORD result = GetModuleFileNameW(current_module, current_module_name,
68 "GetFontData", GetFontDataPatch); 68 MAX_PATH);
69 } 69 if (!result || result == MAX_PATH)
70 #endif 70 return;
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
71 } 76 }
72 77
73 } // namespace chrome 78 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698