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

Unified Diff: chrome/installer/util/l10n_string_util.cc

Issue 18732: Wire the eula and the dialog display code... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 11 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: chrome/installer/util/l10n_string_util.cc
===================================================================
--- chrome/installer/util/l10n_string_util.cc (revision 8439)
+++ chrome/installer/util/l10n_string_util.cc (working copy)
@@ -1,4 +1,5 @@
#include <atlbase.h>
+#include <shlwapi.h>
#include <map>
@@ -152,4 +153,34 @@
return localized_string;
}
+// Here we generate the url spec with the Microsoft res:// scheme which is
+// explained here : http://support.microsoft.com/kb/220830
+std::wstring GetLocalizedEulaResource() {
+ wchar_t full_exe_path[MAX_PATH];
+ int len = ::GetModuleFileNameW(NULL, full_exe_path, MAX_PATH);
+ if (len <= 0 && len >= MAX_PATH)
+ return L"";
+ // The default language is English, but we also support Spanish,French and
+ // Portuguese.
+ std::wstring language = GetSystemLanguage();
+ const wchar_t* resource = L"IDR_OEMPG_EN.HTML";
+ if (language == L"fr")
+ resource = L"IDR_OEMPG_FR.HTML";
+ else if (language == L"es")
+ resource = L"IDR_OEMPG_ES.HTML";
+ else if (language == L"pt-br")
+ resource = L"IDR_OEMPG_BR.HTML";
+ // Spaces and DOS paths must be url encoded.
+ std::wstring url_path =
+ StringPrintf(L"res://%ls/#23/%ls", full_exe_path, resource);
+ DWORD count = url_path.size() * 3;
+ scoped_ptr<wchar_t> url_canon(new wchar_t[count]);
+ HRESULT hr = ::UrlCanonicalizeW(url_path.c_str(), url_canon.get(),
+ &count, URL_ESCAPE_UNSAFE);
+ if (SUCCEEDED(hr))
+ return std::wstring(url_canon.get());
+ return url_path;
+}
+
} // namespace installer_util
+

Powered by Google App Engine
This is Rietveld 408576698