diff options
-rw-r--r-- | app/resource_bundle.cc | 14 | ||||
-rw-r--r-- | app/resource_bundle.h | 20 | ||||
-rw-r--r-- | app/resource_bundle_linux.cc | 8 | ||||
-rw-r--r-- | app/resource_bundle_mac.mm | 8 | ||||
-rw-r--r-- | app/resource_bundle_win.cc | 18 | ||||
-rw-r--r-- | app/test_suite.h | 1 | ||||
-rw-r--r-- | chrome/browser/browser_main.cc | 2 | ||||
-rw-r--r-- | chrome/browser/browser_main_mac.mm | 3 | ||||
-rwxr-xr-x | chrome/chrome.gyp | 46 | ||||
-rw-r--r-- | chrome/test/unit/chrome_test_suite.h | 1 | ||||
-rw-r--r-- | chrome/tools/build/win/FILES | 1 | ||||
-rw-r--r-- | chrome_frame/test/net/fake_external_tab.cc | 1 | ||||
-rw-r--r-- | views/examples/examples_main.cc | 1 | ||||
-rw-r--r-- | views/views.gyp | 2 |
14 files changed, 22 insertions, 104 deletions
diff --git a/app/resource_bundle.cc b/app/resource_bundle.cc index a2ebdf0..6d8829d 100644 --- a/app/resource_bundle.cc +++ b/app/resource_bundle.cc @@ -55,8 +55,7 @@ ResourceBundle& ResourceBundle::GetSharedInstance() { ResourceBundle::ResourceBundle() : resources_data_(NULL), - locale_resources_data_(NULL), - theme_data_(NULL) { + locale_resources_data_(NULL) { } void ResourceBundle::FreeImages() { @@ -89,7 +88,7 @@ std::string ResourceBundle::GetDataResource(int resource_id) { RefCountedStaticMemory* ResourceBundle::LoadImageResourceBytes( int resource_id) { - return LoadResourceBytes(theme_data_, resource_id); + return LoadResourceBytes(resources_data_, resource_id); } RefCountedStaticMemory* ResourceBundle::LoadDataResourceBytes( @@ -108,15 +107,10 @@ SkBitmap* ResourceBundle::GetBitmapNamed(int resource_id) { scoped_ptr<SkBitmap> bitmap; - if (theme_data_) - bitmap.reset(LoadBitmap(theme_data_, resource_id)); - - // If we did not find the bitmap in the theme DLL, try the current one. - if (!bitmap.get()) - bitmap.reset(LoadBitmap(resources_data_, resource_id)); + bitmap.reset(LoadBitmap(resources_data_, resource_id)); - // We loaded successfully. Cache the Skia version of the bitmap. if (bitmap.get()) { + // We loaded successfully. Cache the Skia version of the bitmap. AutoLock lock_scope(lock_); // Another thread raced us, and has already cached the skia image. diff --git a/app/resource_bundle.h b/app/resource_bundle.h index a59cbfd..e4819c3 100644 --- a/app/resource_bundle.h +++ b/app/resource_bundle.h @@ -74,13 +74,9 @@ class ResourceBundle { // Return the global resource loader instance. static ResourceBundle& GetSharedInstance(); - // Load the data file that contains theme resources if present. - void LoadThemeResources(); - - // Gets the bitmap with the specified resource_id, first by looking into the - // theme data, then in the current module data if applicable. - // Returns a pointer to a shared instance of the SkBitmap. This shared bitmap - // is owned by the resource bundle and should not be freed. + // Gets the bitmap with the specified resource_id from the current module + // data. Returns a pointer to a shared instance of the SkBitmap. This shared + // bitmap is owned by the resource bundle and should not be freed. // // The bitmap is assumed to exist. This function will log in release, and // assert in debug mode if it does not. On failure, this will return a @@ -116,7 +112,7 @@ class ResourceBundle { const gfx::Font& GetFont(FontStyle style); #if defined(OS_WIN) - // Loads and returns an icon from the theme dll. + // Loads and returns an icon from the app module. HICON LoadThemeIcon(int icon_id); // Loads and returns a cursor from the app module. @@ -125,10 +121,9 @@ class ResourceBundle { // Wrapper for GetBitmapNamed. Converts the bitmap to an autoreleased NSImage. NSImage* GetNSImageNamed(int resource_id); #elif defined(USE_X11) - // Gets the GdkPixbuf with the specified resource_id, first by looking into - // the theme data, than in the current module data if applicable. Returns a - // pointer to a shared instance of the GdkPixbuf. This shared GdkPixbuf is - // owned by the resource bundle and should not be freed. + // Gets the GdkPixbuf with the specified resource_id from the main data pak + // file. Returns a pointer to a shared instance of the GdkPixbuf. This + // shared GdkPixbuf is owned by the resource bundle and should not be freed. // // The bitmap is assumed to exist. This function will log in release, and // assert in debug mode if it does not. On failure, this will return a @@ -203,7 +198,6 @@ class ResourceBundle { // Handles for data sources. DataHandle resources_data_; DataHandle locale_resources_data_; - DataHandle theme_data_; // Cached images. The ResourceBundle caches all retrieved bitmaps and keeps // ownership of the pointers. diff --git a/app/resource_bundle_linux.cc b/app/resource_bundle_linux.cc index 1fe4cb6..99ac0d7 100644 --- a/app/resource_bundle_linux.cc +++ b/app/resource_bundle_linux.cc @@ -69,7 +69,6 @@ ResourceBundle::~ResourceBundle() { locale_resources_data_ = NULL; delete resources_data_; resources_data_ = NULL; - theme_data_ = NULL; } void ResourceBundle::LoadResources(const std::wstring& pref_locale) { @@ -107,13 +106,6 @@ FilePath ResourceBundle::GetLocaleFilePath(const std::wstring& pref_locale) { return locale_path.AppendASCII(app_locale + ".pak"); } -void ResourceBundle::LoadThemeResources() { - // The data has been merged with chrome.pak so just set the pointer to be - // the same file. - DCHECK(resources_data_); - theme_data_ = resources_data_; -} - // static RefCountedStaticMemory* ResourceBundle::LoadResourceBytes( DataHandle module, int resource_id) { diff --git a/app/resource_bundle_mac.mm b/app/resource_bundle_mac.mm index 7a6139f..547c84b 100644 --- a/app/resource_bundle_mac.mm +++ b/app/resource_bundle_mac.mm @@ -26,7 +26,6 @@ ResourceBundle::~ResourceBundle() { locale_resources_data_ = NULL; delete resources_data_; resources_data_ = NULL; - theme_data_ = NULL; } namespace { @@ -64,13 +63,6 @@ void ResourceBundle::LoadResources(const std::wstring& pref_locale) { DCHECK(locale_resources_data_) << "failed to load locale.pak"; } -void ResourceBundle::LoadThemeResources() { - // The data has been merged with chrome.pak so just set the pointer to be - // the same file. - DCHECK(resources_data_); - theme_data_ = resources_data_; -} - // static RefCountedStaticMemory* ResourceBundle::LoadResourceBytes( DataHandle module, int resource_id) { diff --git a/app/resource_bundle_win.cc b/app/resource_bundle_win.cc index 0c25c47..63645d4 100644 --- a/app/resource_bundle_win.cc +++ b/app/resource_bundle_win.cc @@ -36,10 +36,6 @@ ResourceBundle::~ResourceBundle() { BOOL rv = FreeLibrary(locale_resources_data_); DCHECK(rv); } - if (theme_data_) { - BOOL rv = FreeLibrary(theme_data_); - DCHECK(rv); - } } void ResourceBundle::LoadResources(const std::wstring& pref_locale) { @@ -73,18 +69,6 @@ FilePath ResourceBundle::GetLocaleFilePath(const std::wstring& pref_locale) { return locale_path.AppendASCII(app_locale + ".dll"); } -void ResourceBundle::LoadThemeResources() { - DCHECK(NULL == theme_data_) << "theme dll already loaded"; - FilePath theme_data_path; - PathService::Get(app::DIR_THEMES, &theme_data_path); - theme_data_path = theme_data_path.AppendASCII("default.dll"); - - // The dll should only have resources, not executable code. - theme_data_ = LoadLibraryEx(theme_data_path.value().c_str(), NULL, - GetDataDllLoadFlags()); - DCHECK(theme_data_ != NULL) << "unable to load " << theme_data_path.value(); -} - // static RefCountedStaticMemory* ResourceBundle::LoadResourceBytes( DataHandle module, int resource_id) { @@ -100,7 +84,7 @@ RefCountedStaticMemory* ResourceBundle::LoadResourceBytes( } HICON ResourceBundle::LoadThemeIcon(int icon_id) { - return ::LoadIcon(theme_data_, MAKEINTRESOURCE(icon_id)); + return ::LoadIcon(resources_data_, MAKEINTRESOURCE(icon_id)); } base::StringPiece ResourceBundle::GetRawDataResource(int resource_id) { diff --git a/app/test_suite.h b/app/test_suite.h index 038d4a7..4826b4f 100644 --- a/app/test_suite.h +++ b/app/test_suite.h @@ -52,7 +52,6 @@ class AppTestSuite : public TestSuite { // Force unittests to run using en-US so if we test against string // output, it'll pass regardless of the system language. ResourceBundle::InitSharedInstance(L"en-US"); - ResourceBundle::GetSharedInstance().LoadThemeResources(); } virtual void Shutdown() { diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc index a3e5f8b..1509b24 100644 --- a/chrome/browser/browser_main.cc +++ b/chrome/browser/browser_main.cc @@ -461,8 +461,6 @@ int BrowserMain(const MainFunctionParams& parameters) { if (!parameters.ui_task) { ResourceBundle::InitSharedInstance( local_state->GetString(prefs::kApplicationLocale)); - // We only load the theme dll in the browser process. - ResourceBundle::GetSharedInstance().LoadThemeResources(); } #endif // !defined(OS_MACOSX) diff --git a/chrome/browser/browser_main_mac.mm b/chrome/browser/browser_main_mac.mm index 8ed837f..ce5893b 100644 --- a/chrome/browser/browser_main_mac.mm +++ b/chrome/browser/browser_main_mac.mm @@ -42,9 +42,6 @@ void WillInitializeMainMessageLoop(const MainFunctionParams& parameters) { // the strings avaiable for localization. if (!parameters.ui_task) { ResourceBundle::InitSharedInstance(std::wstring()); - // We only load the theme resources in the browser process, since this is - // the browser process, load them. - ResourceBundle::GetSharedInstance().LoadThemeResources(); } // Now load the nib. [NSBundle loadNibNamed:@"MainMenu" owner:NSApp]; diff --git a/chrome/chrome.gyp b/chrome/chrome.gyp index 9114d88..ca58620 100755 --- a/chrome/chrome.gyp +++ b/chrome/chrome.gyp @@ -4821,9 +4821,11 @@ # their various targets (net.gyp:net_resources, etc.), # but that causes errors in other targets when # resulting .res files get referenced multiple times. + '<(SHARED_INTERMEDIATE_DIR)/app/app_resources.rc', '<(SHARED_INTERMEDIATE_DIR)/chrome/browser_resources.rc', '<(SHARED_INTERMEDIATE_DIR)/chrome/common_resources.rc', '<(SHARED_INTERMEDIATE_DIR)/chrome/renderer_resources.rc', + '<(SHARED_INTERMEDIATE_DIR)/chrome/theme_resources.rc', '<(SHARED_INTERMEDIATE_DIR)/net/net_resources.rc', '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_resources.rc', ], @@ -5525,7 +5527,6 @@ 'chrome_dll_version', 'chrome_resources', 'installer/installer.gyp:installer_util_strings', - 'theme_dll', 'worker', '../printing/printing.gyp:printing', '../net/net.gyp:net_resources', @@ -5561,9 +5562,11 @@ # their various targets (net.gyp:net_resources, etc.), # but that causes errors in other targets when # resulting .res files get referenced multiple times. + '<(SHARED_INTERMEDIATE_DIR)/app/app_resources.rc', '<(SHARED_INTERMEDIATE_DIR)/chrome/browser_resources.rc', '<(SHARED_INTERMEDIATE_DIR)/chrome/common_resources.rc', '<(SHARED_INTERMEDIATE_DIR)/chrome/renderer_resources.rc', + '<(SHARED_INTERMEDIATE_DIR)/chrome/theme_resources.rc', '<(SHARED_INTERMEDIATE_DIR)/net/net_resources.rc', '<(SHARED_INTERMEDIATE_DIR)/webkit/webkit_resources.rc', @@ -6567,9 +6570,11 @@ 'test/ui_test_utils_win.cc', 'test/data/resource.h', 'test/data/resource.rc', + '<(SHARED_INTERMEDIATE_DIR)/app/app_resources.rc', '<(SHARED_INTERMEDIATE_DIR)/chrome/browser_resources.rc', '<(SHARED_INTERMEDIATE_DIR)/chrome_dll_version/chrome_dll_version.rc', '<(SHARED_INTERMEDIATE_DIR)/chrome/common_resources.rc', + '<(SHARED_INTERMEDIATE_DIR)/chrome/theme_resources.rc', ], 'conditions': [ # Plugin code. @@ -6657,9 +6662,11 @@ 'app/chrome_dll.rc', 'app/chrome_dll_resource.h', 'app/chrome_dll_version.rc.version', + '<(SHARED_INTERMEDIATE_DIR)/app/app_resources.rc', '<(SHARED_INTERMEDIATE_DIR)/chrome/browser_resources.rc', '<(SHARED_INTERMEDIATE_DIR)/chrome_dll_version/chrome_dll_version.rc', '<(SHARED_INTERMEDIATE_DIR)/chrome/common_resources.rc', + '<(SHARED_INTERMEDIATE_DIR)/chrome/theme_resources.rc', # browser_tests_sources and browser_tests_source_win_specific are # defined in 'variables' at the top of the file. '<@(browser_tests_sources)', @@ -6870,43 +6877,6 @@ 'test/chrome_plugin/test_chrome_plugin.h', ], }, - { - 'target_name': 'theme_dll', - 'type': 'loadable_module', - 'msvs_guid': 'FD683DD6-D9BF-4B1B-AB6D-A3AC03EDAA4D', - 'product_name': 'default', - 'dependencies': [ - 'theme_resources', - '../app/app.gyp:app_resources', - ], - 'sources': [ - '<(grit_out_dir)/theme_resources.rc', - '<(SHARED_INTERMEDIATE_DIR)/app/app_resources.rc', - ], - 'msvs_settings': { - 'VCLinkerTool': { - 'BaseAddress': '0x3CE00000', - 'OutputFile': '<(PRODUCT_DIR)/themes/default.dll', - 'ResourceOnlyDLL': 'true', - }, - }, - 'configurations': { - 'Debug': { - 'msvs_settings': { - 'VCLinkerTool': { - 'LinkIncremental': '<(msvs_large_module_debug_link_mode)', - }, - }, - }, - 'Release': { - 'msvs_settings': { - 'VCLinkerTool': { - 'LinkTimeCodeGeneration': '1', - }, - }, - } - }, - }, ]}, # 'targets' ], # OS=="win" # TODO(jrg): add in Windows code coverage targets. diff --git a/chrome/test/unit/chrome_test_suite.h b/chrome/test/unit/chrome_test_suite.h index 43c7de0..178b62a 100644 --- a/chrome/test/unit/chrome_test_suite.h +++ b/chrome/test/unit/chrome_test_suite.h @@ -108,7 +108,6 @@ class ChromeTestSuite : public TestSuite { // Force unittests to run using en-US so if we test against string // output, it'll pass regardless of the system language. ResourceBundle::InitSharedInstance(L"en-US"); - ResourceBundle::GetSharedInstance().LoadThemeResources(); // initialize the global StatsTable for unit_tests std::string statsfile = "unit_tests"; diff --git a/chrome/tools/build/win/FILES b/chrome/tools/build/win/FILES index 1ef58f1..c8de19c 100644 --- a/chrome/tools/build/win/FILES +++ b/chrome/tools/build/win/FILES @@ -57,7 +57,6 @@ locales/uk.dll locales/vi.dll locales/zh-CN.dll locales/zh-TW.dll -themes/default.dll resources rlz.dll wow_helper.exe diff --git a/chrome_frame/test/net/fake_external_tab.cc b/chrome_frame/test/net/fake_external_tab.cc index 63ddf87..5168372 100644 --- a/chrome_frame/test/net/fake_external_tab.cc +++ b/chrome_frame/test/net/fake_external_tab.cc @@ -105,7 +105,6 @@ void FakeExternalTab::Initialize() { app::RegisterPathProvider(); ResourceBundle::InitSharedInstance(L"en-US"); - ResourceBundle::GetSharedInstance().LoadThemeResources(); const CommandLine* cmd = CommandLine::ForCurrentProcess(); browser_process_.reset(new BrowserProcessImpl(*cmd)); diff --git a/views/examples/examples_main.cc b/views/examples/examples_main.cc index 2dc6c96..d061871 100644 --- a/views/examples/examples_main.cc +++ b/views/examples/examples_main.cc @@ -45,7 +45,6 @@ void ExamplesMain::Run() { // This requires chrome to be built first right now. // TODO(oshima): fix build to include resource file. ResourceBundle::InitSharedInstance(L"en-US"); - ResourceBundle::GetSharedInstance().LoadThemeResources(); MessageLoop main_message_loop(MessageLoop::TYPE_UI); diff --git a/views/views.gyp b/views/views.gyp index 7074cf9..4e86d4d 100644 --- a/views/views.gyp +++ b/views/views.gyp @@ -361,6 +361,8 @@ 'examples/scroll_view_example.h', 'examples/tabbed_pane_example.h', 'examples/textfield_example.h', + + '<(SHARED_INTERMEDIATE_DIR)/app/app_resources.rc', ], 'conditions': [ ['OS=="linux"', { |