From cf1009ab3019a7119aefbd3b5b65d3be57735efe Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Sat, 12 Jul 2014 21:16:13 +0800 Subject: [PATCH] Refactor the AddPakPaths to make it possible to set pak's scale factor. This is needed when adding high DPI resources. --- brightray/common/main_delegate.cc | 8 +------- brightray/common/main_delegate.h | 9 ++++++--- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/brightray/common/main_delegate.cc b/brightray/common/main_delegate.cc index ea0cbdddb5a4..cf0a16fb2732 100644 --- a/brightray/common/main_delegate.cc +++ b/brightray/common/main_delegate.cc @@ -49,13 +49,7 @@ void MainDelegate::InitializeResourceBundle() { #endif ui::ResourceBundle::InitSharedInstanceWithPakPath(path); - - std::vector 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); - } + AddDataPackFromPath(&ui::ResourceBundle::GetSharedInstance(), path.DirName()); } content::ContentBrowserClient* MainDelegate::CreateContentBrowserClient() { diff --git a/brightray/common/main_delegate.h b/brightray/common/main_delegate.h index 1a6b243a4080..7cfd7758d913 100644 --- a/brightray/common/main_delegate.h +++ b/brightray/common/main_delegate.h @@ -5,8 +5,6 @@ #ifndef BRIGHTRAY_COMMON_MAIN_DELEGATE_H_ #define BRIGHTRAY_COMMON_MAIN_DELEGATE_H_ -#include - #include "base/compiler_specific.h" #include "base/memory/scoped_ptr.h" #include "content/public/app/content_main_delegate.h" @@ -15,6 +13,10 @@ namespace base { class FilePath; } +namespace ui { +class ResourceBundle; +} + namespace brightray { class BrowserClient; @@ -36,7 +38,8 @@ class MainDelegate : public content::ContentMainDelegate { // Subclasses can override this to provide additional .pak files to be // included in the ui::ResourceBundle. - virtual void AddPakPaths(std::vector* pak_paths) {} + virtual void AddDataPackFromPath( + ui::ResourceBundle* bundle, const base::FilePath& pak_dir) {} #if defined(OS_MACOSX) // Subclasses can override this to custom the paths of child process and