| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 // | 4 // |
| 5 // This file defines specific implementation of BrowserDistribution class for | 5 // This file defines specific implementation of BrowserDistribution class for |
| 6 // Google Chrome. | 6 // Google Chrome. |
| 7 | 7 |
| 8 #include <atlbase.h> | 8 #include <atlbase.h> |
| 9 #include <shlwapi.h> | 9 #include <shlwapi.h> |
| 10 | 10 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 // We don't have ICU at this point, so we use win32 apis. | 36 // We don't have ICU at this point, so we use win32 apis. |
| 37 LCID id = GetThreadLocale(); | 37 LCID id = GetThreadLocale(); |
| 38 int length = GetLocaleInfo(id, LOCALE_SISO639LANGNAME, 0, 0); | 38 int length = GetLocaleInfo(id, LOCALE_SISO639LANGNAME, 0, 0); |
| 39 if (0 == length) { | 39 if (0 == length) { |
| 40 language = L"en-us"; | 40 language = L"en-us"; |
| 41 return language; | 41 return language; |
| 42 } | 42 } |
| 43 length = GetLocaleInfo(id, LOCALE_SISO639LANGNAME, | 43 length = GetLocaleInfo(id, LOCALE_SISO639LANGNAME, |
| 44 WriteInto(&language, length), length); | 44 WriteInto(&language, length), length); |
| 45 DCHECK(length == static_cast<int>(language.length() + 1)); | 45 DCHECK(length == language.length() + 1); |
| 46 StringToLowerASCII(&language); | 46 StringToLowerASCII(&language); |
| 47 | 47 |
| 48 // Add the country if we need it. | 48 // Add the country if we need it. |
| 49 std::wstring country; | 49 std::wstring country; |
| 50 length = GetLocaleInfo(id, LOCALE_SISO3166CTRYNAME, 0, 0); | 50 length = GetLocaleInfo(id, LOCALE_SISO3166CTRYNAME, 0, 0); |
| 51 if (0 != length) { | 51 if (0 != length) { |
| 52 length = GetLocaleInfo(id, LOCALE_SISO3166CTRYNAME, | 52 length = GetLocaleInfo(id, LOCALE_SISO3166CTRYNAME, |
| 53 WriteInto(&country, length), length); | 53 WriteInto(&country, length), length); |
| 54 DCHECK(length == static_cast<int>(country.length() + 1)); | 54 DCHECK(length == country.length() + 1); |
| 55 StringToLowerASCII(&country); | 55 StringToLowerASCII(&country); |
| 56 if (L"en" == language) { | 56 if (L"en" == language) { |
| 57 if (L"gb" == country) { | 57 if (L"gb" == country) { |
| 58 language.append(L"-gb"); | 58 language.append(L"-gb"); |
| 59 } else { | 59 } else { |
| 60 language.append(L"-us"); | 60 language.append(L"-us"); |
| 61 } | 61 } |
| 62 } else if (L"es" == language && L"es" != country) { | 62 } else if (L"es" == language && L"es" != country) { |
| 63 language.append(L"-419"); | 63 language.append(L"-419"); |
| 64 } else if (L"pt" == language) { | 64 } else if (L"pt" == language) { |
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 DWORD count = static_cast<DWORD>(url_path.size() * 3); | 263 DWORD count = static_cast<DWORD>(url_path.size() * 3); |
| 264 scoped_array<wchar_t> url_canon(new wchar_t[count]); | 264 scoped_array<wchar_t> url_canon(new wchar_t[count]); |
| 265 HRESULT hr = ::UrlCanonicalizeW(url_path.c_str(), url_canon.get(), | 265 HRESULT hr = ::UrlCanonicalizeW(url_path.c_str(), url_canon.get(), |
| 266 &count, URL_ESCAPE_UNSAFE); | 266 &count, URL_ESCAPE_UNSAFE); |
| 267 if (SUCCEEDED(hr)) | 267 if (SUCCEEDED(hr)) |
| 268 return std::wstring(url_canon.get()); | 268 return std::wstring(url_canon.get()); |
| 269 return url_path; | 269 return url_path; |
| 270 } | 270 } |
| 271 | 271 |
| 272 } // namespace installer_util | 272 } // namespace installer_util |
| OLD | NEW |