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

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: Fix final nits Created 4 years, 4 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 bf157d666f730a8b874219539ce32edd85c99ac8..26c4a1228c8e251f1d58b53df6f25fbcd5a79ac7 100644
--- a/android_webview/browser/aw_browser_context.cc
+++ b/android_webview/browser/aw_browser_context.cc
@@ -52,6 +52,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 {
@@ -200,6 +202,19 @@ void AwBrowserContext::PreMainMessageLoopRun() {
content::BrowserContext::GetDefaultStoragePartition(this)->
GetURLRequestContext(),
guid_file_path);
+ web_restriction_provider_.reset(
+ new web_restrictions::WebRestrictionsClient());
+ pref_change_registrar_.Add(
+ prefs::kWebRestrictionsAuthority,
+ base::Bind(&AwBrowserContext::OnWebRestrictionsAuthorityChanged,
+ base::Unretained(this)));
+ web_restriction_provider_->SetAuthority(
+ user_pref_service_->GetString(prefs::kWebRestrictionsAuthority));
+}
+
+void AwBrowserContext::OnWebRestrictionsAuthorityChanged() {
+ web_restriction_provider_->SetAuthority(
+ user_pref_service_->GetString(prefs::kWebRestrictionsAuthority));
}
void AwBrowserContext::AddVisitedURLs(const std::vector<GURL>& urls) {
@@ -243,6 +258,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);
@@ -256,6 +273,7 @@ void AwBrowserContext::InitUserPrefService() {
policy::POLICY_LEVEL_MANDATORY)));
pref_service_factory.set_read_error_callback(base::Bind(&HandleReadError));
user_pref_service_ = pref_service_factory.Create(pref_registry);
+ pref_change_registrar_.Init(user_pref_service_.get());
user_prefs::UserPrefs::Set(this, user_pref_service_.get());
}
@@ -363,6 +381,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
« no previous file with comments | « android_webview/browser/aw_browser_context.h ('k') | android_webview/browser/aw_browser_policy_connector.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698