| Index: chrome/common/localized_error.cc
|
| ===================================================================
|
| --- chrome/common/localized_error.cc (revision 263850)
|
| +++ chrome/common/localized_error.cc (working copy)
|
| @@ -23,6 +23,7 @@
|
| #include "third_party/WebKit/public/platform/WebURLError.h"
|
| #include "ui/base/l10n/l10n_util.h"
|
| #include "ui/base/webui/web_ui_util.h"
|
| +#include "url/gurl.h"
|
|
|
| #if defined(OS_WIN)
|
| #include "base/win/windows_version.h"
|
| @@ -489,12 +490,6 @@
|
|
|
| const char LocalizedError::kHttpErrorDomain[] = "http";
|
|
|
| -LocalizedError::ErrorPageParams::ErrorPageParams() : suggest_reload(false) {
|
| -}
|
| -
|
| -LocalizedError::ErrorPageParams::~ErrorPageParams() {
|
| -}
|
| -
|
| void LocalizedError::GetStrings(int error_code,
|
| const std::string& error_domain,
|
| const GURL& failed_url,
|
| @@ -502,7 +497,6 @@
|
| bool stale_copy_in_cache,
|
| const std::string& locale,
|
| const std::string& accept_languages,
|
| - scoped_ptr<ErrorPageParams> params,
|
| base::DictionaryValue* error_strings) {
|
| bool rtl = LocaleIsRTL();
|
| error_strings->SetString("textdirection", rtl ? "rtl" : "ltr");
|
| @@ -565,7 +559,15 @@
|
| error_strings->SetString(
|
| "less", l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_LESS));
|
| error_strings->Set("summary", summary);
|
| + error_strings->SetBoolean("staleCopyInCache", stale_copy_in_cache);
|
|
|
| +#if defined(OS_CHROMEOS)
|
| + error_strings->SetString(
|
| + "diagnose", l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_DIAGNOSE));
|
| +#endif // defined(OS_CHROMEOS)
|
| +
|
| + error_strings->SetBoolean("staleCopyInCache", stale_copy_in_cache);
|
| +
|
| if (options.details_resource_id != kErrorPagesNoDetails) {
|
| error_strings->SetString(
|
| "errorDetails", l10n_util::GetStringUTF16(options.details_resource_id));
|
| @@ -589,7 +591,9 @@
|
| error_strings->SetString("errorCode",
|
| l10n_util::GetStringFUTF16(IDS_ERRORPAGES_ERROR_CODE, error_string));
|
|
|
| - // Platform specific information for diagnosing network issues on OSX and
|
| + base::ListValue* suggestions = new base::ListValue();
|
| +
|
| + // Platform specific instructions for diagnosing network issues on OSX and
|
| // Windows.
|
| #if defined(OS_MACOSX) || defined(OS_WIN)
|
| if (error_domain == net::kErrorDomain &&
|
| @@ -619,32 +623,7 @@
|
| }
|
| #endif // defined(OS_MACOSX) || defined(OS_WIN)
|
|
|
| - // If no parameters were provided, use the defaults.
|
| - if (!params) {
|
| - params.reset(new ErrorPageParams());
|
| - params->suggest_reload = !!(options.suggestions & SUGGEST_RELOAD);
|
| - }
|
| -
|
| - base::ListValue* suggestions = NULL;
|
| - bool use_default_suggestions = true;
|
| - if (!params->override_suggestions) {
|
| - suggestions = new base::ListValue();
|
| - } else {
|
| - suggestions = params->override_suggestions.release();
|
| - use_default_suggestions = false;
|
| - }
|
| -
|
| - error_strings->Set("suggestions", suggestions);
|
| -
|
| - if (params->search_url.is_valid()) {
|
| - error_strings->SetString("searchHeader",
|
| - l10n_util::GetStringUTF16(IDS_ERRORPAGES_SUGGESTION_GOOGLE_SEARCH));
|
| - error_strings->SetString("searchUrl", params->search_url.spec());
|
| - error_strings->SetString("searchTerms", params->search_terms);
|
| - }
|
| -
|
| - // Add the reload suggestion, if needed.
|
| - if (params->suggest_reload) {
|
| + if (options.suggestions & SUGGEST_RELOAD) {
|
| if (!is_post) {
|
| base::DictionaryValue* reload_button = new base::DictionaryValue;
|
| reload_button->SetString("msg",
|
| @@ -663,23 +642,10 @@
|
| suggest_reload_repost->SetString("body",
|
| l10n_util::GetStringUTF16(
|
| IDS_ERRORPAGES_SUGGESTION_RELOAD_REPOST_BODY));
|
| - // Add at the front, so it appears before other suggestions, in the case
|
| - // suggestions are being overridden by |params|.
|
| - suggestions->Insert(0, suggest_reload_repost);
|
| + suggestions->Append(suggest_reload_repost);
|
| }
|
| }
|
|
|
| - // If not using the default suggestions, nothing else to do.
|
| - if (!use_default_suggestions)
|
| - return;
|
| -
|
| - error_strings->SetBoolean("staleCopyInCache", stale_copy_in_cache);
|
| -
|
| -#if defined(OS_CHROMEOS)
|
| - error_strings->SetString(
|
| - "diagnose", l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_DIAGNOSE));
|
| -#endif // defined(OS_CHROMEOS)
|
| -
|
| if (options.suggestions & SUGGEST_CHECK_CONNECTION) {
|
| base::DictionaryValue* suggest_check_connection = new base::DictionaryValue;
|
| suggest_check_connection->SetString("header",
|
| @@ -803,6 +769,8 @@
|
| suggestions->Append(suggest_learn_more);
|
| }
|
| }
|
| +
|
| + error_strings->Set("suggestions", suggestions);
|
| }
|
|
|
| base::string16 LocalizedError::GetErrorDetails(const blink::WebURLError& error,
|
|
|