| Index: trunk/src/chrome/common/localized_error.cc
|
| ===================================================================
|
| --- trunk/src/chrome/common/localized_error.cc (revision 195011)
|
| +++ trunk/src/chrome/common/localized_error.cc (working copy)
|
| @@ -294,18 +294,6 @@
|
| },
|
| };
|
|
|
| -// Special error page to be used in the case of navigating back to a page
|
| -// generated by a POST. LocalizedError::HasStrings expects this net error code
|
| -// to also appear in the array above.
|
| -const LocalizedErrorMap repost_error = {
|
| - net::ERR_CACHE_MISS,
|
| - IDS_ERRORPAGES_TITLE_NOT_AVAILABLE,
|
| - IDS_HTTP_POST_WARNING_TITLE,
|
| - IDS_ERRORPAGES_HTTP_POST_WARNING,
|
| - IDS_ERRORPAGES_DETAILS_CACHE_MISS,
|
| - SUGGEST_RELOAD,
|
| -};
|
| -
|
| const LocalizedErrorMap http_error_options[] = {
|
| {403,
|
| IDS_ERRORPAGES_TITLE_ACCESS_DENIED,
|
| @@ -377,12 +365,8 @@
|
| }
|
|
|
| const LocalizedErrorMap* LookupErrorMap(const std::string& error_domain,
|
| - int error_code, bool is_post) {
|
| + int error_code) {
|
| if (error_domain == net::kErrorDomain) {
|
| - // Display a different page in the special case of navigating through the
|
| - // history to an uncached page created by a POST.
|
| - if (is_post && error_code == net::ERR_CACHE_MISS)
|
| - return &repost_error;
|
| return FindErrorMapInArray(net_error_options,
|
| arraysize(net_error_options),
|
| error_code);
|
| @@ -422,9 +406,8 @@
|
| const char LocalizedError::kHttpErrorDomain[] = "http";
|
|
|
| void LocalizedError::GetStrings(const WebKit::WebURLError& error,
|
| - bool is_post,
|
| - const std::string& locale,
|
| - DictionaryValue* error_strings) {
|
| + DictionaryValue* error_strings,
|
| + const std::string& locale) {
|
| bool rtl = LocaleIsRTL();
|
| error_strings->SetString("textdirection", rtl ? "rtl" : "ltr");
|
|
|
| @@ -441,8 +424,8 @@
|
|
|
| const std::string error_domain = error.domain.utf8();
|
| int error_code = error.reason;
|
| - const LocalizedErrorMap* error_map = LookupErrorMap(error_domain, error_code,
|
| - is_post);
|
| + const LocalizedErrorMap* error_map =
|
| + LookupErrorMap(error_domain, error_code);
|
| if (error_map)
|
| options = *error_map;
|
|
|
| @@ -539,26 +522,11 @@
|
| #endif // defined(OS_MACOSX) || defined(OS_WIN)
|
|
|
| if (options.suggestions & SUGGEST_RELOAD) {
|
| - if (!is_post) {
|
| - DictionaryValue* reload_button = new DictionaryValue;
|
| - reload_button->SetString("msg",
|
| - l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_RELOAD));
|
| - reload_button->SetString("reloadUrl", failed_url_string);
|
| - error_strings->Set("reload", reload_button);
|
| - } else {
|
| - // If the page was created by a post, it can't be reloaded in the same
|
| - // way, so just add a suggestion instead.
|
| - // TODO(mmenke): Make the reload button bring up the repost confirmation
|
| - // dialog for pages resulting from posts.
|
| - DictionaryValue* suggest_reload_repost = new DictionaryValue;
|
| - suggest_reload_repost->SetString("header",
|
| - l10n_util::GetStringUTF16(
|
| - IDS_ERRORPAGES_SUGGESTION_RELOAD_REPOST_HEADER));
|
| - suggest_reload_repost->SetString("body",
|
| - l10n_util::GetStringUTF16(
|
| - IDS_ERRORPAGES_SUGGESTION_RELOAD_REPOST_BODY));
|
| - suggestions->Append(suggest_reload_repost);
|
| - }
|
| + DictionaryValue* reload_button = new DictionaryValue;
|
| + reload_button->SetString("msg",
|
| + l10n_util::GetStringUTF16(IDS_ERRORPAGES_BUTTON_RELOAD));
|
| + reload_button->SetString("reloadUrl", failed_url_string);
|
| + error_strings->Set("reload", reload_button);
|
| }
|
|
|
| if (options.suggestions & SUGGEST_CHECK_CONNECTION) {
|
| @@ -685,10 +653,9 @@
|
| error_strings->Set("suggestions", suggestions);
|
| }
|
|
|
| -string16 LocalizedError::GetErrorDetails(const WebKit::WebURLError& error,
|
| - bool is_post) {
|
| +string16 LocalizedError::GetErrorDetails(const WebKit::WebURLError& error) {
|
| const LocalizedErrorMap* error_map =
|
| - LookupErrorMap(error.domain.utf8(), error.reason, is_post);
|
| + LookupErrorMap(error.domain.utf8(), error.reason);
|
| if (error_map)
|
| return l10n_util::GetStringUTF16(error_map->details_resource_id);
|
| else
|
| @@ -697,12 +664,29 @@
|
|
|
| bool LocalizedError::HasStrings(const std::string& error_domain,
|
| int error_code) {
|
| - // Whether or not the there are strings for an error does not depend on
|
| - // whether or not the page was be generated by a POST, so just claim it was
|
| - // not.
|
| - return LookupErrorMap(error_domain, error_code, /*is_post=*/false) != NULL;
|
| + return LookupErrorMap(error_domain, error_code) != NULL;
|
| }
|
|
|
| +void LocalizedError::GetFormRepostStrings(const GURL& display_url,
|
| + DictionaryValue* error_strings) {
|
| + bool rtl = LocaleIsRTL();
|
| + error_strings->SetString("textdirection", rtl ? "rtl" : "ltr");
|
| +
|
| + string16 failed_url(ASCIIToUTF16(display_url.spec()));
|
| + // URLs are always LTR.
|
| + if (rtl)
|
| + base::i18n::WrapStringWithLTRFormatting(&failed_url);
|
| + error_strings->SetString(
|
| + "title", l10n_util::GetStringFUTF16(IDS_ERRORPAGES_TITLE_NOT_AVAILABLE,
|
| + failed_url));
|
| + error_strings->SetString(
|
| + "heading", l10n_util::GetStringUTF16(IDS_HTTP_POST_WARNING_TITLE));
|
| + DictionaryValue* summary = new DictionaryValue;
|
| + summary->SetString(
|
| + "msg", l10n_util::GetStringUTF16(IDS_ERRORPAGES_HTTP_POST_WARNING));
|
| + error_strings->Set("summary", summary);
|
| +}
|
| +
|
| void LocalizedError::GetAppErrorStrings(
|
| const WebURLError& error,
|
| const GURL& display_url,
|
|
|