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

Side by Side Diff: chrome/installer/util/l10n_string_util.cc

Issue 7633055: base: Fix the TODO in string_util.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix chrome_mini_installer.cc Created 9 years, 4 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 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <algorithm> 8 #include <algorithm>
9 9
10 #include <atlbase.h> 10 #include <atlbase.h>
11 11
12 #include "base/logging.h" 12 #include "base/logging.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/string_util.h" 14 #include "base/string_util.h"
15 #include "base/stringprintf.h"
15 #include "chrome/installer/util/language_selector.h" 16 #include "chrome/installer/util/language_selector.h"
16 17
17 namespace { 18 namespace {
18 19
19 const installer::LanguageSelector& GetLanguageSelector() { 20 const installer::LanguageSelector& GetLanguageSelector() {
20 static const installer::LanguageSelector instance; 21 static const installer::LanguageSelector instance;
21 22
22 return instance; 23 return instance;
23 } 24 }
24 25
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 57
57 std::wstring resource(L"IDR_OEMPG_"); 58 std::wstring resource(L"IDR_OEMPG_");
58 resource.append(language).append(L".HTML"); 59 resource.append(language).append(L".HTML");
59 60
60 // Fall back on "en" if we don't have a resource for this language. 61 // Fall back on "en" if we don't have a resource for this language.
61 if (NULL == FindResource(NULL, resource.c_str(), RT_HTML)) 62 if (NULL == FindResource(NULL, resource.c_str(), RT_HTML))
62 resource = L"IDR_OEMPG_EN.HTML"; 63 resource = L"IDR_OEMPG_EN.HTML";
63 64
64 // Spaces and DOS paths must be url encoded. 65 // Spaces and DOS paths must be url encoded.
65 std::wstring url_path = 66 std::wstring url_path =
66 StringPrintf(L"res://%ls/#23/%ls", full_exe_path, resource.c_str()); 67 base::StringPrintf(L"res://%ls/#23/%ls", full_exe_path, resource.c_str());
67 68
68 // The cast is safe because url_path has limited length 69 // The cast is safe because url_path has limited length
69 // (see the definition of full_exe_path and resource). 70 // (see the definition of full_exe_path and resource).
70 DCHECK(kuint32max > (url_path.size() * 3)); 71 DCHECK(kuint32max > (url_path.size() * 3));
71 DWORD count = static_cast<DWORD>(url_path.size() * 3); 72 DWORD count = static_cast<DWORD>(url_path.size() * 3);
72 scoped_array<wchar_t> url_canon(new wchar_t[count]); 73 scoped_array<wchar_t> url_canon(new wchar_t[count]);
73 HRESULT hr = ::UrlCanonicalizeW(url_path.c_str(), url_canon.get(), 74 HRESULT hr = ::UrlCanonicalizeW(url_path.c_str(), url_canon.get(),
74 &count, URL_ESCAPE_UNSAFE); 75 &count, URL_ESCAPE_UNSAFE);
75 if (SUCCEEDED(hr)) 76 if (SUCCEEDED(hr))
76 return std::wstring(url_canon.get()); 77 return std::wstring(url_canon.get());
77 return url_path; 78 return url_path;
78 } 79 }
79 80
80 } // namespace installer 81 } // namespace installer
OLDNEW
« no previous file with comments | « chrome/installer/util/google_chrome_distribution.cc ('k') | chrome/installer/util/self_reg_work_item.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698