summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/localized_error.cc
diff options
context:
space:
mode:
authorerikkay@chromium.org <erikkay@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-27 15:22:11 +0000
committererikkay@chromium.org <erikkay@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-27 15:22:11 +0000
commit5351dbc9a7ec62aa9db14e6040856f56a9d01c0f (patch)
tree75310029e7bfdb333e11b117f4af1a5f98c7d955 /chrome/renderer/localized_error.cc
parent5e38ff3d12a83ae0925ef00c3da37ce9718ac29d (diff)
downloadchromium_src-5351dbc9a7ec62aa9db14e6040856f56a9d01c0f.zip
chromium_src-5351dbc9a7ec62aa9db14e6040856f56a9d01c0f.tar.gz
chromium_src-5351dbc9a7ec62aa9db14e6040856f56a9d01c0f.tar.bz2
When the browser doesn't have connectivity to a hosted app, display a prettier error page by default.
TEST=none BUG=41281 Review URL: http://codereview.chromium.org/3174024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57680 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/localized_error.cc')
-rw-r--r--chrome/renderer/localized_error.cc25
1 files changed, 25 insertions, 0 deletions
diff --git a/chrome/renderer/localized_error.cc b/chrome/renderer/localized_error.cc
index 386e75b3..2bf9841 100644
--- a/chrome/renderer/localized_error.cc
+++ b/chrome/renderer/localized_error.cc
@@ -11,6 +11,7 @@
#include "base/string_number_conversions.h"
#include "base/utf_string_conversions.h"
#include "base/values.h"
+#include "chrome/renderer/extensions/extension_renderer_info.h"
#include "googleurl/src/gurl.h"
#include "grit/generated_resources.h"
#include "net/base/escape.h"
@@ -260,3 +261,27 @@ void GetFormRepostErrorValues(const GURL& display_url,
"msg", l10n_util::GetStringUTF16(IDS_ERRORPAGES_HTTP_POST_WARNING));
error_strings->Set("summary", summary);
}
+
+void GetAppErrorValues(const WebURLError& error,
+ const GURL& display_url,
+ const ExtensionRendererInfo* app,
+ DictionaryValue* error_strings) {
+ DCHECK(app);
+
+ 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(
+ "url", l10n_util::GetStringFUTF16(IDS_ERRORPAGES_TITLE_NOT_AVAILABLE,
+ failed_url.c_str()));
+
+ error_strings->SetString("title", app->name());
+ error_strings->SetString("icon", app->icon_url().spec());
+ error_strings->SetString("name", app->name());
+ error_strings->SetString("msg",
+ l10n_util::GetStringUTF16(IDS_ERRORPAGES_APP_WARNING));
+}