Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(117)

Unified Diff: ui/base/resource/resource_bundle_win.cc

Issue 7328011: Introduce ui.dll / libui.so for the component build. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/base/resource/resource_bundle_win.cc
===================================================================
--- ui/base/resource/resource_bundle_win.cc (revision 92815)
+++ ui/base/resource/resource_bundle_win.cc (working copy)
@@ -24,6 +24,8 @@
namespace {
+HINSTANCE resources_data_dll;
+
// Returns the flags that should be passed to LoadLibraryEx.
DWORD GetDataDllLoadFlags() {
if (base::win::GetVersion() >= base::win::VERSION_VISTA)
@@ -45,7 +47,12 @@
void ResourceBundle::LoadCommonResources() {
// As a convenience, set resources_data_ to the current resource module.
DCHECK(NULL == resources_data_) << "common resources already loaded";
- resources_data_ = _AtlBaseModule.GetResourceInstance();
+
+ if (resources_data_dll) {
+ resources_data_ = resources_data_dll;
+ } else {
+ resources_data_ = GetModuleHandle(NULL);
+ }
}
std::string ResourceBundle::LoadLocaleResources(
@@ -106,6 +113,11 @@
}
}
+// static
+void ResourceBundle::SetResourcesDataDLL(HINSTANCE handle) {
+ resources_data_dll = handle;
+}
+
HICON ResourceBundle::LoadThemeIcon(int icon_id) {
return ::LoadIcon(resources_data_, MAKEINTRESOURCE(icon_id));
}
@@ -113,7 +125,7 @@
base::StringPiece ResourceBundle::GetRawDataResource(int resource_id) const {
void* data_ptr;
size_t data_size;
- if (base::GetDataResourceFromModule(_AtlBaseModule.GetModuleInstance(),
+ if (base::GetDataResourceFromModule(resources_data_,
resource_id,
&data_ptr,
&data_size)) {
@@ -137,8 +149,7 @@
// Loads and returns a cursor from the current module.
HCURSOR ResourceBundle::LoadCursor(int cursor_id) {
- return ::LoadCursor(_AtlBaseModule.GetModuleInstance(),
- MAKEINTRESOURCE(cursor_id));
+ return ::LoadCursor(resources_data_, MAKEINTRESOURCE(cursor_id));
}
string16 ResourceBundle::GetLocalizedString(int message_id) {
@@ -159,8 +170,7 @@
if (!image) {
// Fall back on the current module (shouldn't be any strings here except
// in unittests).
- image = AtlGetStringResourceImage(_AtlBaseModule.GetModuleInstance(),
- message_id);
+ image = AtlGetStringResourceImage(resources_data_, message_id);
if (!image) {
// See http://crbug.com/21925.
base::debug::StackTrace().PrintBacktrace();

Powered by Google App Engine
This is Rietveld 408576698