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

Side by Side Diff: chrome/browser/dom_ui/options/about_page_handler.cc

Issue 6088007: chromeos: Add OS credits link to about page. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome/app
Patch Set: add #if around cros-only consts Created 9 years, 12 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
« no previous file with comments | « chrome/app/google_chrome_strings.grd ('k') | chrome/browser/resources/options/about_page.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 #include "chrome/browser/dom_ui/options/about_page_handler.h" 5 #include "chrome/browser/dom_ui/options/about_page_handler.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "app/l10n_util.h" 9 #include "app/l10n_util.h"
10 #include "app/resource_bundle.h" 10 #include "app/resource_bundle.h"
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 namespace { 42 namespace {
43 43
44 // These are used as placeholder text around the links in the text in the 44 // These are used as placeholder text around the links in the text in the
45 // license. 45 // license.
46 const wchar_t kBeginLink[] = L"BEGIN_LINK"; 46 const wchar_t kBeginLink[] = L"BEGIN_LINK";
47 const wchar_t kEndLink[] = L"END_LINK"; 47 const wchar_t kEndLink[] = L"END_LINK";
48 const wchar_t kBeginLinkChr[] = L"BEGIN_LINK_CHR"; 48 const wchar_t kBeginLinkChr[] = L"BEGIN_LINK_CHR";
49 const wchar_t kBeginLinkOss[] = L"BEGIN_LINK_OSS"; 49 const wchar_t kBeginLinkOss[] = L"BEGIN_LINK_OSS";
50 const wchar_t kEndLinkChr[] = L"END_LINK_CHR"; 50 const wchar_t kEndLinkChr[] = L"END_LINK_CHR";
51 const wchar_t kEndLinkOss[] = L"END_LINK_OSS"; 51 const wchar_t kEndLinkOss[] = L"END_LINK_OSS";
52 #if defined(OS_CHROMEOS)
53 const wchar_t kBeginLinkCrosOss[] = L"BEGIN_LINK_CROS_OSS";
54 const wchar_t kEndLinkCrosOss[] = L"END_LINK_CROS_OSS";
55 #endif
52 56
53 // Returns a substring [start, end) from |text|. 57 // Returns a substring [start, end) from |text|.
54 std::wstring StringSubRange(const std::wstring& text, size_t start, 58 std::wstring StringSubRange(const std::wstring& text, size_t start,
55 size_t end) { 59 size_t end) {
56 DCHECK(end > start); 60 DCHECK(end > start);
57 return text.substr(start, end - start); 61 return text.substr(start, end - start);
58 } 62 }
59 63
60 struct LocalizeEntry { 64 struct LocalizeEntry {
61 const char* identifier; 65 const char* identifier;
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 bool chromium_url_appears_first = 169 bool chromium_url_appears_first =
166 text.find(kBeginLinkChr) < text.find(kBeginLinkOss); 170 text.find(kBeginLinkChr) < text.find(kBeginLinkOss);
167 171
168 size_t link1 = text.find(kBeginLink); 172 size_t link1 = text.find(kBeginLink);
169 DCHECK(link1 != std::wstring::npos); 173 DCHECK(link1 != std::wstring::npos);
170 size_t link1_end = text.find(kEndLink, link1); 174 size_t link1_end = text.find(kEndLink, link1);
171 DCHECK(link1_end != std::wstring::npos); 175 DCHECK(link1_end != std::wstring::npos);
172 size_t link2 = text.find(kBeginLink, link1_end); 176 size_t link2 = text.find(kBeginLink, link1_end);
173 DCHECK(link2 != std::wstring::npos); 177 DCHECK(link2 != std::wstring::npos);
174 size_t link2_end = text.find(kEndLink, link2); 178 size_t link2_end = text.find(kEndLink, link2);
175 DCHECK(link1_end != std::wstring::npos); 179 DCHECK(link2_end != std::wstring::npos);
Daniel Erat 2010/12/29 01:11:44 noticed this typo
176 180
177 localized_strings->SetString("license_content_0", 181 localized_strings->SetString("license_content_0",
178 WideToUTF16Hack(text.substr(0, link1))); 182 WideToUTF16Hack(text.substr(0, link1)));
179 localized_strings->SetString("license_content_1", 183 localized_strings->SetString("license_content_1",
180 WideToUTF16Hack(StringSubRange(text, link1_end + wcslen(kEndLinkOss), 184 WideToUTF16Hack(StringSubRange(text, link1_end + wcslen(kEndLinkOss),
181 link2))); 185 link2)));
182 localized_strings->SetString("license_content_2", 186 localized_strings->SetString("license_content_2",
183 WideToUTF16Hack(text.substr(link2_end + wcslen(kEndLinkOss)))); 187 WideToUTF16Hack(text.substr(link2_end + wcslen(kEndLinkOss))));
184 188
185 // The Chromium link within the main text of the dialog. 189 // The Chromium link within the main text of the dialog.
(...skipping 10 matching lines...) Expand all
196 // the chrome:// variant instead of about:credits; the latter will get 200 // the chrome:// variant instead of about:credits; the latter will get
197 // rewritten to about:blank. 201 // rewritten to about:blank.
198 localized_strings->SetString(chromium_url_appears_first ? 202 localized_strings->SetString(chromium_url_appears_first ?
199 "license_link_content_1" : "license_link_content_0", 203 "license_link_content_1" : "license_link_content_0",
200 WideToUTF16Hack(StringSubRange(text, 204 WideToUTF16Hack(StringSubRange(text,
201 text.find(kBeginLinkOss) + wcslen(kBeginLinkOss), 205 text.find(kBeginLinkOss) + wcslen(kBeginLinkOss),
202 text.find(kEndLinkOss)))); 206 text.find(kEndLinkOss))));
203 localized_strings->SetString(chromium_url_appears_first ? 207 localized_strings->SetString(chromium_url_appears_first ?
204 "license_link_1" : "license_link_0", chrome::kChromeUIAboutCreditsURL); 208 "license_link_1" : "license_link_0", chrome::kChromeUIAboutCreditsURL);
205 209
210 #if defined(OS_CHROMEOS)
211 std::wstring cros_text = l10n_util::GetString(IDS_ABOUT_CROS_VERSION_LICENSE);
212
213 size_t cros_link = cros_text.find(kBeginLinkCrosOss);
214 DCHECK(cros_link != std::wstring::npos);
215 size_t cros_link_end = cros_text.find(kEndLinkCrosOss, cros_link);
216 DCHECK(cros_link_end != std::wstring::npos);
217
218 localized_strings->SetString("cros_license_content_0",
219 WideToUTF16Hack(cros_text.substr(0, cros_link)));
Daniel Erat 2010/12/29 01:11:44 I tried to match the broken indenting of the rest
arv (Not doing code reviews) 2010/12/29 01:26:38 Either way.
220 localized_strings->SetString("cros_license_content_1",
221 WideToUTF16Hack(
222 cros_text.substr(cros_link_end + wcslen(kEndLinkCrosOss))));
223 localized_strings->SetString("cros_license_link_content_0",
224 WideToUTF16Hack(StringSubRange(cros_text,
225 cros_link + wcslen(kBeginLinkCrosOss), cros_link_end)));
226 localized_strings->SetString("cros_license_link_0",
227 chrome::kChromeUIAboutOSCreditsURL);
228 #endif
229
206 // webkit 230 // webkit
207 231
208 localized_strings->SetString("webkit_version", 232 localized_strings->SetString("webkit_version",
209 webkit_glue::GetWebKitVersion()); 233 webkit_glue::GetWebKitVersion());
210 234
211 // javascript 235 // javascript
212 236
213 #if defined(CHROME_V8) 237 #if defined(CHROME_V8)
214 localized_strings->SetString("js_engine", "V8"); 238 localized_strings->SetString("js_engine", "V8");
215 localized_strings->SetString("js_engine_version", v8::V8::GetVersion()); 239 localized_strings->SetString("js_engine_version", v8::V8::GetVersion());
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 418
395 void AboutPageHandler::OnOSVersion(chromeos::VersionLoader::Handle handle, 419 void AboutPageHandler::OnOSVersion(chromeos::VersionLoader::Handle handle,
396 std::string version) { 420 std::string version) {
397 if (version.size()) { 421 if (version.size()) {
398 scoped_ptr<Value> version_string(Value::CreateStringValue(version)); 422 scoped_ptr<Value> version_string(Value::CreateStringValue(version));
399 dom_ui_->CallJavascriptFunction(L"AboutPage.updateOSVersionCallback", 423 dom_ui_->CallJavascriptFunction(L"AboutPage.updateOSVersionCallback",
400 *version_string); 424 *version_string);
401 } 425 }
402 } 426 }
403 #endif 427 #endif
OLDNEW
« no previous file with comments | « chrome/app/google_chrome_strings.grd ('k') | chrome/browser/resources/options/about_page.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698