This commit is contained in:
Cheng Zhao 2018-05-30 16:13:34 +09:00
Родитель a11182ca84
Коммит 18dde0a0bd
3 изменённых файлов: 11 добавлений и 21 удалений

Просмотреть файл

@ -7,6 +7,7 @@
#include <memory> #include <memory>
#include "base/command_line.h" #include "base/command_line.h"
#include "base/mac/bundle_locations.h"
#include "base/path_service.h" #include "base/path_service.h"
#include "brightray/browser/browser_client.h" #include "brightray/browser/browser_client.h"
#include "brightray/common/content_client.h" #include "brightray/common/content_client.h"
@ -53,12 +54,13 @@ void LoadResourceBundle(const std::string& locale) {
ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance(); ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
bundle.ReloadLocaleResources(locale); bundle.ReloadLocaleResources(locale);
// Load other resource files. // Load other resource files.
#if defined(OS_MACOSX)
LoadCommonResources();
#else
base::FilePath pak_dir; base::FilePath pak_dir;
#if defined(OS_MACOSX)
pak_dir = base::mac::FrameworkBundlePath().Append("Resources");
#else
PathService::Get(base::DIR_MODULE, &pak_dir); PathService::Get(base::DIR_MODULE, &pak_dir);
#endif
bundle.AddDataPackFromPath( bundle.AddDataPackFromPath(
pak_dir.Append(FILE_PATH_LITERAL("content_shell.pak")), pak_dir.Append(FILE_PATH_LITERAL("content_shell.pak")),
ui::GetSupportedScaleFactors()[0]); ui::GetSupportedScaleFactors()[0]);
@ -79,7 +81,6 @@ void LoadResourceBundle(const std::string& locale) {
bundle.AddDataPackFromPath( bundle.AddDataPackFromPath(
pak_dir.Append(FILE_PATH_LITERAL("views_resources_200_percent.pak")), pak_dir.Append(FILE_PATH_LITERAL("views_resources_200_percent.pak")),
ui::SCALE_FACTOR_200P); ui::SCALE_FACTOR_200P);
#endif
} }
MainDelegate::MainDelegate() {} MainDelegate::MainDelegate() {}

Просмотреть файл

@ -25,23 +25,8 @@ base::FilePath GetFrameworksPath() {
return MainApplicationBundlePath().Append("Contents").Append("Frameworks"); return MainApplicationBundlePath().Append("Contents").Append("Frameworks");
} }
base::FilePath GetResourcesPakFilePath(NSString* name) {
auto path = [base::mac::FrameworkBundle() pathForResource:name ofType:@"pak"];
return base::mac::NSStringToFilePath(path);
}
} // namespace } // namespace
void LoadCommonResources() {
ui::ResourceBundle& bundle = ui::ResourceBundle::GetSharedInstance();
bundle.AddDataPackFromPath(GetResourcesPakFilePath(@"content_shell"),
ui::GetSupportedScaleFactors()[0]);
#if defined(ENABLE_PDF_VIEWER)
bundle.AddDataPackFromPath(GetResourcesPakFilePath(@"pdf_viewer_resources"),
ui::GetSupportedScaleFactors()[0]);
#endif // defined(ENABLE_PDF_VIEWER)
}
void MainDelegate::OverrideFrameworkBundlePath() { void MainDelegate::OverrideFrameworkBundlePath() {
base::FilePath helper_path = base::FilePath helper_path =
GetFrameworksPath().Append(GetApplicationName() + " Framework.framework"); GetFrameworksPath().Append(GetApplicationName() + " Framework.framework");

Просмотреть файл

@ -638,8 +638,12 @@
'mac_bundle': 1, 'mac_bundle': 1,
'mac_bundle_resources': [ 'mac_bundle_resources': [
'atom/common/resources/mac/MainMenu.xib', 'atom/common/resources/mac/MainMenu.xib',
'<(libchromiumcontent_dir)/content_shell.pak',
'<(libchromiumcontent_dir)/icudtl.dat', '<(libchromiumcontent_dir)/icudtl.dat',
'<(libchromiumcontent_dir)/blink_image_resources_200_percent.pak',
'<(libchromiumcontent_dir)/content_resources_200_percent.pak',
'<(libchromiumcontent_dir)/content_shell.pak',
'<(libchromiumcontent_dir)/ui_resources_200_percent.pak',
'<(libchromiumcontent_dir)/views_resources_200_percent.pak',
'<(libchromiumcontent_dir)/natives_blob.bin', '<(libchromiumcontent_dir)/natives_blob.bin',
'<(libchromiumcontent_dir)/snapshot_blob.bin', '<(libchromiumcontent_dir)/snapshot_blob.bin',
], ],