Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(548)

Unified Diff: android_webview/renderer/aw_content_renderer_client.cc

Issue 1423713015: [WIP] WebRestrictions (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: continue review in split cl Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « android_webview/renderer/DEPS ('k') | components/web_restriction.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/renderer/aw_content_renderer_client.cc
diff --git a/android_webview/renderer/aw_content_renderer_client.cc b/android_webview/renderer/aw_content_renderer_client.cc
index 7203f90a47cf216fcb459e9f90f5696c408d2dac..1ca920b4ffff8e7abe65298b6eaed6b516a4b5d7 100644
--- a/android_webview/renderer/aw_content_renderer_client.cc
+++ b/android_webview/renderer/aw_content_renderer_client.cc
@@ -6,6 +6,7 @@
#include <vector>
+#include "android_webview/browser/aw_browser_context.h"
#include "android_webview/common/aw_resource.h"
#include "android_webview/common/aw_switches.h"
#include "android_webview/common/render_view_messages.h"
@@ -28,6 +29,8 @@
#include "components/autofill/content/renderer/password_autofill_agent.h"
#include "components/printing/renderer/print_web_view_helper.h"
#include "components/visitedlink/renderer/visitedlink_slave.h"
+#include "components/web_restriction/web_restriction_gin_wrapper.h"
+#include "components/web_restriction/web_restriction_provider.h"
#include "content/public/common/url_constants.h"
#include "content/public/renderer/document_state.h"
#include "content/public/renderer/navigation_state.h"
@@ -175,14 +178,14 @@ bool AwContentRendererClient::HasErrorPage(int http_status_code,
}
void AwContentRendererClient::GetNavigationErrorStrings(
- content::RenderFrame* /* render_frame */,
+ content::RenderFrame* render_frame,
const blink::WebURLRequest& failed_request,
const blink::WebURLError& error,
std::string* error_html,
base::string16* error_description) {
if (error_html) {
- std::string url =
- net::EscapeForHTML(GURL(failed_request.url()).possibly_invalid_spec());
+ GURL gurl(failed_request.url());
+ std::string url = net::EscapeForHTML(gurl.possibly_invalid_spec());
std::string err =
base::UTF16ToUTF8(base::StringPiece16(error.localizedDescription));
@@ -207,6 +210,16 @@ void AwContentRendererClient::GetNavigationErrorStrings(
ResourceBundle::GetSharedInstance().GetRawDataResource(
IDR_AW_LOAD_ERROR_HTML),
replacements, nullptr);
+ if (error.reason == net::ERR_BLOCKED_BY_ADMINISTRATOR) {
+ // Move to aw/common/ if chrome's solution is too complicated
+ auto web_restriction_provider =
+ AwBrowserContext::GetDefault()->GetWebRestrictionProvider();
+ std::string restricted_page;
+ if (web_restriction_provider->GetErrorHtml(gurl, &restricted_page))
+ *error_html = restricted_page;
+ if (web_restriction_provider->SupportsRequest())
+ web_restriction::WebRestrictionGinWrapper::Install(render_frame);
jochen (gone - plz use gerrit) 2016/02/22 14:24:43 you install the gin wrapper before you actually na
+ }
}
if (error_description) {
if (error.localizedDescription.isEmpty())
« no previous file with comments | « android_webview/renderer/DEPS ('k') | components/web_restriction.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698