summaryrefslogtreecommitdiffstats
path: root/chrome/renderer/chrome_content_renderer_client.cc
diff options
context:
space:
mode:
authormkosiba@chromium.org <mkosiba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-11 15:31:58 +0000
committermkosiba@chromium.org <mkosiba@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-11 15:31:58 +0000
commitd7b175e8762301a1bfca9d17681111bbf5bf5c0a (patch)
tree3dbd962ef0417f8977eebfd362ee5ffbcb5c1e27 /chrome/renderer/chrome_content_renderer_client.cc
parentc2ee7f0e04e752bd40b1461e92756e7a320e40ec (diff)
downloadchromium_src-d7b175e8762301a1bfca9d17681111bbf5bf5c0a.zip
chromium_src-d7b175e8762301a1bfca9d17681111bbf5bf5c0a.tar.gz
chromium_src-d7b175e8762301a1bfca9d17681111bbf5bf5c0a.tar.bz2
Add error description to the DidFailProvisionalLoad callback.
This will add an error description field to the TabContentsObserver:: DidFailProvisionalLoad callback. The change should not have any impact on current behavior. This is needed for the Chromium port on Android. BUG=none TEST=base_unittests,content_unittests,browser_tests Review URL: http://codereview.chromium.org/8142032 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@104895 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/chrome_content_renderer_client.cc')
-rw-r--r--chrome/renderer/chrome_content_renderer_client.cc71
1 files changed, 40 insertions, 31 deletions
diff --git a/chrome/renderer/chrome_content_renderer_client.cc b/chrome/renderer/chrome_content_renderer_client.cc
index 561574d..0c10574 100644
--- a/chrome/renderer/chrome_content_renderer_client.cc
+++ b/chrome/renderer/chrome_content_renderer_client.cc
@@ -533,47 +533,56 @@ bool ChromeContentRendererClient::HasErrorPage(int http_status_code,
return true;
}
-std::string ChromeContentRendererClient::GetNavigationErrorHtml(
- const WebURLRequest& failed_request,
- const WebURLError& error) {
- GURL failed_url = error.unreachableURL;
- std::string html;
+void ChromeContentRendererClient::GetNavigationErrorStrings(
+ const WebKit::WebURLRequest& failed_request,
+ const WebKit::WebURLError& error,
+ std::string* error_html,
+ string16* error_description) {
+ const GURL failed_url = error.unreachableURL;
const Extension* extension = NULL;
+ const bool is_repost =
+ error.reason == net::ERR_CACHE_MISS &&
+ error.domain == WebString::fromUTF8(net::kErrorDomain) &&
+ EqualsASCII(failed_request.httpMethod(), "POST");
- // Use a local error page.
- int resource_id;
- DictionaryValue error_strings;
if (failed_url.is_valid() && !failed_url.SchemeIs(chrome::kExtensionScheme))
extension = extension_dispatcher_->extensions()->GetByURL(failed_url);
- if (extension) {
- LocalizedError::GetAppErrorStrings(error, failed_url, extension,
- &error_strings);
- // TODO(erikkay): Should we use a different template for different
- // error messages?
- resource_id = IDR_ERROR_APP_HTML;
- } else {
- if (error.domain == WebString::fromUTF8(net::kErrorDomain) &&
- error.reason == net::ERR_CACHE_MISS &&
- EqualsASCII(failed_request.httpMethod(), "POST")) {
- LocalizedError::GetFormRepostStrings(failed_url, &error_strings);
+ if (error_html) {
+ // Use a local error page.
+ int resource_id;
+ DictionaryValue error_strings;
+ if (extension) {
+ LocalizedError::GetAppErrorStrings(error, failed_url, extension,
+ &error_strings);
+
+ // TODO(erikkay): Should we use a different template for different
+ // error messages?
+ resource_id = IDR_ERROR_APP_HTML;
} else {
- LocalizedError::GetStrings(error, &error_strings);
+ if (is_repost) {
+ LocalizedError::GetFormRepostStrings(failed_url, &error_strings);
+ } else {
+ LocalizedError::GetStrings(error, &error_strings);
+ }
+ resource_id = IDR_NET_ERROR_HTML;
}
- resource_id = IDR_NET_ERROR_HTML;
- }
- const base::StringPiece template_html(
- ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id));
- if (template_html.empty()) {
- NOTREACHED() << "unable to load template. ID: " << resource_id;
- } else {
- // "t" is the id of the templates root node.
- html = jstemplate_builder::GetTemplatesHtml(
- template_html, &error_strings, "t");
+ const base::StringPiece template_html(
+ ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id));
+ if (template_html.empty()) {
+ NOTREACHED() << "unable to load template. ID: " << resource_id;
+ } else {
+ // "t" is the id of the templates root node.
+ *error_html = jstemplate_builder::GetTemplatesHtml(
+ template_html, &error_strings, "t");
+ }
}
- return html;
+ if (error_description) {
+ if (!extension && !is_repost)
+ *error_description = LocalizedError::GetErrorDetails(error);
+ }
}
bool ChromeContentRendererClient::RunIdleHandlerWhenWidgetsHidden() {