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