mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-06-05 21:39:12 +02:00
- Add support for loading localized strings from locale .pak files (issue #357).
- Add support for loading DevTools resources from chrome.pak via the chrome-devtools scheme (issue #358). - Add tools_gyp.patch to fix a bug in GYP. git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@295 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
@ -23,6 +23,7 @@ MSVC_POP_WARNING();
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/WebRect.h"
|
||||
#include "third_party/WebKit/Source/WebKit/chromium/public/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,19 +33,6 @@ using WebKit::WebView;
|
||||
|
||||
namespace webkit_glue {
|
||||
|
||||
string16 GetLocalizedString(int message_id) {
|
||||
// Localized resources are provided via webkit_resources.rc and
|
||||
// webkit_strings_en-US.rc.
|
||||
const ATLSTRINGRESOURCEIMAGE* image =
|
||||
AtlGetStringResourceImage(_AtlBaseModule.GetModuleInstance(),
|
||||
message_id);
|
||||
if (!image) {
|
||||
NOTREACHED();
|
||||
return L"No string for this identifier!";
|
||||
}
|
||||
return string16(image->achString, image->nLength);
|
||||
}
|
||||
|
||||
base::StringPiece GetRawDataResource(HMODULE module, int resource_id) {
|
||||
void* data_ptr;
|
||||
size_t data_size;
|
||||
@ -54,15 +42,21 @@ base::StringPiece GetRawDataResource(HMODULE module, int resource_id) {
|
||||
: base::StringPiece();
|
||||
}
|
||||
|
||||
base::StringPiece NetResourceProvider(int key) {
|
||||
base::StringPiece GetDataResource(int resource_id) {
|
||||
base::StringPiece piece;
|
||||
|
||||
// Try to load the resource from the DLL.
|
||||
HMODULE hModule = ::GetModuleHandle(L"libcef.dll");
|
||||
if(!hModule)
|
||||
hModule = ::GetModuleHandle(NULL);
|
||||
return GetRawDataResource(hModule, key);
|
||||
}
|
||||
piece = GetRawDataResource(hModule, resource_id);
|
||||
|
||||
base::StringPiece GetDataResource(int resource_id) {
|
||||
return NetResourceProvider(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) {
|
||||
|
Reference in New Issue
Block a user