Win: Use the module path for loading resources instead of hard-coding "libcef.dll" (issue #416).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@372 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2011-11-10 23:25:12 +00:00
parent 28f171b26f
commit ccb42a7623
1 changed files with 6 additions and 1 deletions

View File

@ -18,6 +18,7 @@ MSVC_POP_WARNING();
#undef LOG
#include "base/logging.h"
#include "base/path_service.h"
#include "base/win/resource_util.h"
#include "skia/ext/platform_canvas.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h"
@ -45,8 +46,12 @@ base::StringPiece GetRawDataResource(HMODULE module, int resource_id) {
base::StringPiece GetDataResource(int resource_id) {
base::StringPiece piece;
FilePath file_path;
HMODULE hModule = NULL;
// Try to load the resource from the DLL.
HMODULE hModule = ::GetModuleHandle(L"libcef.dll");
if (PathService::Get(base::FILE_MODULE, &file_path))
hModule = ::GetModuleHandle(file_path.value().c_str());
if(!hModule)
hModule = ::GetModuleHandle(NULL);
piece = GetRawDataResource(hModule, resource_id);