summaryrefslogtreecommitdiffstats
path: root/src/core/renderer/content_renderer_client_qt.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/renderer/content_renderer_client_qt.cpp')
-rw-r--r--src/core/renderer/content_renderer_client_qt.cpp57
1 files changed, 31 insertions, 26 deletions
diff --git a/src/core/renderer/content_renderer_client_qt.cpp b/src/core/renderer/content_renderer_client_qt.cpp
index 6d4315b64..bfc5c389f 100644
--- a/src/core/renderer/content_renderer_client_qt.cpp
+++ b/src/core/renderer/content_renderer_client_qt.cpp
@@ -39,6 +39,7 @@
#include "base/strings/utf_string_conversions.h"
#include "chrome/common/localized_error.h"
#include "components/visitedlink/renderer/visitedlink_slave.h"
+#include "content/public/renderer/render_frame.h"
#include "content/public/renderer/render_thread.h"
#include "content/public/renderer/render_view.h"
#include "net/base/net_errors.h"
@@ -46,6 +47,7 @@
#include "third_party/WebKit/public/platform/WebURLRequest.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/base/webui/jstemplate_builder.h"
+#include "webkit/common/webpreferences.h"
#include "renderer/qt_render_view_observer.h"
@@ -84,37 +86,40 @@ bool ContentRendererClientQt::HasErrorPage(int httpStatusCode, std::string *erro
return true;
}
+bool ContentRendererClientQt::ShouldSuppressErrorPage(content::RenderFrame *frame, const GURL &)
+{
+ return !(frame->GetWebkitPreferences().enable_error_page);
+}
+
// 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)