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

Unified Diff: android_webview/browser/aw_browser_context.cc

Issue 1890203002: Implement Web Restrictions in WebView. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
Index: android_webview/browser/aw_browser_context.cc
diff --git a/android_webview/browser/aw_browser_context.cc b/android_webview/browser/aw_browser_context.cc
index d5252bd244746c99d3ee9727fb838b0b5664a800..91c5e6c4ceb65407f5559b8f0f4874e984b8406a 100644
--- a/android_webview/browser/aw_browser_context.cc
+++ b/android_webview/browser/aw_browser_context.cc
@@ -59,6 +59,8 @@ const char kAuthAndroidNegotiateAccountType[] =
// Whitelist containing servers for which Integrated Authentication is enabled.
const char kAuthServerWhitelist[] = "auth.server_whitelist";
+const char kWebRestrictionsAuthority[] = "web_restrictions_authority";
+
} // namespace prefs
namespace {
@@ -262,6 +264,19 @@ void AwBrowserContext::PreMainMessageLoopRun() {
AwMetricsServiceClient::GetInstance()->Initialize(user_pref_service_.get(),
GetRequestContext(),
guid_file_path);
+ web_restriction_provider_.reset(
+ new web_restrictions::WebRestrictionsClient());
+ web_restrictions_authority_.Init(
+ prefs::kWebRestrictionsAuthority, user_pref_service_.get(),
+ base::Bind(&AwBrowserContext::OnWebRestrictionsAuthorityChanged,
+ base::Unretained(this)));
+ web_restriction_provider_->SetAuthority(
+ web_restrictions_authority_.GetValue());
+}
+
+void AwBrowserContext::OnWebRestrictionsAuthorityChanged() {
+ web_restriction_provider_->SetAuthority(
+ web_restrictions_authority_.GetValue());
}
void AwBrowserContext::AddVisitedURLs(const std::vector<GURL>& urls) {
@@ -317,6 +332,8 @@ void AwBrowserContext::InitUserPrefService() {
pref_registry->RegisterStringPref(prefs::kAuthServerWhitelist, std::string());
pref_registry->RegisterStringPref(prefs::kAuthAndroidNegotiateAccountType,
std::string());
+ pref_registry->RegisterStringPref(prefs::kWebRestrictionsAuthority,
+ std::string());
metrics::MetricsService::RegisterPrefs(pref_registry);
@@ -446,6 +463,12 @@ policy::URLBlacklistManager* AwBrowserContext::GetURLBlacklistManager() {
return blacklist_manager_.get();
}
+web_restrictions::WebRestrictionsClient*
+AwBrowserContext::GetWebRestrictionProvider() {
+ DCHECK(web_restriction_provider_);
+ return web_restriction_provider_.get();
+}
+
void AwBrowserContext::RebuildTable(
const scoped_refptr<URLEnumerator>& enumerator) {
// Android WebView rebuilds from WebChromeClient.getVisitedHistory. The client

Powered by Google App Engine
This is Rietveld 408576698