OLD | NEW |
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 #include "chrome/browser/ui/webui/options/about_page_handler.h" | 5 #include "chrome/browser/ui/webui/options/about_page_handler.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 localized_strings->SetString(chromium_url_appears_first ? | 180 localized_strings->SetString(chromium_url_appears_first ? |
181 "license_link_content_0" : "license_link_content_1", | 181 "license_link_content_0" : "license_link_content_1", |
182 StringSubRange(text, | 182 StringSubRange(text, |
183 text.find(kBeginLinkChr) + strlen(kBeginLinkChr), | 183 text.find(kBeginLinkChr) + strlen(kBeginLinkChr), |
184 text.find(kEndLinkChr))); | 184 text.find(kEndLinkChr))); |
185 GURL url = google_util::AppendGoogleLocaleParam( | 185 GURL url = google_util::AppendGoogleLocaleParam( |
186 GURL(chrome::kChromiumProjectURL)); | 186 GURL(chrome::kChromiumProjectURL)); |
187 localized_strings->SetString(chromium_url_appears_first ? | 187 localized_strings->SetString(chromium_url_appears_first ? |
188 "license_link_0" : "license_link_1", url.spec()); | 188 "license_link_0" : "license_link_1", url.spec()); |
189 | 189 |
190 // The Open Source link within the main text of the dialog. | 190 // The Open Source link within the main text of the dialog. We need to use |
| 191 // the chrome:// variant instead of about:credits; the latter will get |
| 192 // rewritten to about:blank. |
191 localized_strings->SetString(chromium_url_appears_first ? | 193 localized_strings->SetString(chromium_url_appears_first ? |
192 "license_link_content_1" : "license_link_content_0", | 194 "license_link_content_1" : "license_link_content_0", |
193 StringSubRange(text, | 195 StringSubRange(text, |
194 text.find(kBeginLinkOss) + strlen(kBeginLinkOss), | 196 text.find(kBeginLinkOss) + strlen(kBeginLinkOss), |
195 text.find(kEndLinkOss))); | 197 text.find(kEndLinkOss))); |
196 localized_strings->SetString(chromium_url_appears_first ? | 198 localized_strings->SetString(chromium_url_appears_first ? |
197 "license_link_1" : "license_link_0", chrome::kChromeUICreditsURL); | 199 "license_link_1" : "license_link_0", chrome::kChromeUIAboutCreditsURL); |
198 | 200 |
199 #if defined(OS_CHROMEOS) | 201 #if defined(OS_CHROMEOS) |
200 std::string cros_text = | 202 std::string cros_text = |
201 l10n_util::GetStringUTF8(IDS_ABOUT_CROS_VERSION_LICENSE); | 203 l10n_util::GetStringUTF8(IDS_ABOUT_CROS_VERSION_LICENSE); |
202 | 204 |
203 size_t cros_link = cros_text.find(kBeginLinkCrosOss); | 205 size_t cros_link = cros_text.find(kBeginLinkCrosOss); |
204 DCHECK(cros_link != std::string::npos); | 206 DCHECK(cros_link != std::string::npos); |
205 size_t cros_link_end = cros_text.find(kEndLinkCrosOss, cros_link); | 207 size_t cros_link_end = cros_text.find(kEndLinkCrosOss, cros_link); |
206 DCHECK(cros_link_end != std::string::npos); | 208 DCHECK(cros_link_end != std::string::npos); |
207 | 209 |
208 localized_strings->SetString("cros_license_content_0", | 210 localized_strings->SetString("cros_license_content_0", |
209 cros_text.substr(0, cros_link)); | 211 cros_text.substr(0, cros_link)); |
210 localized_strings->SetString("cros_license_content_1", | 212 localized_strings->SetString("cros_license_content_1", |
211 cros_text.substr(cros_link_end + strlen(kEndLinkCrosOss))); | 213 cros_text.substr(cros_link_end + strlen(kEndLinkCrosOss))); |
212 localized_strings->SetString("cros_license_link_content_0", | 214 localized_strings->SetString("cros_license_link_content_0", |
213 StringSubRange(cros_text, cros_link + strlen(kBeginLinkCrosOss), | 215 StringSubRange(cros_text, cros_link + strlen(kBeginLinkCrosOss), |
214 cros_link_end)); | 216 cros_link_end)); |
215 localized_strings->SetString("cros_license_link_0", | 217 localized_strings->SetString("cros_license_link_0", |
216 chrome::kChromeUIOSCreditsURL); | 218 chrome::kChromeUIAboutOSCreditsURL); |
217 #endif | 219 #endif |
218 | 220 |
219 // webkit | 221 // webkit |
220 | 222 |
221 localized_strings->SetString("webkit_version", | 223 localized_strings->SetString("webkit_version", |
222 webkit_glue::GetWebKitVersion()); | 224 webkit_glue::GetWebKitVersion()); |
223 | 225 |
224 // javascript | 226 // javascript |
225 | 227 |
226 #if defined(CHROME_V8) | 228 #if defined(CHROME_V8) |
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 if (chromeos::CrosLibrary::Get()->GetUpdateLibrary()->HasObserver(observer)) { | 443 if (chromeos::CrosLibrary::Get()->GetUpdateLibrary()->HasObserver(observer)) { |
442 // If UpdateLibrary still has the observer, then the page handler is valid. | 444 // If UpdateLibrary still has the observer, then the page handler is valid. |
443 AboutPageHandler* handler = observer->page_handler(); | 445 AboutPageHandler* handler = observer->page_handler(); |
444 scoped_ptr<Value> channel_string(Value::CreateStringValue(channel)); | 446 scoped_ptr<Value> channel_string(Value::CreateStringValue(channel)); |
445 handler->web_ui_->CallJavascriptFunction( | 447 handler->web_ui_->CallJavascriptFunction( |
446 "AboutPage.updateSelectedOptionCallback", *channel_string); | 448 "AboutPage.updateSelectedOptionCallback", *channel_string); |
447 } | 449 } |
448 } | 450 } |
449 | 451 |
450 #endif // defined(OS_CHROMEOS) | 452 #endif // defined(OS_CHROMEOS) |
OLD | NEW |