mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
Allow embedders to specify extra .pak files
This commit is contained in:
@@ -8,6 +8,11 @@
|
||||
#include "base/compiler_specific.h"
|
||||
#include "base/memory/scoped_ptr.h"
|
||||
#include "content/public/app/content_main_delegate.h"
|
||||
#include <vector>
|
||||
|
||||
namespace base {
|
||||
class FilePath;
|
||||
}
|
||||
|
||||
namespace brightray {
|
||||
|
||||
@@ -22,11 +27,14 @@ protected:
|
||||
// Subclasses can override this to provide their own ContentClient implementation.
|
||||
virtual scoped_ptr<ContentClient> CreateContentClient();
|
||||
|
||||
// Subclasses can override this to provide additional .pak files to be included in the ui::ResourceBundle.
|
||||
virtual void AddPakPaths(std::vector<base::FilePath>* pak_paths) {}
|
||||
|
||||
virtual bool BasicStartupComplete(int* exit_code) OVERRIDE;
|
||||
virtual void PreSandboxStartup() OVERRIDE;
|
||||
|
||||
private:
|
||||
static void InitializeResourceBundle();
|
||||
void InitializeResourceBundle();
|
||||
#if defined(OS_MACOSX)
|
||||
static void OverrideChildProcessPath();
|
||||
static void OverrideFrameworkBundlePath();
|
||||
|
||||
@@ -28,6 +28,11 @@ void MainDelegate::InitializeResourceBundle() {
|
||||
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);
|
||||
}
|
||||
|
||||
void MainDelegate::OverrideFrameworkBundlePath() {
|
||||
|
||||
Reference in New Issue
Block a user