mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-02-17 20:50:42 +01:00
Move devtools resources to a separate devtools_resources.pak file (issue #714).
git-svn-id: https://chromiumembedded.googlecode.com/svn/branches/963@763 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
c0517941f3
commit
bf0acb75b9
26
cef.gyp
26
cef.gyp
@ -46,6 +46,7 @@
|
|||||||
],
|
],
|
||||||
'mac_bundle_resources': [
|
'mac_bundle_resources': [
|
||||||
'<@(cefclient_bundle_resources_mac)',
|
'<@(cefclient_bundle_resources_mac)',
|
||||||
|
'<(grit_out_dir)/devtools_resources.pak',
|
||||||
],
|
],
|
||||||
'mac_bundle_resources!': [
|
'mac_bundle_resources!': [
|
||||||
# TODO(mark): Come up with a fancier way to do this (mac_info_plist?)
|
# TODO(mark): Come up with a fancier way to do this (mac_info_plist?)
|
||||||
@ -84,24 +85,6 @@
|
|||||||
'<@(locales)',
|
'<@(locales)',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
|
||||||
# On Windows chrome.pak will contain only the inspector resources.
|
|
||||||
# Other resources are built into libcef.dll.
|
|
||||||
'action_name': 'repack_resources',
|
|
||||||
'variables': {
|
|
||||||
'pak_inputs': [
|
|
||||||
'<(grit_out_dir)/devtools_resources.pak',
|
|
||||||
],
|
|
||||||
},
|
|
||||||
'inputs': [
|
|
||||||
'<(repack_path)',
|
|
||||||
'<@(pak_inputs)',
|
|
||||||
],
|
|
||||||
'outputs': [
|
|
||||||
'<(INTERMEDIATE_DIR)/repack/chrome.pak',
|
|
||||||
],
|
|
||||||
'action': ['python', '<(repack_path)', '<@(_outputs)', '<@(pak_inputs)'],
|
|
||||||
},
|
|
||||||
],
|
],
|
||||||
'copies': [
|
'copies': [
|
||||||
{
|
{
|
||||||
@ -113,7 +96,7 @@
|
|||||||
{
|
{
|
||||||
'destination': '<(PRODUCT_DIR)',
|
'destination': '<(PRODUCT_DIR)',
|
||||||
'files': [
|
'files': [
|
||||||
'<(INTERMEDIATE_DIR)/repack/chrome.pak'
|
'<(grit_out_dir)/devtools_resources.pak'
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@ -172,7 +155,6 @@
|
|||||||
'process_outputs_as_mac_bundle_resources': 1,
|
'process_outputs_as_mac_bundle_resources': 1,
|
||||||
'variables': {
|
'variables': {
|
||||||
'pak_inputs': [
|
'pak_inputs': [
|
||||||
'<(grit_out_dir)/devtools_resources.pak',
|
|
||||||
'<(SHARED_INTERMEDIATE_DIR)/net/net_resources.pak',
|
'<(SHARED_INTERMEDIATE_DIR)/net/net_resources.pak',
|
||||||
'<(SHARED_INTERMEDIATE_DIR)/ui/gfx/gfx_resources.pak',
|
'<(SHARED_INTERMEDIATE_DIR)/ui/gfx/gfx_resources.pak',
|
||||||
'<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_chromium_resources.pak',
|
'<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_chromium_resources.pak',
|
||||||
@ -252,7 +234,6 @@
|
|||||||
'action_name': 'repack_resources',
|
'action_name': 'repack_resources',
|
||||||
'variables': {
|
'variables': {
|
||||||
'pak_inputs': [
|
'pak_inputs': [
|
||||||
'<(grit_out_dir)/devtools_resources.pak',
|
|
||||||
'<(SHARED_INTERMEDIATE_DIR)/net/net_resources.pak',
|
'<(SHARED_INTERMEDIATE_DIR)/net/net_resources.pak',
|
||||||
'<(SHARED_INTERMEDIATE_DIR)/ui/gfx/gfx_resources.pak',
|
'<(SHARED_INTERMEDIATE_DIR)/ui/gfx/gfx_resources.pak',
|
||||||
'<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_chromium_resources.pak',
|
'<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_chromium_resources.pak',
|
||||||
@ -279,7 +260,8 @@
|
|||||||
{
|
{
|
||||||
'destination': '<(PRODUCT_DIR)',
|
'destination': '<(PRODUCT_DIR)',
|
||||||
'files': [
|
'files': [
|
||||||
'<(INTERMEDIATE_DIR)/repack/chrome.pak'
|
'<(INTERMEDIATE_DIR)/repack/chrome.pak',
|
||||||
|
'<(grit_out_dir)/devtools_resources.pak',
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -40,23 +40,25 @@ using WebKit::WebFrameImpl;
|
|||||||
|
|
||||||
namespace webkit_glue {
|
namespace webkit_glue {
|
||||||
|
|
||||||
|
#if !defined(OS_MACOSX)
|
||||||
|
FilePath GetResourcesFilePath() {
|
||||||
|
FilePath pak_dir;
|
||||||
|
PathService::Get(base::DIR_MODULE, &pak_dir);
|
||||||
|
return pak_dir;
|
||||||
|
}
|
||||||
|
#endif // !defined(OS_MACOSX)
|
||||||
|
|
||||||
void InitializeResourceBundle(const std::string& locale) {
|
void InitializeResourceBundle(const std::string& locale) {
|
||||||
// Load chrome.pak (on Mac) and the appropiate locale pack.
|
// Load chrome.pak (on Mac) and the appropiate locale pack.
|
||||||
const std::string loaded_locale =
|
const std::string loaded_locale =
|
||||||
ResourceBundle::InitSharedInstance(locale);
|
ResourceBundle::InitSharedInstance(locale);
|
||||||
CHECK(!loaded_locale.empty()) << "Locale could not be found for " << locale;
|
CHECK(!loaded_locale.empty()) << "Locale could not be found for " << locale;
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
// Load devtools_resources.pak if it exists.
|
||||||
// Explicitly load chrome.pak on Windows. Use the module (libcef.dll)
|
FilePath pack_path =
|
||||||
// directory to match the location of the locale folder.
|
GetResourcesFilePath().AppendASCII("devtools_resources.pak");
|
||||||
FilePath chrome_pack_path;
|
if (file_util::PathExists(pack_path))
|
||||||
PathService::Get(base::DIR_MODULE, &chrome_pack_path);
|
ResourceBundle::AddDataPackToSharedInstance(pack_path);
|
||||||
chrome_pack_path = chrome_pack_path.AppendASCII("chrome.pak");
|
|
||||||
if (file_util::PathExists(chrome_pack_path))
|
|
||||||
ResourceBundle::AddDataPackToSharedInstance(chrome_pack_path);
|
|
||||||
else
|
|
||||||
NOTREACHED() << "Could not load chrome.pak";
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CleanupResourceBundle() {
|
void CleanupResourceBundle() {
|
||||||
|
@ -20,9 +20,7 @@ namespace webkit {
|
|||||||
struct WebPluginInfo;
|
struct WebPluginInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(OS_MACOSX)
|
|
||||||
class FilePath;
|
class FilePath;
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace webkit_glue {
|
namespace webkit_glue {
|
||||||
|
|
||||||
@ -34,14 +32,11 @@ void CaptureWebViewBitmap(HWND mainWnd, WebKit::WebView* webview,
|
|||||||
// Save a bitmap image to file, providing optional alternative data in |lpBits|
|
// Save a bitmap image to file, providing optional alternative data in |lpBits|
|
||||||
BOOL SaveBitmapToFile(HBITMAP hBmp, HDC hDC, LPCTSTR file, LPBYTE lpBits);
|
BOOL SaveBitmapToFile(HBITMAP hBmp, HDC hDC, LPCTSTR file, LPBYTE lpBits);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
FilePath GetResourcesFilePath();
|
||||||
void InitializeResourceBundle(const std::string& locale);
|
void InitializeResourceBundle(const std::string& locale);
|
||||||
void CleanupResourceBundle();
|
void CleanupResourceBundle();
|
||||||
|
|
||||||
#if defined(OS_MACOSX)
|
|
||||||
FilePath GetResourcesFilePath();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
string16 GetLocalizedString(int message_id);
|
string16 GetLocalizedString(int message_id);
|
||||||
base::StringPiece GetDataResource(int resource_id);
|
base::StringPiece GetDataResource(int resource_id);
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#undef LOG
|
#undef LOG
|
||||||
#include "base/file_util.h"
|
#include "base/file_util.h"
|
||||||
#include "base/logging.h"
|
#include "base/logging.h"
|
||||||
|
#include "base/mac/foundation_util.h"
|
||||||
#include "base/mac/mac_util.h"
|
#include "base/mac/mac_util.h"
|
||||||
#include "base/path_service.h"
|
#include "base/path_service.h"
|
||||||
#include "base/utf_string_conversions.h"
|
#include "base/utf_string_conversions.h"
|
||||||
@ -21,24 +22,17 @@
|
|||||||
|
|
||||||
|
|
||||||
namespace webkit_glue {
|
namespace webkit_glue {
|
||||||
|
|
||||||
// Helper method for getting the path to the CEF resources directory.
|
|
||||||
FilePath GetResourcesFilePath() {
|
FilePath GetResourcesFilePath() {
|
||||||
FilePath path;
|
// Start out with the path to the running executable.
|
||||||
// We need to know if we're bundled or not to know which path to use.
|
FilePath execPath;
|
||||||
if (base::mac::AmIBundled()) {
|
PathService::Get(base::FILE_EXE, &execPath);
|
||||||
PathService::Get(base::DIR_EXE, &path);
|
|
||||||
path = path.Append(FilePath::kParentDirectory);
|
// Get the main bundle path.
|
||||||
return path.AppendASCII("Resources");
|
FilePath bundlePath = base::mac::GetAppBundlePath(execPath);
|
||||||
} else {
|
|
||||||
// TODO(port): Allow the embedder to customize the resource path.
|
return bundlePath.Append(FILE_PATH_LITERAL("Contents"))
|
||||||
PathService::Get(base::DIR_SOURCE_ROOT, &path);
|
.Append(FILE_PATH_LITERAL("Resources"));
|
||||||
path = path.AppendASCII("src");
|
|
||||||
path = path.AppendASCII("cef");
|
|
||||||
path = path.AppendASCII("tests");
|
|
||||||
path = path.AppendASCII("cefclient");
|
|
||||||
return path.AppendASCII("res");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
base::StringPiece GetDataResource(int resource_id) {
|
base::StringPiece GetDataResource(int resource_id) {
|
||||||
|
@ -70,7 +70,8 @@ Required components:
|
|||||||
|
|
||||||
* Other resources
|
* Other resources
|
||||||
chrome.pak
|
chrome.pak
|
||||||
Note: The chrome.pak file must exist in the same directory as the executable.
|
devtools_resources.pak
|
||||||
|
Note: The pak files must exist in the same directory as libcef.so.
|
||||||
|
|
||||||
|
|
||||||
LICENSING
|
LICENSING
|
||||||
|
@ -74,6 +74,7 @@ Required components:
|
|||||||
|
|
||||||
* Other resources
|
* Other resources
|
||||||
Resources/chrome.pak
|
Resources/chrome.pak
|
||||||
|
Resources/devtools_resources.pak
|
||||||
Resources/*.png
|
Resources/*.png
|
||||||
Resources/*.tiff
|
Resources/*.tiff
|
||||||
|
|
||||||
|
@ -80,8 +80,8 @@ Required components:
|
|||||||
locales folder must exist in the same directory as libcef.dll.
|
locales folder must exist in the same directory as libcef.dll.
|
||||||
|
|
||||||
* Other resources
|
* Other resources
|
||||||
chrome.pak
|
devtools_resources.pak
|
||||||
Note: The chrome.pak file must exist in the same directory as libcef.dll.
|
Note: The pak file must exist in the same directory as libcef.dll.
|
||||||
|
|
||||||
Optional components:
|
Optional components:
|
||||||
|
|
||||||
|
@ -259,7 +259,7 @@ if platform == 'windows':
|
|||||||
copy_files(os.path.join(script_dir, 'distrib/win/*.dll'), dst_dir, options.quiet)
|
copy_files(os.path.join(script_dir, 'distrib/win/*.dll'), dst_dir, options.quiet)
|
||||||
copy_files(os.path.join(cef_dir, 'Debug/*.dll'), dst_dir, options.quiet)
|
copy_files(os.path.join(cef_dir, 'Debug/*.dll'), dst_dir, options.quiet)
|
||||||
copy_file(os.path.join(cef_dir, 'Debug/cefclient.exe'), dst_dir, options.quiet)
|
copy_file(os.path.join(cef_dir, 'Debug/cefclient.exe'), dst_dir, options.quiet)
|
||||||
copy_file(os.path.join(cef_dir, 'Debug/chrome.pak'), dst_dir, options.quiet)
|
copy_file(os.path.join(cef_dir, 'Debug/devtools_resources.pak'), dst_dir, options.quiet)
|
||||||
copy_dir(os.path.join(cef_dir, 'Debug/locales'), os.path.join(dst_dir, 'locales'), \
|
copy_dir(os.path.join(cef_dir, 'Debug/locales'), os.path.join(dst_dir, 'locales'), \
|
||||||
options.quiet)
|
options.quiet)
|
||||||
|
|
||||||
@ -277,7 +277,7 @@ if platform == 'windows':
|
|||||||
copy_files(os.path.join(script_dir, 'distrib/win/*.dll'), dst_dir, options.quiet)
|
copy_files(os.path.join(script_dir, 'distrib/win/*.dll'), dst_dir, options.quiet)
|
||||||
copy_files(os.path.join(cef_dir, 'Release/*.dll'), dst_dir, options.quiet)
|
copy_files(os.path.join(cef_dir, 'Release/*.dll'), dst_dir, options.quiet)
|
||||||
copy_file(os.path.join(cef_dir, 'Release/cefclient.exe'), dst_dir, options.quiet)
|
copy_file(os.path.join(cef_dir, 'Release/cefclient.exe'), dst_dir, options.quiet)
|
||||||
copy_file(os.path.join(cef_dir, 'Release/chrome.pak'), dst_dir, options.quiet)
|
copy_file(os.path.join(cef_dir, 'Release/devtools_resources.pak'), dst_dir, options.quiet)
|
||||||
copy_dir(os.path.join(cef_dir, 'Release/locales'), os.path.join(dst_dir, 'locales'), \
|
copy_dir(os.path.join(cef_dir, 'Release/locales'), os.path.join(dst_dir, 'locales'), \
|
||||||
options.quiet)
|
options.quiet)
|
||||||
|
|
||||||
@ -352,6 +352,7 @@ elif platform == 'macosx':
|
|||||||
make_dir(dst_dir, options.quiet)
|
make_dir(dst_dir, options.quiet)
|
||||||
copy_files(os.path.join(cef_dir, '../third_party/WebKit/Source/WebCore/Resources/*.*'), dst_dir, options.quiet)
|
copy_files(os.path.join(cef_dir, '../third_party/WebKit/Source/WebCore/Resources/*.*'), dst_dir, options.quiet)
|
||||||
copy_file(os.path.join(cef_dir, '../xcodebuild/Release/cefclient.app/Contents/Resources/chrome.pak'), dst_dir, options.quiet)
|
copy_file(os.path.join(cef_dir, '../xcodebuild/Release/cefclient.app/Contents/Resources/chrome.pak'), dst_dir, options.quiet)
|
||||||
|
copy_file(os.path.join(cef_dir, '../xcodebuild/Release/cefclient.app/Contents/Resources/devtools_resources.pak'), dst_dir, options.quiet)
|
||||||
copy_files(os.path.join(cef_dir, '../xcodebuild/Release/cefclient.app/Contents/Resources/*.lproj'), dst_dir, options.quiet)
|
copy_files(os.path.join(cef_dir, '../xcodebuild/Release/cefclient.app/Contents/Resources/*.lproj'), dst_dir, options.quiet)
|
||||||
remove_dir(os.path.join(dst_dir, 'English.lproj'))
|
remove_dir(os.path.join(dst_dir, 'English.lproj'))
|
||||||
|
|
||||||
@ -385,6 +386,7 @@ elif platform == 'linux':
|
|||||||
copy_dir(os.path.join(linux_build_dir, 'Debug/lib.target'), os.path.join(dst_dir, 'lib.target'), options.quiet)
|
copy_dir(os.path.join(linux_build_dir, 'Debug/lib.target'), os.path.join(dst_dir, 'lib.target'), options.quiet)
|
||||||
copy_file(os.path.join(linux_build_dir, 'Debug/cefclient'), dst_dir, options.quiet)
|
copy_file(os.path.join(linux_build_dir, 'Debug/cefclient'), dst_dir, options.quiet)
|
||||||
copy_file(os.path.join(linux_build_dir, 'Debug/chrome.pak'), dst_dir, options.quiet)
|
copy_file(os.path.join(linux_build_dir, 'Debug/chrome.pak'), dst_dir, options.quiet)
|
||||||
|
copy_file(os.path.join(linux_build_dir, 'Debug/devtools_resources.pak'), dst_dir, options.quiet)
|
||||||
copy_dir(os.path.join(linux_build_dir, 'Debug/locales'), os.path.join(dst_dir, 'locales'), options.quiet)
|
copy_dir(os.path.join(linux_build_dir, 'Debug/locales'), os.path.join(dst_dir, 'locales'), options.quiet)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
@ -397,6 +399,7 @@ elif platform == 'linux':
|
|||||||
copy_dir(os.path.join(linux_build_dir, 'Release/lib.target'), os.path.join(dst_dir, 'lib.target'), options.quiet)
|
copy_dir(os.path.join(linux_build_dir, 'Release/lib.target'), os.path.join(dst_dir, 'lib.target'), options.quiet)
|
||||||
copy_file(os.path.join(linux_build_dir, 'Release/cefclient'), dst_dir, options.quiet)
|
copy_file(os.path.join(linux_build_dir, 'Release/cefclient'), dst_dir, options.quiet)
|
||||||
copy_file(os.path.join(linux_build_dir, 'Release/chrome.pak'), dst_dir, options.quiet)
|
copy_file(os.path.join(linux_build_dir, 'Release/chrome.pak'), dst_dir, options.quiet)
|
||||||
|
copy_file(os.path.join(linux_build_dir, 'Release/devtools_resources.pak'), dst_dir, options.quiet)
|
||||||
copy_dir(os.path.join(linux_build_dir, 'Release/locales'), os.path.join(dst_dir, 'locales'), options.quiet)
|
copy_dir(os.path.join(linux_build_dir, 'Release/locales'), os.path.join(dst_dir, 'locales'), options.quiet)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user