diff --git a/src/core/renderer/content_renderer_client_qt.cpp b/src/core/renderer/content_renderer_client_qt.cpp index 451aaac4b7498eb6f353d09b52df200c464d5b0a..bfc5c389f18e6d90be32c9d6d7c562fc4f24c9bf 100644 --- a/src/core/renderer/content_renderer_client_qt.cpp +++ b/src/core/renderer/content_renderer_client_qt.cpp @@ -92,36 +92,34 @@ bool ContentRendererClientQt::ShouldSuppressErrorPage(content::RenderFrame *fram } // To tap into the chromium localized strings. Ripped from the chrome layer (highly simplified). -void ContentRendererClientQt::GetNavigationErrorStrings(content::RenderView* render_view, blink::WebFrame *frame, const blink::WebURLRequest &failed_request, const blink::WebURLError &error, std::string *error_html, base::string16 *error_description) +void ContentRendererClientQt::GetNavigationErrorStrings(content::RenderView* renderView, blink::WebFrame *frame, const blink::WebURLRequest &failedRequest, const blink::WebURLError &error, std::string *errorHtml, base::string16 *errorDescription) { Q_UNUSED(frame) - - const bool isPost = EqualsASCII(failed_request.httpMethod(), "POST"); - - if (error_html) { - // Use a local error page. - int resource_id; - base::DictionaryValue error_strings; - - const std::string locale = content::RenderThread::Get()->GetLocale(); - // TODO(elproxy): We could potentially get better diagnostics here by first calling NetErrorHelper::GetErrorStringsForDnsProbe - LocalizedError::GetStrings(error.reason, error.domain.utf8(), - error.unreachableURL, isPost, error.staleCopyInCache && !isPost, - locale, render_view->GetAcceptLanguages(), scoped_ptr<LocalizedError::ErrorPageParams>(), - &error_strings); - resource_id = IDR_NET_ERROR_HTML; - - - const base::StringPiece template_html(ui::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 = webui::GetTemplatesHtml(template_html, &error_strings, "t"); + const bool isPost = EqualsASCII(failedRequest.httpMethod(), "POST"); + + if (errorHtml) { + // Use a local error page. + int resourceId; + base::DictionaryValue errorStrings; + + const std::string locale = content::RenderThread::Get()->GetLocale(); + // TODO(elproxy): We could potentially get better diagnostics here by first calling + // NetErrorHelper::GetErrorStringsForDnsProbe, but that one is harder to untangle. + LocalizedError::GetStrings(error.reason, error.domain.utf8(), error.unreachableURL, isPost + , error.staleCopyInCache && !isPost, locale, renderView->GetAcceptLanguages() + , scoped_ptr<LocalizedError::ErrorPageParams>(), &errorStrings); + resourceId = IDR_NET_ERROR_HTML; + + + const base::StringPiece template_html(ui::ResourceBundle::GetSharedInstance().GetRawDataResource(resourceId)); + if (template_html.empty()) + NOTREACHED() << "unable to load template. ID: " << resourceId; + else // "t" is the id of the templates root node. + *errorHtml = webui::GetTemplatesHtml(template_html, &errorStrings, "t"); } - if (error_description) { - *error_description = LocalizedError::GetErrorDetails(error, isPost); - } + if (errorDescription) + *errorDescription = LocalizedError::GetErrorDetails(error, isPost); } unsigned long long ContentRendererClientQt::VisitedLinkHash(const char *canonicalUrl, size_t length) diff --git a/src/core/renderer/content_renderer_client_qt.h b/src/core/renderer/content_renderer_client_qt.h index 505262fc83489711cc51f5a9568a22d51906fb0e..4e3c70cf888e6e818dfce09df7c9cd41bc370c03 100644 --- a/src/core/renderer/content_renderer_client_qt.h +++ b/src/core/renderer/content_renderer_client_qt.h @@ -52,8 +52,8 @@ public: virtual bool ShouldSuppressErrorPage(content::RenderFrame *, const GURL &) Q_DECL_OVERRIDE; virtual bool HasErrorPage(int httpStatusCode, std::string *errorDomain) Q_DECL_OVERRIDE; - virtual void GetNavigationErrorStrings(content::RenderView* render_view, blink::WebFrame* frame, const blink::WebURLRequest& failed_request - , const blink::WebURLError& error, std::string* error_html, base::string16* error_description) Q_DECL_OVERRIDE; + virtual void GetNavigationErrorStrings(content::RenderView* renderView, blink::WebFrame* frame, const blink::WebURLRequest& failedRequest + , const blink::WebURLError& error, std::string* errorHtml, base::string16* errorDescription) Q_DECL_OVERRIDE; virtual unsigned long long VisitedLinkHash(const char *canonicalUrl, size_t length) Q_DECL_OVERRIDE; virtual bool IsLinkVisited(unsigned long long linkHash) Q_DECL_OVERRIDE;