From ca0da5d74a495247c2d7408fba8d918754ad49d3 Mon Sep 17 00:00:00 2001 From: Pierre Rossi Date: Mon, 13 Oct 2014 18:19:41 +0200 Subject: Fix up coding style in GetNavigationErrorStrings That code was borrowed straight from Chromium and used the Chromium coding style. Change-Id: I212aea23f19056b901cbc770640faed4998f02fd Reviewed-by: Zeno Albisser --- src/core/renderer/content_renderer_client_qt.cpp | 50 ++++++++++++------------ src/core/renderer/content_renderer_client_qt.h | 4 +- 2 files changed, 26 insertions(+), 28 deletions(-) diff --git a/src/core/renderer/content_renderer_client_qt.cpp b/src/core/renderer/content_renderer_client_qt.cpp index 451aaac4b..bfc5c389f 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(), - &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(), &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 505262fc8..4e3c70cf8 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; -- cgit v1.2.3