Add CefSettings.auto_detect_proxy_settings_enabled option for enabling automatic proxy detection on Windows (issue #332).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@337 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt 2011-10-21 21:14:50 +00:00
parent c422ab5aa8
commit becadcfd16
3 changed files with 39 additions and 19 deletions

View File

@ -151,6 +151,15 @@ typedef struct _cef_settings_t
// Quota limit for sessionStorage data per namespace. Default size is 5MB.
///
unsigned int session_storage_quota;
#if defined(OS_WIN)
///
// Set to true (1) to use the system proxy resolver on Windows when
// "Automatically detect settings" is checked. This setting is disabled
// by default for performance reasons.
///
bool auto_detect_proxy_settings_enabled;
#endif
} cef_settings_t;
///

View File

@ -281,6 +281,13 @@ struct CefSettingsTraits {
copy);
target->log_severity = src->log_severity;
target->graphics_implementation = src->graphics_implementation;
target->local_storage_quota = src->local_storage_quota;
target->session_storage_quota = src->session_storage_quota;
#if defined(OS_WIN)
target->auto_detect_proxy_settings_enabled =
src->auto_detect_proxy_settings_enabled;
#endif
}
};

View File

@ -7,6 +7,7 @@
#include "browser_file_system.h"
#include "browser_persistent_cookie_store.h"
#include "browser_resource_loader_bridge.h"
#include "cef_context.h"
#include "cef_thread.h"
#include "base/compiler_specific.h"
@ -101,26 +102,29 @@ void BrowserRequestContext::Init(
set_accept_charset("iso-8859-1,*,utf-8");
#if defined(OS_WIN)
// Using the system proxy resolver on Windows when "Automatically detect
// settings" (auto-detection) is checked under LAN Settings can hurt resource
// loading performance because the call to WinHttpGetProxyForUrl in
// proxy_resolver_winhttp.cc will block the IO thread. This is especially
// true for Windows 7 where auto-detection is checked by default. To avoid
// slow resource loading on Windows we only use the system proxy resolver if
// auto-detection is unchecked.
WINHTTP_CURRENT_USER_IE_PROXY_CONFIG ie_config = {0};
if (WinHttpGetIEProxyConfigForCurrentUser(&ie_config)) {
if (ie_config.fAutoDetect == TRUE) {
storage_.set_proxy_service(net::ProxyService::CreateWithoutProxyResolver(
new ProxyConfigServiceNull(), NULL));
}
const CefSettings& settings = _Context->settings();
if (!settings.auto_detect_proxy_settings_enabled) {
// Using the system proxy resolver on Windows when "Automatically detect
// settings" (auto-detection) is checked under LAN Settings can hurt
// resource loading performance because the call to WinHttpGetProxyForUrl in
// proxy_resolver_winhttp.cc will block the IO thread. This is especially
// true for Windows 7 where auto-detection is checked by default. To avoid
// slow resource loading on Windows we only use the system proxy resolver if
// auto-detection is unchecked.
WINHTTP_CURRENT_USER_IE_PROXY_CONFIG ie_config = {0};
if (WinHttpGetIEProxyConfigForCurrentUser(&ie_config)) {
if (ie_config.fAutoDetect == TRUE) {
storage_.set_proxy_service(net::ProxyService::CreateWithoutProxyResolver(
new ProxyConfigServiceNull(), NULL));
}
if (ie_config.lpszAutoConfigUrl)
GlobalFree(ie_config.lpszAutoConfigUrl);
if (ie_config.lpszProxy)
GlobalFree(ie_config.lpszProxy);
if (ie_config.lpszProxyBypass)
GlobalFree(ie_config.lpszProxyBypass);
if (ie_config.lpszAutoConfigUrl)
GlobalFree(ie_config.lpszAutoConfigUrl);
if (ie_config.lpszProxy)
GlobalFree(ie_config.lpszProxy);
if (ie_config.lpszProxyBypass)
GlobalFree(ie_config.lpszProxyBypass);
}
}
#endif // defined(OS_WIN)