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

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: Manual rebase, no other changes 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 73d840c0f594771fbbeb1723780c9bf5709361b3..b4d37ca536a63e2c1eaaeea594601352ceb9a30f 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 {
@@ -264,6 +266,19 @@ void AwBrowserContext::PreMainMessageLoopRun() {
content::BrowserContext::GetDefaultStoragePartition(this)->
GetURLRequestContext(),
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) {
@@ -319,6 +334,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);
@@ -438,6 +455,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