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 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
11 #include "base/scoped_ptr.h" | 11 #include "base/scoped_ptr.h" |
12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
13 #include "chrome/installer/util/language_selector.h" | 13 #include "chrome/installer/util/language_selector.h" |
14 | 14 |
15 namespace { | 15 namespace { |
16 | 16 |
17 const installer_util::LanguageSelector& GetLanguageSelector() { | 17 const installer::LanguageSelector& GetLanguageSelector() { |
18 static const installer_util::LanguageSelector instance; | 18 static const installer::LanguageSelector instance; |
19 | 19 |
20 return instance; | 20 return instance; |
21 } | 21 } |
22 | 22 |
23 } // namespace | 23 } // namespace |
24 | 24 |
25 namespace installer_util { | 25 namespace installer { |
26 | 26 |
27 std::wstring GetLocalizedString(int base_message_id) { | 27 std::wstring GetLocalizedString(int base_message_id) { |
28 std::wstring localized_string; | 28 std::wstring localized_string; |
29 | 29 |
30 int message_id = base_message_id + GetLanguageSelector().offset(); | 30 int message_id = base_message_id + GetLanguageSelector().offset(); |
31 const ATLSTRINGRESOURCEIMAGE* image = AtlGetStringResourceImage( | 31 const ATLSTRINGRESOURCEIMAGE* image = AtlGetStringResourceImage( |
32 _AtlBaseModule.GetModuleInstance(), message_id); | 32 _AtlBaseModule.GetModuleInstance(), message_id); |
33 if (image) { | 33 if (image) { |
34 localized_string = std::wstring(image->achString, image->nLength); | 34 localized_string = std::wstring(image->achString, image->nLength); |
35 } else { | 35 } else { |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 DCHECK(kuint32max > (url_path.size() * 3)); | 68 DCHECK(kuint32max > (url_path.size() * 3)); |
69 DWORD count = static_cast<DWORD>(url_path.size() * 3); | 69 DWORD count = static_cast<DWORD>(url_path.size() * 3); |
70 scoped_array<wchar_t> url_canon(new wchar_t[count]); | 70 scoped_array<wchar_t> url_canon(new wchar_t[count]); |
71 HRESULT hr = ::UrlCanonicalizeW(url_path.c_str(), url_canon.get(), | 71 HRESULT hr = ::UrlCanonicalizeW(url_path.c_str(), url_canon.get(), |
72 &count, URL_ESCAPE_UNSAFE); | 72 &count, URL_ESCAPE_UNSAFE); |
73 if (SUCCEEDED(hr)) | 73 if (SUCCEEDED(hr)) |
74 return std::wstring(url_canon.get()); | 74 return std::wstring(url_canon.get()); |
75 return url_path; | 75 return url_path; |
76 } | 76 } |
77 | 77 |
78 } // namespace installer_util | 78 } // namespace installer |
OLD | NEW |