| OLD | NEW |
| 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/renderer/localized_error.h" | 5 #include "chrome/renderer/localized_error.h" |
| 6 | 6 |
| 7 #include "base/i18n/rtl.h" | 7 #include "base/i18n/rtl.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/string16.h" | 9 #include "base/string16.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 "title", l10n_util::GetStringFUTF16(IDS_ERRORPAGES_TITLE_NOT_AVAILABLE, | 509 "title", l10n_util::GetStringFUTF16(IDS_ERRORPAGES_TITLE_NOT_AVAILABLE, |
| 510 failed_url)); | 510 failed_url)); |
| 511 error_strings->SetString( | 511 error_strings->SetString( |
| 512 "heading", l10n_util::GetStringUTF16(IDS_HTTP_POST_WARNING_TITLE)); | 512 "heading", l10n_util::GetStringUTF16(IDS_HTTP_POST_WARNING_TITLE)); |
| 513 DictionaryValue* summary = new DictionaryValue; | 513 DictionaryValue* summary = new DictionaryValue; |
| 514 summary->SetString( | 514 summary->SetString( |
| 515 "msg", l10n_util::GetStringUTF16(IDS_ERRORPAGES_HTTP_POST_WARNING)); | 515 "msg", l10n_util::GetStringUTF16(IDS_ERRORPAGES_HTTP_POST_WARNING)); |
| 516 error_strings->Set("summary", summary); | 516 error_strings->Set("summary", summary); |
| 517 } | 517 } |
| 518 | 518 |
| 519 void LocalizedError::GetAppErrorStrings(const WebURLError& error, | 519 void LocalizedError::GetAppErrorStrings( |
| 520 const GURL& display_url, | 520 const WebURLError& error, |
| 521 const ExtensionRendererInfo* app, | 521 const GURL& display_url, |
| 522 DictionaryValue* error_strings) { | 522 const scoped_refptr<const Extension>& app, |
| 523 DictionaryValue* error_strings) { |
| 523 DCHECK(app); | 524 DCHECK(app); |
| 524 | 525 |
| 525 bool rtl = LocaleIsRTL(); | 526 bool rtl = LocaleIsRTL(); |
| 526 error_strings->SetString("textdirection", rtl ? "rtl" : "ltr"); | 527 error_strings->SetString("textdirection", rtl ? "rtl" : "ltr"); |
| 527 | 528 |
| 528 string16 failed_url(ASCIIToUTF16(display_url.spec())); | 529 string16 failed_url(ASCIIToUTF16(display_url.spec())); |
| 529 // URLs are always LTR. | 530 // URLs are always LTR. |
| 530 if (rtl) | 531 if (rtl) |
| 531 base::i18n::WrapStringWithLTRFormatting(&failed_url); | 532 base::i18n::WrapStringWithLTRFormatting(&failed_url); |
| 532 error_strings->SetString( | 533 error_strings->SetString( |
| 533 "url", l10n_util::GetStringFUTF16(IDS_ERRORPAGES_TITLE_NOT_AVAILABLE, | 534 "url", l10n_util::GetStringFUTF16(IDS_ERRORPAGES_TITLE_NOT_AVAILABLE, |
| 534 failed_url.c_str())); | 535 failed_url.c_str())); |
| 535 | 536 |
| 536 error_strings->SetString("title", app->name()); | 537 error_strings->SetString("title", app->name()); |
| 537 error_strings->SetString("icon", app->icon_url().spec()); | 538 error_strings->SetString("icon", |
| 539 app->GetIconURL(Extension::EXTENSION_ICON_LARGE, |
| 540 ExtensionIconSet::MATCH_SMALLER).spec()); |
| 538 error_strings->SetString("name", app->name()); | 541 error_strings->SetString("name", app->name()); |
| 539 error_strings->SetString("msg", | 542 error_strings->SetString("msg", |
| 540 l10n_util::GetStringUTF16(IDS_ERRORPAGES_APP_WARNING)); | 543 l10n_util::GetStringUTF16(IDS_ERRORPAGES_APP_WARNING)); |
| 541 } | 544 } |
| OLD | NEW |