Set up the resource bundle on Windows
This commit is contained in:
parent
3713ea6403
commit
f2909b0d90
3 changed files with 25 additions and 11 deletions
|
@ -8,7 +8,9 @@
|
|||
#include "common/content_client.h"
|
||||
|
||||
#include "base/command_line.h"
|
||||
#include "base/path_service.h"
|
||||
#include "content/public/common/content_switches.h"
|
||||
#include "ui/base/resource/resource_bundle.h"
|
||||
|
||||
namespace brightray {
|
||||
|
||||
|
@ -32,8 +34,26 @@ void MainDelegate::PreSandboxStartup() {
|
|||
#if defined(OS_MACOSX)
|
||||
OverrideChildProcessPath();
|
||||
OverrideFrameworkBundlePath();
|
||||
InitializeResourceBundle();
|
||||
#endif
|
||||
InitializeResourceBundle();
|
||||
}
|
||||
|
||||
void MainDelegate::InitializeResourceBundle() {
|
||||
base::FilePath path;
|
||||
#if defined(OS_MACOSX)
|
||||
path = GetResourcesPakFilePath();
|
||||
#else
|
||||
base::FilePath pak_dir;
|
||||
PathService::Get(base::DIR_MODULE, &pak_dir);
|
||||
path = pak_dir.Append(FILE_PATH_LITERAL("content_shell.pak"));
|
||||
#endif
|
||||
|
||||
ui::ResourceBundle::InitSharedInstanceWithPakPath(path);
|
||||
|
||||
std::vector<base::FilePath> pak_paths;
|
||||
AddPakPaths(&pak_paths);
|
||||
for (auto it = pak_paths.begin(), end = pak_paths.end(); it != end; ++it)
|
||||
ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath(*it, ui::SCALE_FACTOR_NONE);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -34,8 +34,9 @@ protected:
|
|||
virtual void PreSandboxStartup() OVERRIDE;
|
||||
|
||||
private:
|
||||
#if defined(OS_MACOSX)
|
||||
void InitializeResourceBundle();
|
||||
#if defined(OS_MACOSX)
|
||||
static base::FilePath GetResourcesPakFilePath();
|
||||
static void OverrideChildProcessPath();
|
||||
static void OverrideFrameworkBundlePath();
|
||||
#endif
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include "base/mac/bundle_locations.h"
|
||||
#include "base/path_service.h"
|
||||
#include "content/public/common/content_paths.h"
|
||||
#include "ui/base/resource/resource_bundle.h"
|
||||
|
||||
namespace brightray {
|
||||
|
||||
|
@ -24,15 +23,9 @@ base::FilePath GetFrameworksPath() {
|
|||
|
||||
}
|
||||
|
||||
void MainDelegate::InitializeResourceBundle() {
|
||||
base::FilePath MainDelegate::GetResourcesPakFilePath() {
|
||||
auto path = [base::mac::FrameworkBundle() pathForResource:@"content_shell" ofType:@"pak"];
|
||||
|
||||
ui::ResourceBundle::InitSharedInstanceWithPakPath(base::mac::NSStringToFilePath(path));
|
||||
|
||||
std::vector<base::FilePath> pak_paths;
|
||||
AddPakPaths(&pak_paths);
|
||||
for (const auto& path : pak_paths)
|
||||
ui::ResourceBundle::GetSharedInstance().AddDataPackFromPath(path, ui::SCALE_FACTOR_NONE);
|
||||
return base::mac::NSStringToFilePath(path);
|
||||
}
|
||||
|
||||
void MainDelegate::OverrideFrameworkBundlePath() {
|
||||
|
|
Loading…
Reference in a new issue