| 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 a66d83761a8ff890e51dadccbd14f18e7404bf3f..fe3ea790e2b10f60d1038adc0fabefbfcea5c526 100644
|
| --- a/android_webview/browser/aw_browser_context.cc
|
| +++ b/android_webview/browser/aw_browser_context.cc
|
| @@ -32,6 +32,7 @@
|
| #include "components/policy/core/browser/url_blacklist_manager.h"
|
| #include "components/pref_registry/pref_registry_syncable.h"
|
| #include "components/prefs/in_memory_pref_store.h"
|
| +#include "components/prefs/pref_change_registrar.h"
|
| #include "components/prefs/pref_service.h"
|
| #include "components/prefs/pref_service_factory.h"
|
| #include "components/url_formatter/url_fixer.h"
|
| @@ -59,6 +60,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 {
|
| @@ -263,6 +266,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) {
|
| @@ -318,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);
|
|
|
| @@ -331,6 +349,8 @@ 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_.reset(new PrefChangeRegistrar);
|
| + pref_change_registrar_->Init(user_pref_service_.get());
|
|
|
| user_prefs::UserPrefs::Set(this, user_pref_service_.get());
|
| }
|
| @@ -438,6 +458,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
|
|
|