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 |