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': [
|
||||
'<@(cefclient_bundle_resources_mac)',
|
||||
'<(grit_out_dir)/devtools_resources.pak',
|
||||
],
|
||||
'mac_bundle_resources!': [
|
||||
# TODO(mark): Come up with a fancier way to do this (mac_info_plist?)
|
||||
|
@ -84,24 +85,6 @@
|
|||
'<@(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': [
|
||||
{
|
||||
|
@ -113,7 +96,7 @@
|
|||
{
|
||||
'destination': '<(PRODUCT_DIR)',
|
||||
'files': [
|
||||
'<(INTERMEDIATE_DIR)/repack/chrome.pak'
|
||||
'<(grit_out_dir)/devtools_resources.pak'
|
||||
],
|
||||
},
|
||||
],
|
||||
|
@ -172,7 +155,6 @@
|
|||
'process_outputs_as_mac_bundle_resources': 1,
|
||||
'variables': {
|
||||
'pak_inputs': [
|
||||
'<(grit_out_dir)/devtools_resources.pak',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/net/net_resources.pak',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/ui/gfx/gfx_resources.pak',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_chromium_resources.pak',
|
||||
|
@ -252,7 +234,6 @@
|
|||
'action_name': 'repack_resources',
|
||||
'variables': {
|
||||
'pak_inputs': [
|
||||
'<(grit_out_dir)/devtools_resources.pak',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/net/net_resources.pak',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/ui/gfx/gfx_resources.pak',
|
||||
'<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_chromium_resources.pak',
|
||||
|
@ -279,7 +260,8 @@
|
|||
{
|
||||
'destination': '<(PRODUCT_DIR)',
|
||||
'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 {
|
||||
|
||||
#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) {
|
||||
// Load chrome.pak (on Mac) and the appropiate locale pack.
|
||||
const std::string loaded_locale =
|
||||
ResourceBundle::InitSharedInstance(locale);
|
||||
CHECK(!loaded_locale.empty()) << "Locale could not be found for " << locale;
|
||||
|
||||
#if defined(OS_WIN)
|
||||
// Explicitly load chrome.pak on Windows. Use the module (libcef.dll)
|
||||
// directory to match the location of the locale folder.
|
||||
FilePath chrome_pack_path;
|
||||
PathService::Get(base::DIR_MODULE, &chrome_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
|
||||
// Load devtools_resources.pak if it exists.
|
||||
FilePath pack_path =
|
||||
GetResourcesFilePath().AppendASCII("devtools_resources.pak");
|
||||
if (file_util::PathExists(pack_path))
|
||||
ResourceBundle::AddDataPackToSharedInstance(pack_path);
|
||||
}
|
||||
|
||||
void CleanupResourceBundle() {
|
||||
|
|
|
@ -20,9 +20,7 @@ namespace webkit {
|
|||
struct WebPluginInfo;
|
||||
}
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
class FilePath;
|
||||
#endif
|
||||
|
||||
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|
|
||||
BOOL SaveBitmapToFile(HBITMAP hBmp, HDC hDC, LPCTSTR file, LPBYTE lpBits);
|
||||
#endif
|
||||
|
||||
|
||||
FilePath GetResourcesFilePath();
|
||||
void InitializeResourceBundle(const std::string& locale);
|
||||
void CleanupResourceBundle();
|
||||
|
||||
#if defined(OS_MACOSX)
|
||||
FilePath GetResourcesFilePath();
|
||||
#endif
|
||||
|
||||
string16 GetLocalizedString(int message_id);
|
||||
base::StringPiece GetDataResource(int resource_id);
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#undef LOG
|
||||
#include "base/file_util.h"
|
||||
#include "base/logging.h"
|
||||
#include "base/mac/foundation_util.h"
|
||||
#include "base/mac/mac_util.h"
|
||||
#include "base/path_service.h"
|
||||
#include "base/utf_string_conversions.h"
|
||||
|
@ -21,24 +22,17 @@
|
|||
|
||||
|
||||
namespace webkit_glue {
|
||||
|
||||
// Helper method for getting the path to the CEF resources directory.
|
||||
|
||||
FilePath GetResourcesFilePath() {
|
||||
FilePath path;
|
||||
// We need to know if we're bundled or not to know which path to use.
|
||||
if (base::mac::AmIBundled()) {
|
||||
PathService::Get(base::DIR_EXE, &path);
|
||||
path = path.Append(FilePath::kParentDirectory);
|
||||
return path.AppendASCII("Resources");
|
||||
} else {
|
||||
// TODO(port): Allow the embedder to customize the resource path.
|
||||
PathService::Get(base::DIR_SOURCE_ROOT, &path);
|
||||
path = path.AppendASCII("src");
|
||||
path = path.AppendASCII("cef");
|
||||
path = path.AppendASCII("tests");
|
||||
path = path.AppendASCII("cefclient");
|
||||
return path.AppendASCII("res");
|
||||
}
|
||||
// Start out with the path to the running executable.
|
||||
FilePath execPath;
|
||||
PathService::Get(base::FILE_EXE, &execPath);
|
||||
|
||||
// Get the main bundle path.
|
||||
FilePath bundlePath = base::mac::GetAppBundlePath(execPath);
|
||||
|
||||
return bundlePath.Append(FILE_PATH_LITERAL("Contents"))
|
||||
.Append(FILE_PATH_LITERAL("Resources"));
|
||||
}
|
||||
|
||||
base::StringPiece GetDataResource(int resource_id) {
|
||||
|
|
|
@ -70,7 +70,8 @@ Required components:
|
|||
|
||||
* Other resources
|
||||
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
|
||||
|
|
|
@ -74,6 +74,7 @@ Required components:
|
|||
|
||||
* Other resources
|
||||
Resources/chrome.pak
|
||||
Resources/devtools_resources.pak
|
||||
Resources/*.png
|
||||
Resources/*.tiff
|
||||
|
||||
|
|
|
@ -80,8 +80,8 @@ Required components:
|
|||
locales folder must exist in the same directory as libcef.dll.
|
||||
|
||||
* Other resources
|
||||
chrome.pak
|
||||
Note: The chrome.pak file must exist in the same directory as libcef.dll.
|
||||
devtools_resources.pak
|
||||
Note: The pak file must exist in the same directory as libcef.dll.
|
||||
|
||||
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(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/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'), \
|
||||
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(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/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'), \
|
||||
options.quiet)
|
||||
|
||||
|
@ -352,6 +352,7 @@ elif platform == 'macosx':
|
|||
make_dir(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/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)
|
||||
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_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/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)
|
||||
|
||||
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_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/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)
|
||||
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue