summaryrefslogtreecommitdiffstats
path: root/chrome_frame/utils.cc
diff options
context:
space:
mode:
authorrobertshield@chromium.org <robertshield@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-24 03:09:05 +0000
committerrobertshield@chromium.org <robertshield@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-24 03:09:05 +0000
commit36a26ed0faf7fb24d1991136cb5d6969f8042055 (patch)
treef8651c491b8a25bc7bd5b56f85f099c3b3f651dd /chrome_frame/utils.cc
parent6502d03df070469ccc6f634f4c72d4ceda9a3bb3 (diff)
downloadchromium_src-36a26ed0faf7fb24d1991136cb5d6969f8042055.zip
chromium_src-36a26ed0faf7fb24d1991136cb5d6969f8042055.tar.gz
chromium_src-36a26ed0faf7fb24d1991136cb5d6969f8042055.tar.bz2
Add a simple resource loader to Chrome Frame that is capable of finding, loading and extracting resources from the Chrome locale DLLs.
Add the Chrome Frame resource strings to the Chrome .grds so they get built directly into the Chrome locale dlls. There is one remaining todo here, which is to load the dialog template into a grd + rc somewhere (probably in generated_resources.grd) and then get CF to load dialog templates from a different module. Will do that in another patch. BUG=24305 TEST=Chrome Frame when loaded on machines whose locales are not US English will display strings appropriate to those locales. Review URL: http://codereview.chromium.org/1240001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42423 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/utils.cc')
-rw-r--r--chrome_frame/utils.cc27
1 files changed, 9 insertions, 18 deletions
diff --git a/chrome_frame/utils.cc b/chrome_frame/utils.cc
index bec0595..7fcdde8 100644
--- a/chrome_frame/utils.cc
+++ b/chrome_frame/utils.cc
@@ -22,10 +22,12 @@
#include "chrome/installer/util/chrome_frame_distribution.h"
#include "chrome_frame/extra_system_apis.h"
#include "chrome_frame/html_utils.h"
+#include "chrome_frame/simple_resource_loader.h"
#include "chrome_frame/utils.h"
#include "googleurl/src/gurl.h"
#include "googleurl/src/url_canon.h"
-#include "grit/chrome_frame_resources.h"
+
+#include "grit/chromium_strings.h"
// Note that these values are all lower case and are compared to
// lower-case-transformed values.
@@ -285,19 +287,6 @@ HRESULT UtilGetXUACompatContentValue(const std::wstring& html_string,
return E_FAIL;
}
-std::wstring GetResourceString(int resource_id) {
- std::wstring resource_string;
- HMODULE this_module = reinterpret_cast<HMODULE>(&__ImageBase);
- const ATLSTRINGRESOURCEIMAGE* image = AtlGetStringResourceImage(
- this_module, resource_id);
- if (image) {
- resource_string.assign(image->achString, image->nLength);
- } else {
- NOTREACHED() << "Unable to find resource id " << resource_id;
- }
- return resource_string;
-}
-
void DisplayVersionMismatchWarning(HWND parent,
const std::string& server_version) {
// Obtain the current module version.
@@ -307,14 +296,16 @@ void DisplayVersionMismatchWarning(HWND parent,
std::wstring version_string(file_version_info->file_version());
std::wstring wide_server_version;
if (server_version.empty()) {
- wide_server_version = GetResourceString(IDS_VERSIONUNKNOWN);
+ wide_server_version = SimpleResourceLoader::Get(IDS_VERSIONUNKNOWN);
} else {
wide_server_version = ASCIIToWide(server_version);
}
- std::wstring title = GetResourceString(IDS_VERSIONMISMATCH_HEADER);
+ std::wstring title = SimpleResourceLoader::Get(IDS_VERSIONMISMATCH_HEADER);
std::wstring message;
- SStringPrintf(&message, GetResourceString(IDS_VERSIONMISMATCH).c_str(),
- wide_server_version.c_str(), version_string.c_str());
+ SStringPrintf(&message,
+ SimpleResourceLoader::Get(IDS_VERSIONMISMATCH).c_str(),
+ wide_server_version.c_str(),
+ version_string.c_str());
::MessageBox(parent, message.c_str(), title.c_str(), MB_OK);
}