diff options
author | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-13 01:52:59 +0000 |
---|---|---|
committer | evan@chromium.org <evan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-01-13 01:52:59 +0000 |
commit | 11c2fe82bca2cd871eeb7aff77043754ef75651a (patch) | |
tree | 0fbe3ff9d607c63dd95907f7d9fcb0ad71b39683 /chrome | |
parent | 1d8c3419fd7f42b045dde9ddf301babd5d5ae947 (diff) | |
download | chromium_src-11c2fe82bca2cd871eeb7aff77043754ef75651a.zip chromium_src-11c2fe82bca2cd871eeb7aff77043754ef75651a.tar.gz chromium_src-11c2fe82bca2cd871eeb7aff77043754ef75651a.tar.bz2 |
Refactor resource_bundle into a _win file.
Linux changes forthcoming.
Review URL: http://codereview.chromium.org/17472
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@7914 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/common/common.scons | 1 | ||||
-rw-r--r-- | chrome/common/common.vcproj | 4 | ||||
-rw-r--r-- | chrome/common/resource_bundle.cc | 194 | ||||
-rw-r--r-- | chrome/common/resource_bundle.h | 104 | ||||
-rw-r--r-- | chrome/common/resource_bundle_win.cc | 173 | ||||
-rw-r--r-- | chrome/renderer/webplugin_delegate_proxy.cc | 4 |
6 files changed, 255 insertions, 225 deletions
diff --git a/chrome/common/common.scons b/chrome/common/common.scons index 7f06408..57f976e 100644 --- a/chrome/common/common.scons +++ b/chrome/common/common.scons @@ -116,6 +116,7 @@ if env.Bit('windows'): input_files.extend([ 'gfx/chrome_font_win.cc', 'ipc_channel_win.cc', + 'resource_bundle_win.cc', ]) elif env.Bit('linux'): input_files.extend([ diff --git a/chrome/common/common.vcproj b/chrome/common/common.vcproj index b77f596..b340897 100644 --- a/chrome/common/common.vcproj +++ b/chrome/common/common.vcproj @@ -614,6 +614,10 @@ > </File> <File + RelativePath=".\resource_bundle_win.cc" + > + </File> + <File RelativePath=".\resource_dispatcher.cc" > </File> diff --git a/chrome/common/resource_bundle.cc b/chrome/common/resource_bundle.cc index c7cbad1..ed15af8 100644 --- a/chrome/common/resource_bundle.cc +++ b/chrome/common/resource_bundle.cc @@ -6,33 +6,12 @@ #include <atlbase.h> -#include "base/file_util.h" #include "base/gfx/png_decoder.h" #include "base/logging.h" -#include "base/path_service.h" -#include "base/resource_util.h" -#include "base/scoped_ptr.h" -#include "base/string_piece.h" -#include "base/string_util.h" -#include "base/win_util.h" -#include "chrome/app/chrome_dll_resource.h" -#include "chrome/common/chrome_paths.h" #include "chrome/common/gfx/chrome_font.h" -#include "chrome/common/l10n_util.h" -#include "chrome/common/win_util.h" #include "SkBitmap.h" -using namespace std; - -ResourceBundle *ResourceBundle::g_shared_instance_ = NULL; - -// Returns the flags that should be passed to LoadLibraryEx. -DWORD GetDataDllLoadFlags() { - if (win_util::GetWinVersion() >= win_util::WINVERSION_VISTA) - return LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE | LOAD_LIBRARY_AS_IMAGE_RESOURCE; - - return DONT_RESOLVE_DLL_REFERENCES; -} +ResourceBundle* ResourceBundle::g_shared_instance_ = NULL; /* static */ void ResourceBundle::InitSharedInstance(const std::wstring& pref_locale) { @@ -58,85 +37,31 @@ ResourceBundle& ResourceBundle::GetSharedInstance() { } ResourceBundle::ResourceBundle() - : locale_resources_dll_(NULL), - theme_dll_(NULL) { + : locale_resources_data_(NULL), + theme_data_(NULL) { } -ResourceBundle::~ResourceBundle() { +void ResourceBundle::FreeImages() { for (SkImageMap::iterator i = skia_images_.begin(); - i != skia_images_.end(); i++) { + i != skia_images_.end(); i++) { delete i->second; } skia_images_.clear(); - - if (locale_resources_dll_) { - BOOL rv = FreeLibrary(locale_resources_dll_); - DCHECK(rv); - } - if (theme_dll_) { - BOOL rv = FreeLibrary(theme_dll_); - DCHECK(rv); - } -} - -void ResourceBundle::LoadLocaleResources(const std::wstring& pref_locale) { - DCHECK(NULL == locale_resources_dll_) << "locale dll already loaded"; - const std::wstring& locale_path = GetLocaleDllPath(pref_locale); - if (locale_path.empty()) { - // It's possible that there are no locale dlls found, in which case we just - // return. - NOTREACHED(); - return; - } - - // The dll should only have resources, not executable code. - locale_resources_dll_ = LoadLibraryEx(locale_path.c_str(), NULL, - GetDataDllLoadFlags()); - DCHECK(locale_resources_dll_ != NULL) << "unable to load generated resources"; -} - -std::wstring ResourceBundle::GetLocaleDllPath(const std::wstring& pref_locale) { - std::wstring locale_path; - PathService::Get(chrome::DIR_LOCALES, &locale_path); - - const std::wstring app_locale = l10n_util::GetApplicationLocale(pref_locale); - if (app_locale.empty()) - return app_locale; - - file_util::AppendToPath(&locale_path, app_locale + L".dll"); - return locale_path; -} - -void ResourceBundle::LoadThemeResources() { - DCHECK(NULL == theme_dll_) << "theme dll already loaded"; - std::wstring theme_dll_path; - PathService::Get(chrome::DIR_THEMES, &theme_dll_path); - file_util::AppendToPath(&theme_dll_path, L"default.dll"); - - // The dll should only have resources, not executable code. - theme_dll_ = LoadLibraryEx(theme_dll_path.c_str(), NULL, - GetDataDllLoadFlags()); - DCHECK(theme_dll_ != NULL) << "unable to load " << theme_dll_path; } /* static */ -SkBitmap* ResourceBundle::LoadBitmap(HINSTANCE dll_inst, int resource_id) { - void* data_ptr = NULL; - size_t data_size; - bool success = base::GetDataResourceFromModule(dll_inst, resource_id, - &data_ptr, &data_size); +SkBitmap* ResourceBundle::LoadBitmap(DataHandle data_handle, int resource_id) { + std::vector<unsigned char> raw_data, png_data; + bool success = LoadResourceBytes(data_handle, resource_id, &raw_data); if (!success) return NULL; - unsigned char* data = static_cast<unsigned char*>(data_ptr); - // Decode the PNG. - vector<unsigned char> png_data; int image_width; int image_height; - if (!PNGDecoder::Decode(data, data_size, PNGDecoder::FORMAT_BGRA, + if (!PNGDecoder::Decode(&raw_data.front(), raw_data.size(), PNGDecoder::FORMAT_BGRA, &png_data, &image_width, &image_height)) { - NOTREACHED() << "Unable to decode theme resource " << resource_id; + NOTREACHED() << "Unable to decode image resource " << resource_id; return NULL; } @@ -156,13 +81,15 @@ SkBitmap* ResourceBundle::GetBitmapNamed(int resource_id) { scoped_ptr<SkBitmap> bitmap; - // Try to load the bitmap from the theme dll. - if (theme_dll_) - bitmap.reset(LoadBitmap(theme_dll_, resource_id)); + // Try to load the bitmap from the theme data. + if (theme_data_) + bitmap.reset(LoadBitmap(theme_data_, resource_id)); +#if defined(OS_WIN) // If we did not find the bitmap in the theme DLL, try the current one. if (!bitmap.get()) bitmap.reset(LoadBitmap(_AtlBaseModule.GetModuleInstance(), resource_id)); +#endif // We loaded successfully. Cache the Skia version of the bitmap. if (bitmap.get()) { @@ -196,96 +123,6 @@ SkBitmap* ResourceBundle::GetBitmapNamed(int resource_id) { } } -bool ResourceBundle::LoadImageResourceBytes(int resource_id, - vector<unsigned char>* bytes) { - return LoadModuleResourceBytes(theme_dll_, resource_id, bytes); -} - -bool ResourceBundle::LoadDataResourceBytes(int resource_id, - vector<unsigned char>* bytes) { - return LoadModuleResourceBytes(_AtlBaseModule.GetModuleInstance(), - resource_id, bytes); -} - -bool ResourceBundle::LoadModuleResourceBytes( - HINSTANCE module, - int resource_id, - std::vector<unsigned char>* bytes) { - void* data_ptr; - size_t data_size; - if (base::GetDataResourceFromModule(module, resource_id, &data_ptr, - &data_size)) { - bytes->resize(data_size); - memcpy(&(bytes->front()), data_ptr, data_size); - return true; - } else { - return false; - } -} - -HICON ResourceBundle::LoadThemeIcon(int icon_id) { - return ::LoadIcon(theme_dll_, MAKEINTRESOURCE(icon_id)); -} - -std::string ResourceBundle::GetDataResource(int resource_id) { - return GetRawDataResource(resource_id).as_string(); -} - -StringPiece ResourceBundle::GetRawDataResource(int resource_id) { - void* data_ptr; - size_t data_size; - if (base::GetDataResourceFromModule(_AtlBaseModule.GetModuleInstance(), - resource_id, - &data_ptr, - &data_size)) { - return StringPiece(static_cast<const char*>(data_ptr), data_size); - } else if (locale_resources_dll_ && - base::GetDataResourceFromModule(locale_resources_dll_, - resource_id, - &data_ptr, - &data_size)) { - return StringPiece(static_cast<const char*>(data_ptr), data_size); - } - return StringPiece(); -} -// Loads and returns the global accelerators from the current module. -HACCEL ResourceBundle::GetGlobalAccelerators() { - return ::LoadAccelerators(_AtlBaseModule.GetModuleInstance(), - MAKEINTRESOURCE(IDR_MAINFRAME)); -} - -// Loads and returns a cursor from the current module. -HCURSOR ResourceBundle::LoadCursor(int cursor_id) { - return ::LoadCursor(_AtlBaseModule.GetModuleInstance(), - MAKEINTRESOURCE(cursor_id)); -} - -std::wstring ResourceBundle::GetLocalizedString(int message_id) { - // If for some reason we were unable to load a resource dll, return an empty - // string (better than crashing). - if (!locale_resources_dll_) - return std::wstring(); - - DCHECK(IS_INTRESOURCE(message_id)); - - // Get a reference directly to the string resource. - HINSTANCE hinstance = locale_resources_dll_; - const ATLSTRINGRESOURCEIMAGE* image = AtlGetStringResourceImage(hinstance, - message_id); - if (!image) { - // Fall back on the current module (shouldn't be any strings here except - // in unittests). - image = AtlGetStringResourceImage(_AtlBaseModule.GetModuleInstance(), - message_id); - if (!image) { - NOTREACHED() << "unable to find resource: " << message_id; - return std::wstring(); - } - } - // Copy into a wstring and return. - return std::wstring(image->achString, image->nLength); -} - void ResourceBundle::LoadFontsIfNecessary() { AutoLock lock_scope(lock_); if (!base_font_.get()) { @@ -327,4 +164,3 @@ ChromeFont ResourceBundle::GetFont(FontStyle style) { return *base_font_; } } - diff --git a/chrome/common/resource_bundle.h b/chrome/common/resource_bundle.h index 9d7a65f..9feff10 100644 --- a/chrome/common/resource_bundle.h +++ b/chrome/common/resource_bundle.h @@ -5,28 +5,27 @@ #ifndef CHROME_COMMON_RESOURCE_BUNDLE_H__ #define CHROME_COMMON_RESOURCE_BUNDLE_H__ +#include "build/build_config.h" + +#if defined(OS_WIN) #include <windows.h> +#endif + #include <map> #include <string> #include "base/basictypes.h" +#include "base/file_path.h" #include "base/lock.h" #include "base/scoped_ptr.h" -#include "chrome/common/ref_counted_util.h" class ChromeFont; class SkBitmap; class StringPiece; -//////////////////////////////////////////////////////////////////////////////// -// -// ResourceBundle class -// -// ResourceBundle is a central facility to load images and other resources. -// -// Every resource is loaded only once -// -//////////////////////////////////////////////////////////////////////////////// +// ResourceBundle is a central facility to load images and other resources, +// such as theme graphics. +// Every resource is loaded only once. class ResourceBundle { public: // An enumeration of the various font styles used throughout Chrome. @@ -36,29 +35,29 @@ class ResourceBundle { SmallFont, BaseFont, MediumFont, - // NOTE: depending upon the locale, this may *not* result in a bold - // font. + // NOTE: depending upon the locale, this may *not* result in a bold font. MediumBoldFont, LargeFont, WebFont }; - // Initialize the ResrouceBundle for this process. + // Initialize the ResourceBundle for this process. static void InitSharedInstance(const std::wstring& pref_locale); // Delete the ResourceBundle for this process if it exists. static void CleanupSharedInstance(); - // Return the global resource loader instance; + // Return the global resource loader instance. static ResourceBundle& GetSharedInstance(); - // Load the dll that contains theme resources if present. + // 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 dll, than in the current dll. Returns a pointer to a shared instance - // of the SkBitmap in the given out parameter. This shared bitmap is owned by - // the resource bundle and should not be freed. + // theme data, than in the current module data if applicable. + // Returns a pointer to a shared instance of the SkBitmap in the given out + // parameter. 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 @@ -78,23 +77,16 @@ class ResourceBundle { bool LoadDataResourceBytes(int resource_id, std::vector<unsigned char>* bytes); - // Loads and returns an icon from the theme dll. - HICON LoadThemeIcon(int icon_id); - // Return the contents of a file in a string given the resource id. // This will copy the data from the resource and return it as a string. + // TODO(port): deprecate this and replace with GetRawDataResource to avoid + // needless copying. std::string GetDataResource(int resource_id); // Like GetDataResource(), but avoids copying the resource. Instead, it // returns a StringPiece which points into the actual resource in the image. StringPiece GetRawDataResource(int resource_id); - // Loads and returns the global accelerators. - HACCEL GetGlobalAccelerators(); - - // Loads and returns a cursor from the app module. - HCURSOR LoadCursor(int cursor_id); - // Get a localized string given a message id. Returns an empty // string if the message_id is not found. std::wstring GetLocalizedString(int message_id); @@ -102,40 +94,64 @@ class ResourceBundle { // Returns the font for the specified style. ChromeFont GetFont(FontStyle style); - // Creates and returns a new SkBitmap given the dll to look in and the - // resource id. It's up to the caller to free the returned bitmap when - // done. - static SkBitmap* LoadBitmap(HINSTANCE dll_inst, int resource_id); +#if defined(OS_WIN) + // Loads and returns an icon from the theme dll. + HICON LoadThemeIcon(int icon_id); + + // Loads and returns the global accelerators. + HACCEL GetGlobalAccelerators(); + + // Loads and returns a cursor from the app module. + HCURSOR LoadCursor(int cursor_id); +#endif // OS_WIN private: + // We define a DataHandle typedef to abstract across how data is stored + // across platforms. +#if defined(OS_WIN) + // Windows stores resources in DLLs, which are managed by HINSTANCE. + typedef HINSTANCE DataHandle; +#elif defined(OS_LINUX) + // Linux will use base::DataPack. TODO(evanm): finish this. + typedef base::DataPack* DataHandle; +#endif + + // Ctor/dtor are private, since we're a singleton. ResourceBundle(); ~ResourceBundle(); - // Try to load the locale specific strings from an external DLL. + // Free skia_images_. + void FreeImages(); + + // Try to load the locale specific strings from an external data module. void LoadLocaleResources(const std::wstring& pref_locale); + // Initialize all the ChromeFont members if they haven't yet been initialized. void LoadFontsIfNecessary(); - // Returns the full pathname of the locale dll to load. May return an empty - // string if no locale dlls are found. - std::wstring GetLocaleDllPath(const std::wstring& pref_locale); + // Returns the full pathname of the locale file to load. May return an empty + // string if no locale data files are found. + FilePath GetLocaleFilePath(const std::wstring& pref_locale); // Loads the raw bytes of a resource from |module| into |bytes|, // without doing any processing or interpretation of // the resource. Returns whether we successfully read the resource. - bool LoadModuleResourceBytes(HINSTANCE module, - int resource_id, - std::vector<unsigned char>* bytes); + static bool LoadResourceBytes(DataHandle module, + int resource_id, + std::vector<unsigned char>* bytes); + + // Creates and returns a new SkBitmap given the data file to look in and the + // resource id. It's up to the caller to free the returned bitmap when + // done. + static SkBitmap* LoadBitmap(DataHandle dll_inst, int resource_id); // Class level lock. Used to protect internal data structures that may be // accessed from other threads (e.g., skia_images_). Lock lock_; - std::wstring theme_path_; - - // Handle to dlls - HINSTANCE locale_resources_dll_; - HINSTANCE theme_dll_; + // Handles for data sources. + DataHandle locale_resources_data_; + DataHandle theme_data_; // Cached images. The ResourceBundle caches all retrieved bitmaps and keeps // ownership of the pointers. @@ -150,7 +166,7 @@ class ResourceBundle { scoped_ptr<ChromeFont> large_font_; scoped_ptr<ChromeFont> web_font_; - static ResourceBundle *g_shared_instance_; + static ResourceBundle* g_shared_instance_; DISALLOW_EVIL_CONSTRUCTORS(ResourceBundle); }; diff --git a/chrome/common/resource_bundle_win.cc b/chrome/common/resource_bundle_win.cc new file mode 100644 index 0000000..cebd780 --- /dev/null +++ b/chrome/common/resource_bundle_win.cc @@ -0,0 +1,173 @@ +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/common/resource_bundle.h" + +#include <atlbase.h> + +#include "base/file_util.h" +#include "base/logging.h" +#include "base/path_service.h" +#include "base/resource_util.h" +#include "base/string_piece.h" +#include "base/win_util.h" +#include "chrome/app/chrome_dll_resource.h" +#include "chrome/common/chrome_paths.h" +#include "chrome/common/gfx/chrome_font.h" +#include "chrome/common/l10n_util.h" + +namespace { + +// Returns the flags that should be passed to LoadLibraryEx. +DWORD GetDataDllLoadFlags() { + if (win_util::GetWinVersion() >= win_util::WINVERSION_VISTA) + return LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE | LOAD_LIBRARY_AS_IMAGE_RESOURCE; + + return DONT_RESOLVE_DLL_REFERENCES; +} + +} // end anonymous namespace + +ResourceBundle::~ResourceBundle() { + FreeImages(); + + if (locale_resources_data_) { + BOOL rv = FreeLibrary(locale_resources_data_); + DCHECK(rv); + } + if (theme_data_) { + BOOL rv = FreeLibrary(theme_data_); + DCHECK(rv); + } +} + +void ResourceBundle::LoadLocaleResources(const std::wstring& pref_locale) { + DCHECK(NULL == locale_resources_data_) << "locale dll already loaded"; + const FilePath& locale_path = GetLocaleFilePath(pref_locale); + if (locale_path.value().empty()) { + // It's possible that there are no locale dlls found, in which case we just + // return. + NOTREACHED(); + return; + } + + // The dll should only have resources, not executable code. + locale_resources_data_ = LoadLibraryEx(locale_path.value().c_str(), NULL, + GetDataDllLoadFlags()); + DCHECK(locale_resources_data_ != NULL) << "unable to load generated resources"; +} + +FilePath ResourceBundle::GetLocaleFilePath(const std::wstring& pref_locale) { + FilePath locale_path; + PathService::Get(chrome::DIR_LOCALES, &locale_path); + + const std::wstring app_locale = l10n_util::GetApplicationLocale(pref_locale); + if (app_locale.empty()) + return FilePath(app_locale); + + return locale_path.Append(app_locale + L".dll"); +} + +void ResourceBundle::LoadThemeResources() { + DCHECK(NULL == theme_data_) << "theme dll already loaded"; + std::wstring theme_data_path; + PathService::Get(chrome::DIR_THEMES, &theme_data_path); + file_util::AppendToPath(&theme_data_path, L"default.dll"); + + // The dll should only have resources, not executable code. + theme_data_ = LoadLibraryEx(theme_data_path.c_str(), NULL, + GetDataDllLoadFlags()); + DCHECK(theme_data_ != NULL) << "unable to load " << theme_data_path; +} + +bool ResourceBundle::LoadImageResourceBytes(int resource_id, + std::vector<unsigned char>* bytes) { + return LoadResourceBytes(theme_data_, resource_id, bytes); +} + +bool ResourceBundle::LoadDataResourceBytes(int resource_id, + std::vector<unsigned char>* bytes) { + return LoadResourceBytes(_AtlBaseModule.GetModuleInstance(), + resource_id, bytes); +} + +/* static */ +bool ResourceBundle::LoadResourceBytes( + DataHandle module, + int resource_id, + std::vector<unsigned char>* bytes) { + void* data_ptr; + size_t data_size; + if (base::GetDataResourceFromModule(module, resource_id, &data_ptr, + &data_size)) { + bytes->resize(data_size); + memcpy(&(bytes->front()), data_ptr, data_size); + return true; + } else { + return false; + } +} + +HICON ResourceBundle::LoadThemeIcon(int icon_id) { + return ::LoadIcon(theme_data_, MAKEINTRESOURCE(icon_id)); +} + +std::string ResourceBundle::GetDataResource(int resource_id) { + return GetRawDataResource(resource_id).as_string(); +} + +StringPiece ResourceBundle::GetRawDataResource(int resource_id) { + void* data_ptr; + size_t data_size; + if (base::GetDataResourceFromModule(_AtlBaseModule.GetModuleInstance(), + resource_id, + &data_ptr, + &data_size)) { + return StringPiece(static_cast<const char*>(data_ptr), data_size); + } else if (locale_resources_data_ && + base::GetDataResourceFromModule(locale_resources_data_, + resource_id, + &data_ptr, + &data_size)) { + return StringPiece(static_cast<const char*>(data_ptr), data_size); + } + return StringPiece(); +} +// Loads and returns the global accelerators from the current module. +HACCEL ResourceBundle::GetGlobalAccelerators() { + return ::LoadAccelerators(_AtlBaseModule.GetModuleInstance(), + MAKEINTRESOURCE(IDR_MAINFRAME)); +} + +// Loads and returns a cursor from the current module. +HCURSOR ResourceBundle::LoadCursor(int cursor_id) { + return ::LoadCursor(_AtlBaseModule.GetModuleInstance(), + MAKEINTRESOURCE(cursor_id)); +} + +std::wstring ResourceBundle::GetLocalizedString(int message_id) { + // If for some reason we were unable to load a resource dll, return an empty + // string (better than crashing). + if (!locale_resources_data_) + return std::wstring(); + + DCHECK(IS_INTRESOURCE(message_id)); + + // Get a reference directly to the string resource. + HINSTANCE hinstance = locale_resources_data_; + const ATLSTRINGRESOURCEIMAGE* image = AtlGetStringResourceImage(hinstance, + message_id); + if (!image) { + // Fall back on the current module (shouldn't be any strings here except + // in unittests). + image = AtlGetStringResourceImage(_AtlBaseModule.GetModuleInstance(), + message_id); + if (!image) { + NOTREACHED() << "unable to find resource: " << message_id; + return std::wstring(); + } + } + // Copy into a wstring and return. + return std::wstring(image->achString, image->nLength); +} diff --git a/chrome/renderer/webplugin_delegate_proxy.cc b/chrome/renderer/webplugin_delegate_proxy.cc index 5a70548..22ece4b 100644 --- a/chrome/renderer/webplugin_delegate_proxy.cc +++ b/chrome/renderer/webplugin_delegate_proxy.cc @@ -687,8 +687,8 @@ void WebPluginDelegateProxy::PaintSadPlugin(HDC hdc, const gfx::Rect& rect) { paint); if (!sad_plugin_) { - sad_plugin_ = ResourceBundle::LoadBitmap( - _AtlBaseModule.GetResourceInstance(), IDR_SAD_PLUGIN); + sad_plugin_ = ResourceBundle::GetSharedInstance().GetBitmapNamed( + IDR_SAD_PLUGIN); } if (sad_plugin_) { |