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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 #include <atlbase.h> 1 #include <atlbase.h>
2 #include <shlwapi.h>
2 3
3 #include <map> 4 #include <map>
4 5
5 #include "base/logging.h" 6 #include "base/logging.h"
6 #include "base/string_util.h" 7 #include "base/string_util.h"
7 8
8 #include "installer_util_strings.h" 9 #include "installer_util_strings.h"
9 10
10 namespace { 11 namespace {
11 12
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
145 _AtlBaseModule.GetModuleInstance(), message_id); 146 _AtlBaseModule.GetModuleInstance(), message_id);
146 if (image) { 147 if (image) {
147 localized_string = std::wstring(image->achString, image->nLength); 148 localized_string = std::wstring(image->achString, image->nLength);
148 } else { 149 } else {
149 NOTREACHED() << "Unable to find resource id " << message_id; 150 NOTREACHED() << "Unable to find resource id " << message_id;
150 } 151 }
151 152
152 return localized_string; 153 return localized_string;
153 } 154 }
154 155
156 // Here we generate the url spec with the Microsoft res:// scheme which is
157 // explained here : http://support.microsoft.com/kb/220830
158 std::wstring GetLocalizedEulaResource() {
159 wchar_t full_exe_path[MAX_PATH];
160 int len = ::GetModuleFileNameW(NULL, full_exe_path, MAX_PATH);
161 if (len <= 0 && len >= MAX_PATH)
162 return L"";
163 // The default language is English, but we also support Spanish,French and
164 // Portuguese.
165 std::wstring language = GetSystemLanguage();
166 const wchar_t* resource = L"IDR_OEMPG_EN.HTML";
167 if (language == L"fr")
168 resource = L"IDR_OEMPG_FR.HTML";
169 else if (language == L"es")
170 resource = L"IDR_OEMPG_ES.HTML";
171 else if (language == L"pt-br")
172 resource = L"IDR_OEMPG_BR.HTML";
173 // Spaces and DOS paths must be url encoded.
174 std::wstring url_path =
175 StringPrintf(L"res://%ls/#23/%ls", full_exe_path, resource);
176 DWORD count = url_path.size() * 3;
177 scoped_ptr<wchar_t> url_canon(new wchar_t[count]);
178 HRESULT hr = ::UrlCanonicalizeW(url_path.c_str(), url_canon.get(),
179 &count, URL_ESCAPE_UNSAFE);
180 if (SUCCEEDED(hr))
181 return std::wstring(url_canon.get());
182 return url_path;
183 }
184
155 } // namespace installer_util 185 } // namespace installer_util
186
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698