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

Unified Diff: chrome/browser/io_thread.cc

Issue 1414313002: Allow dynamic updating of authentication policies (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix compile error on Windows and component build link error Created 5 years, 1 month 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: chrome/browser/io_thread.cc
diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc
index ec1f91ea53b194c38c7fba023763b418ef0660fb..886d74596ad0fe7088f13f4b0f26c5a0a81c09c9 100644
--- a/chrome/browser/io_thread.cc
+++ b/chrome/browser/io_thread.cc
@@ -463,17 +463,9 @@ IOThread::IOThread(
is_quic_allowed_by_policy_(true),
creation_time_(base::TimeTicks::Now()),
weak_factory_(this) {
- auth_schemes_ = local_state->GetString(prefs::kAuthSchemes);
- negotiate_disable_cname_lookup_ = local_state->GetBoolean(
- prefs::kDisableAuthNegotiateCnameLookup);
- negotiate_enable_port_ = local_state->GetBoolean(
- prefs::kEnableAuthNegotiatePort);
- auth_server_whitelist_ = local_state->GetString(prefs::kAuthServerWhitelist);
- auth_delegate_whitelist_ = local_state->GetString(
- prefs::kAuthNegotiateDelegateWhitelist);
- gssapi_library_name_ = local_state->GetString(prefs::kGSSAPILibraryName);
- auth_android_negotiate_account_type_ =
- local_state->GetString(prefs::kAuthAndroidNegotiateAccountType);
+ scoped_refptr<base::SingleThreadTaskRunner> io_thread_proxy =
+ BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO);
+ http_auth_preferences_.Init(local_state, io_thread_proxy);
pref_proxy_config_tracker_.reset(
ProxyServiceFactory::CreatePrefProxyConfigTrackerOfLocalState(
local_state));
@@ -499,13 +491,11 @@ IOThread::IOThread(
local_state,
base::Bind(&IOThread::UpdateDnsClientEnabled,
base::Unretained(this)));
- dns_client_enabled_.MoveToThread(
- BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO));
+ dns_client_enabled_.MoveToThread(io_thread_proxy);
quick_check_enabled_.Init(prefs::kQuickCheckEnabled,
local_state);
- quick_check_enabled_.MoveToThread(
- BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO));
+ quick_check_enabled_.MoveToThread(io_thread_proxy);
#if defined(ENABLE_CONFIGURATION_POLICY)
is_spdy_disabled_by_policy_ = policy_service->GetPolicies(
@@ -731,8 +721,7 @@ void IOThread::Init() {
globals_->ssl_config_service = GetSSLConfigService();
- globals_->http_auth_handler_factory.reset(CreateDefaultAuthHandlerFactory(
- globals_->host_resolver.get()));
+ CreateDefaultAuthHandlerFactory();
globals_->http_server_properties.reset(new net::HttpServerPropertiesImpl());
// For the ProxyScriptFetcher, we use a direct ProxyService.
globals_->proxy_script_fetcher_proxy_service =
@@ -870,6 +859,11 @@ void IOThread::CleanUp() {
network_change_observer_.reset();
system_proxy_config_service_.reset();
+#if defined(OS_ANDROID)
+ // Only needed for tests, since we never do a clean shutdown of the real
+ // application on Android.
+ external_data_use_observer_.reset();
+#endif
delete globals_;
globals_ = NULL;
@@ -990,16 +984,7 @@ void IOThread::ConfigureNPNGlobals(base::StringPiece npn_trial_group,
}
void IOThread::RegisterPrefs(PrefRegistrySimple* registry) {
- registry->RegisterStringPref(prefs::kAuthSchemes,
- "basic,digest,ntlm,negotiate");
- registry->RegisterBooleanPref(prefs::kDisableAuthNegotiateCnameLookup, false);
- registry->RegisterBooleanPref(prefs::kEnableAuthNegotiatePort, false);
- registry->RegisterStringPref(prefs::kAuthServerWhitelist, std::string());
- registry->RegisterStringPref(prefs::kAuthNegotiateDelegateWhitelist,
- std::string());
- registry->RegisterStringPref(prefs::kGSSAPILibraryName, std::string());
- registry->RegisterStringPref(prefs::kAuthAndroidNegotiateAccountType,
- std::string());
+ net::HttpAuthPreferences::RegisterPrefs(registry);
registry->RegisterStringPref(
data_reduction_proxy::prefs::kDataReductionProxy, std::string());
registry->RegisterBooleanPref(prefs::kEnableReferrers, true);
@@ -1008,30 +993,11 @@ void IOThread::RegisterPrefs(PrefRegistrySimple* registry) {
registry->RegisterBooleanPref(prefs::kQuickCheckEnabled, true);
}
-net::HttpAuthHandlerFactory* IOThread::CreateDefaultAuthHandlerFactory(
- net::HostResolver* resolver) {
- net::HttpAuthFilterWhitelist* auth_filter_default_credentials = NULL;
- if (!auth_server_whitelist_.empty()) {
- auth_filter_default_credentials =
- new net::HttpAuthFilterWhitelist(auth_server_whitelist_);
- }
- net::HttpAuthFilterWhitelist* auth_filter_delegate = NULL;
- if (!auth_delegate_whitelist_.empty()) {
- auth_filter_delegate =
- new net::HttpAuthFilterWhitelist(auth_delegate_whitelist_);
- }
- globals_->url_security_manager.reset(
- net::URLSecurityManager::Create(auth_filter_default_credentials,
- auth_filter_delegate));
- std::vector<std::string> supported_schemes = base::SplitString(
- auth_schemes_, ",", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
-
- scoped_ptr<net::HttpAuthHandlerRegistryFactory> registry_factory(
- net::HttpAuthHandlerRegistryFactory::Create(
- supported_schemes, globals_->url_security_manager.get(), resolver,
- gssapi_library_name_, auth_android_negotiate_account_type_,
- negotiate_disable_cname_lookup_, negotiate_enable_port_));
- return registry_factory.release();
+void IOThread::CreateDefaultAuthHandlerFactory() {
+ globals_->http_auth_handler_factory =
+ net::HttpAuthHandlerRegistryFactory::Create(&http_auth_preferences_,
+ globals_->host_resolver.get())
+ .Pass();
}
void IOThread::ClearHostCache() {

Powered by Google App Engine
This is Rietveld 408576698