| Index: chrome/common/localized_error.cc
|
| ===================================================================
|
| --- chrome/common/localized_error.cc (revision 248295)
|
| +++ chrome/common/localized_error.cc (working copy)
|
| @@ -23,7 +23,6 @@
|
| #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"
|
| @@ -490,12 +489,19 @@
|
|
|
| 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,
|
| bool is_post,
|
| 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");
|
| @@ -558,10 +564,6 @@
|
| error_strings->SetString(
|
| "less", l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_LESS));
|
| error_strings->Set("summary", summary);
|
| -#if defined(OS_CHROMEOS)
|
| - error_strings->SetString(
|
| - "diagnose", l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_DIAGNOSE));
|
| -#endif // defined(OS_CHROMEOS)
|
|
|
| if (options.details_resource_id != kErrorPagesNoDetails) {
|
| error_strings->SetString(
|
| @@ -586,9 +588,7 @@
|
| error_strings->SetString("errorCode",
|
| l10n_util::GetStringFUTF16(IDS_ERRORPAGES_ERROR_CODE, error_string));
|
|
|
| - base::ListValue* suggestions = new base::ListValue();
|
| -
|
| - // Platform specific instructions for diagnosing network issues on OSX and
|
| + // Platform specific information for diagnosing network issues on OSX and
|
| // Windows.
|
| #if defined(OS_MACOSX) || defined(OS_WIN)
|
| if (error_domain == net::kErrorDomain &&
|
| @@ -618,7 +618,28 @@
|
| }
|
| #endif // defined(OS_MACOSX) || defined(OS_WIN)
|
|
|
| - if (options.suggestions & SUGGEST_RELOAD) {
|
| + bool use_default_suggestions = true;
|
| + bool suggest_reload = options.suggestions & SUGGEST_RELOAD;
|
| + base::ListValue* suggestions = NULL;
|
| + if (params) {
|
| + if (params->override_suggestions) {
|
| + suggestions = params->override_suggestions.release();
|
| + use_default_suggestions = false;
|
| + }
|
| + suggest_reload = params->suggest_reload;
|
| + 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);
|
| + }
|
| + } else {
|
| + suggestions = new base::ListValue();
|
| + }
|
| +
|
| + error_strings->Set("suggestions", suggestions);
|
| +
|
| + if (suggest_reload) {
|
| if (!is_post) {
|
| base::DictionaryValue* reload_button = new base::DictionaryValue;
|
| reload_button->SetString("msg",
|
| @@ -637,10 +658,20 @@
|
| suggest_reload_repost->SetString("body",
|
| l10n_util::GetStringUTF16(
|
| IDS_ERRORPAGES_SUGGESTION_RELOAD_REPOST_BODY));
|
| - suggestions->Append(suggest_reload_repost);
|
| + // 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);
|
| }
|
| }
|
|
|
| + if (!use_default_suggestions)
|
| + return;
|
| +
|
| +#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",
|
| @@ -764,8 +795,6 @@
|
| suggestions->Append(suggest_learn_more);
|
| }
|
| }
|
| -
|
| - error_strings->Set("suggestions", suggestions);
|
| }
|
|
|
| base::string16 LocalizedError::GetErrorDetails(const blink::WebURLError& error,
|
|
|