OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 default: | 364 default: |
365 return ""; | 365 return ""; |
366 } | 366 } |
367 } | 367 } |
368 | 368 |
369 string16 GetErrorDetailsString(const std::string& error_domain, | 369 string16 GetErrorDetailsString(const std::string& error_domain, |
370 int error_code, | 370 int error_code, |
371 const string16& details) { | 371 const string16& details) { |
372 int error_page_template; | 372 int error_page_template; |
373 const char* error_string; | 373 const char* error_string; |
374 if (error_domain == net::kErrorDomain) { | 374 if (error_domain == net::kErrorDomain || error_domain == "ext") { |
375 error_page_template = IDS_ERRORPAGES_DETAILS_TEMPLATE; | 375 error_page_template = IDS_ERRORPAGES_DETAILS_TEMPLATE; |
376 error_string = net::ErrorToString(error_code); | 376 error_string = net::ErrorToString(error_code); |
377 DCHECK(error_code < 0); // Net error codes are negative. | 377 DCHECK(error_code < 0); // Net error codes are negative. |
378 error_code = -error_code; | 378 error_code = -error_code; |
379 } else if (error_domain == LocalizedError::kHttpErrorDomain) { | 379 } else if (error_domain == LocalizedError::kHttpErrorDomain) { |
380 error_page_template = IDS_ERRORPAGES_HTTP_DETAILS_TEMPLATE; | 380 error_page_template = IDS_ERRORPAGES_HTTP_DETAILS_TEMPLATE; |
381 error_string = HttpErrorToString(error_code); | 381 error_string = HttpErrorToString(error_code); |
382 } else { | 382 } else { |
383 NOTREACHED(); | 383 NOTREACHED(); |
384 return string16(); | 384 return string16(); |
(...skipping 10 matching lines...) Expand all Loading... |
395 int error_code) { | 395 int error_code) { |
396 for (size_t i = 0; i < num_maps; ++i) { | 396 for (size_t i = 0; i < num_maps; ++i) { |
397 if (maps[i].error_code == error_code) | 397 if (maps[i].error_code == error_code) |
398 return &maps[i]; | 398 return &maps[i]; |
399 } | 399 } |
400 return NULL; | 400 return NULL; |
401 } | 401 } |
402 | 402 |
403 const LocalizedErrorMap* LookupErrorMap(const std::string& error_domain, | 403 const LocalizedErrorMap* LookupErrorMap(const std::string& error_domain, |
404 int error_code) { | 404 int error_code) { |
405 if (error_domain == net::kErrorDomain) { | 405 if (error_domain == net::kErrorDomain || error_domain == "ext") { |
406 return FindErrorMapInArray(net_error_options, | 406 return FindErrorMapInArray(net_error_options, |
407 arraysize(net_error_options), | 407 arraysize(net_error_options), |
408 error_code); | 408 error_code); |
409 } else if (error_domain == LocalizedError::kHttpErrorDomain) { | 409 } else if (error_domain == LocalizedError::kHttpErrorDomain) { |
410 return FindErrorMapInArray(http_error_options, | 410 return FindErrorMapInArray(http_error_options, |
411 arraysize(http_error_options), | 411 arraysize(http_error_options), |
412 error_code); | 412 error_code); |
413 } else { | 413 } else { |
414 NOTREACHED(); | 414 NOTREACHED(); |
415 return NULL; | 415 return NULL; |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
733 #if defined(OS_CHROMEOS) | 733 #if defined(OS_CHROMEOS) |
734 GURL learn_more_url(kAppWarningLearnMoreUrl); | 734 GURL learn_more_url(kAppWarningLearnMoreUrl); |
735 DictionaryValue* suggest_learn_more = new DictionaryValue(); | 735 DictionaryValue* suggest_learn_more = new DictionaryValue(); |
736 suggest_learn_more->SetString("msg", | 736 suggest_learn_more->SetString("msg", |
737 l10n_util::GetStringUTF16( | 737 l10n_util::GetStringUTF16( |
738 IDS_ERRORPAGES_SUGGESTION_LEARNMORE)); | 738 IDS_ERRORPAGES_SUGGESTION_LEARNMORE)); |
739 suggest_learn_more->SetString("learnMoreUrl", learn_more_url.spec()); | 739 suggest_learn_more->SetString("learnMoreUrl", learn_more_url.spec()); |
740 error_strings->Set("suggestionsLearnMore", suggest_learn_more); | 740 error_strings->Set("suggestionsLearnMore", suggest_learn_more); |
741 #endif // defined(OS_CHROMEOS) | 741 #endif // defined(OS_CHROMEOS) |
742 } | 742 } |
OLD | NEW |