mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
Add the ability to (issue #236):
1. Disable pack file loading via CefSettings.pack_loading_disabled. 2. Customize pack file load paths via CefSettings.pack_file_path and CefSettings.locales_dir_path. 3. Provide custom resource bundle handling via CefResourceBundleHandler. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@501 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@@ -16,13 +16,10 @@ 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/platform/WebRect.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebSize.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"
|
||||
#include "ui/base/resource/resource_bundle.h"
|
||||
#include "ui/gfx/gdi_util.h"
|
||||
#include "webkit/glue/webkit_glue.h"
|
||||
|
||||
@@ -32,37 +29,6 @@ using WebKit::WebView;
|
||||
|
||||
namespace webkit_glue {
|
||||
|
||||
base::StringPiece GetRawDataResource(HMODULE module, int resource_id) {
|
||||
void* data_ptr;
|
||||
size_t data_size;
|
||||
return base::win::GetDataResourceFromModule(module, resource_id, &data_ptr,
|
||||
&data_size)
|
||||
? base::StringPiece(static_cast<char*>(data_ptr), data_size)
|
||||
: base::StringPiece();
|
||||
}
|
||||
|
||||
base::StringPiece GetDataResource(int resource_id) {
|
||||
base::StringPiece piece;
|
||||
|
||||
FilePath file_path;
|
||||
HMODULE hModule = NULL;
|
||||
|
||||
// Try to load the resource from the 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);
|
||||
|
||||
// Try to load the resource from the resource pack.
|
||||
if (piece.empty())
|
||||
piece = ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id);
|
||||
|
||||
DCHECK(!piece.empty()) << "Resource " << resource_id <<
|
||||
" could not be loaded";
|
||||
return piece;
|
||||
}
|
||||
|
||||
bool EnsureFontLoaded(HFONT font) {
|
||||
return true;
|
||||
}
|
||||
|
Reference in New Issue
Block a user