diff --git a/cef.gyp b/cef.gyp index 94d252280..36f9f3a29 100644 --- a/cef.gyp +++ b/cef.gyp @@ -418,11 +418,13 @@ '<(DEPTH)/content/content.gyp:content_worker', '<(DEPTH)/content/content_resources.gyp:content_resources', '<(DEPTH)/base/base.gyp:base', + '<(DEPTH)/base/base.gyp:base_prefs', '<(DEPTH)/base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', '<(DEPTH)/build/temp_gyp/googleurl.gyp:googleurl', '<(DEPTH)/ipc/ipc.gyp:ipc', '<(DEPTH)/media/media.gyp:media', '<(DEPTH)/net/net.gyp:net', + '<(DEPTH)/net/net.gyp:net_with_v8', '<(DEPTH)/skia/skia.gyp:skia', '<(DEPTH)/third_party/libxml/libxml.gyp:libxml', '<(DEPTH)/third_party/WebKit/Source/WebCore/WebCore.gyp/WebCore.gyp:webcore', @@ -770,11 +772,13 @@ '<(DEPTH)/content/content.gyp:content_worker', '<(DEPTH)/content/content_resources.gyp:content_resources', '<(DEPTH)/base/base.gyp:base', + '<(DEPTH)/base/base.gyp:base_prefs', '<(DEPTH)/base/third_party/dynamic_annotations/dynamic_annotations.gyp:dynamic_annotations', '<(DEPTH)/build/temp_gyp/googleurl.gyp:googleurl', '<(DEPTH)/ipc/ipc.gyp:ipc', '<(DEPTH)/media/media.gyp:media', '<(DEPTH)/net/net.gyp:net', + '<(DEPTH)/net/net.gyp:net_with_v8', '<(DEPTH)/skia/skia.gyp:skia', '<(DEPTH)/third_party/libxml/libxml.gyp:libxml', '<(DEPTH)/third_party/WebKit/Source/WebCore/WebCore.gyp/WebCore.gyp:webcore', @@ -802,6 +806,8 @@ 'libcef/browser/browser_message_filter.h', 'libcef/browser/browser_message_loop.cc', 'libcef/browser/browser_message_loop.h', + 'libcef/browser/browser_pref_store.cc', + 'libcef/browser/browser_pref_store.h', 'libcef/browser/browser_settings.cc', 'libcef/browser/browser_settings.h', 'libcef/browser/browser_urlrequest_impl.cc', @@ -842,6 +848,7 @@ 'libcef/browser/origin_whitelist_impl.h', 'libcef/browser/path_util_impl.cc', 'libcef/browser/process_util_impl.cc', + 'libcef/browser/proxy_stubs.cc', 'libcef/browser/resource_context.cc', 'libcef/browser/resource_context.h', 'libcef/browser/resource_dispatcher_host_delegate.cc', @@ -939,11 +946,39 @@ 'libcef/renderer/v8_impl.h', 'libcef/renderer/webkit_glue.cc', 'libcef/renderer/webkit_glue.h', + '<(DEPTH)/chrome/common/chrome_switches.cc', + '<(DEPTH)/chrome/common/chrome_switches.h', # Include sources for persistent cookie storage. '<(DEPTH)/chrome/browser/net/clear_on_exit_policy.cc', '<(DEPTH)/chrome/browser/net/clear_on_exit_policy.h', '<(DEPTH)/chrome/browser/net/sqlite_persistent_cookie_store.cc', '<(DEPTH)/chrome/browser/net/sqlite_persistent_cookie_store.h', + # Include sources for proxy support. + '<(DEPTH)/base/prefs/testing_pref_store.cc', + '<(DEPTH)/base/prefs/testing_pref_store.h', + '<(DEPTH)/chrome/browser/net/pref_proxy_config_tracker.h', + '<(DEPTH)/chrome/browser/net/pref_proxy_config_tracker_impl.cc', + '<(DEPTH)/chrome/browser/net/pref_proxy_config_tracker_impl.h', + '<(DEPTH)/chrome/browser/net/proxy_service_factory.cc', + '<(DEPTH)/chrome/browser/net/proxy_service_factory.h', + '<(DEPTH)/chrome/browser/prefs/command_line_pref_store.cc', + '<(DEPTH)/chrome/browser/prefs/command_line_pref_store.h', + '<(DEPTH)/chrome/browser/prefs/pref_notifier_impl.cc', + '<(DEPTH)/chrome/browser/prefs/pref_notifier_impl.h', + '<(DEPTH)/chrome/browser/prefs/pref_service.cc', + '<(DEPTH)/chrome/browser/prefs/pref_service.h', + '<(DEPTH)/chrome/browser/prefs/pref_service_builder.cc', + '<(DEPTH)/chrome/browser/prefs/pref_service_builder.h', + '<(DEPTH)/chrome/browser/prefs/pref_service_simple.cc', + '<(DEPTH)/chrome/browser/prefs/pref_service_simple.h', + '<(DEPTH)/chrome/browser/prefs/pref_value_store.cc', + '<(DEPTH)/chrome/browser/prefs/pref_value_store.h', + '<(DEPTH)/chrome/browser/prefs/proxy_config_dictionary.cc', + '<(DEPTH)/chrome/browser/prefs/proxy_config_dictionary.h', + '<(DEPTH)/chrome/browser/prefs/proxy_prefs.cc', + '<(DEPTH)/chrome/browser/prefs/proxy_prefs.h', + '<(DEPTH)/chrome/common/pref_names.cc', + '<(DEPTH)/chrome/common/pref_names.h', ], 'conditions': [ ['OS=="win"', { diff --git a/cef_paths.gypi b/cef_paths.gypi index bf4552d5e..f3f282437 100644 --- a/cef_paths.gypi +++ b/cef_paths.gypi @@ -38,7 +38,6 @@ 'include/cef_path_util.h', 'include/cef_process_message.h', 'include/cef_process_util.h', - 'include/cef_proxy_handler.h', 'include/cef_render_handler.h', 'include/cef_render_process_handler.h', 'include/cef_request.h', @@ -86,7 +85,6 @@ 'include/capi/cef_path_util_capi.h', 'include/capi/cef_process_message_capi.h', 'include/capi/cef_process_util_capi.h', - 'include/capi/cef_proxy_handler_capi.h', 'include/capi/cef_render_handler_capi.h', 'include/capi/cef_render_process_handler_capi.h', 'include/capi/cef_request_capi.h', @@ -190,8 +188,6 @@ 'libcef_dll/cpptoc/post_data_element_cpptoc.h', 'libcef_dll/cpptoc/process_message_cpptoc.cc', 'libcef_dll/cpptoc/process_message_cpptoc.h', - 'libcef_dll/ctocpp/proxy_handler_ctocpp.cc', - 'libcef_dll/ctocpp/proxy_handler_ctocpp.h', 'libcef_dll/cpptoc/quota_callback_cpptoc.cc', 'libcef_dll/cpptoc/quota_callback_cpptoc.h', 'libcef_dll/ctocpp/read_handler_ctocpp.cc', @@ -342,8 +338,6 @@ 'libcef_dll/ctocpp/post_data_element_ctocpp.h', 'libcef_dll/ctocpp/process_message_ctocpp.cc', 'libcef_dll/ctocpp/process_message_ctocpp.h', - 'libcef_dll/cpptoc/proxy_handler_cpptoc.cc', - 'libcef_dll/cpptoc/proxy_handler_cpptoc.h', 'libcef_dll/ctocpp/quota_callback_ctocpp.cc', 'libcef_dll/ctocpp/quota_callback_ctocpp.h', 'libcef_dll/cpptoc/read_handler_cpptoc.cc', diff --git a/include/capi/cef_browser_process_handler_capi.h b/include/capi/cef_browser_process_handler_capi.h index b41d66ef1..fe56ff168 100644 --- a/include/capi/cef_browser_process_handler_capi.h +++ b/include/capi/cef_browser_process_handler_capi.h @@ -56,14 +56,6 @@ typedef struct _cef_browser_process_handler_t { /// cef_base_t base; - /// - // Return the handler for proxy events. If no handler is returned the default - // system handler will be used. This function is called on the browser process - // IO thread. - /// - struct _cef_proxy_handler_t* (CEF_CALLBACK *get_proxy_handler)( - struct _cef_browser_process_handler_t* self); - /// // Called on the browser process UI thread immediately after the CEF context // has been initialized. diff --git a/include/capi/cef_proxy_handler_capi.h b/include/capi/cef_proxy_handler_capi.h deleted file mode 100644 index 1ed15c560..000000000 --- a/include/capi/cef_proxy_handler_capi.h +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) 2013 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool and should not edited -// by hand. See the translator.README.txt file in the tools directory for -// more information. -// - -#ifndef CEF_INCLUDE_CAPI_CEF_PROXY_HANDLER_CAPI_H_ -#define CEF_INCLUDE_CAPI_CEF_PROXY_HANDLER_CAPI_H_ -#pragma once - -#ifdef __cplusplus -extern "C" { -#endif - -#include "include/capi/cef_base_capi.h" - - -/// -// Implement this structure to handle proxy resolution events. -/// -typedef struct _cef_proxy_handler_t { - /// - // Base structure. - /// - cef_base_t base; - - /// - // Called to retrieve proxy information for the specified |url|. - /// - void (CEF_CALLBACK *get_proxy_for_url)(struct _cef_proxy_handler_t* self, - const cef_string_t* url, struct _cef_proxy_info_t* proxy_info); -} cef_proxy_handler_t; - - -#ifdef __cplusplus -} -#endif - -#endif // CEF_INCLUDE_CAPI_CEF_PROXY_HANDLER_CAPI_H_ diff --git a/include/cef_browser_process_handler.h b/include/cef_browser_process_handler.h index 39e0dcbb1..66cc28621 100644 --- a/include/cef_browser_process_handler.h +++ b/include/cef_browser_process_handler.h @@ -40,7 +40,6 @@ #include "include/cef_base.h" #include "include/cef_command_line.h" -#include "include/cef_proxy_handler.h" #include "include/cef_values.h" /// @@ -50,16 +49,6 @@ /*--cef(source=client)--*/ class CefBrowserProcessHandler : public virtual CefBase { public: - /// - // Return the handler for proxy events. If no handler is returned the default - // system handler will be used. This method is called on the browser process - // IO thread. - /// - /*--cef()--*/ - virtual CefRefPtr GetProxyHandler() { - return NULL; - } - /// // Called on the browser process UI thread immediately after the CEF context // has been initialized. diff --git a/include/cef_proxy_handler.h b/include/cef_proxy_handler.h deleted file mode 100644 index d40c67d7c..000000000 --- a/include/cef_proxy_handler.h +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) 2011 Marshall A. Greenblatt. All rights reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the name Chromium Embedded -// Framework nor the names of its contributors may be used to endorse -// or promote products derived from this software without specific prior -// written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// --------------------------------------------------------------------------- -// -// The contents of this file must follow a specific format in order to -// support the CEF translator tool. See the translator.README.txt file in the -// tools directory for more information. -// - -#ifndef CEF_INCLUDE_CEF_PROXY_HANDLER_H_ -#define CEF_INCLUDE_CEF_PROXY_HANDLER_H_ -#pragma once - -#include "include/cef_base.h" - -/// -// Implement this interface to handle proxy resolution events. -/// -/*--cef(source=client)--*/ -class CefProxyHandler : public virtual CefBase { - public: - /// - // Called to retrieve proxy information for the specified |url|. - /// - /*--cef()--*/ - virtual void GetProxyForUrl(const CefString& url, - CefProxyInfo& proxy_info) {} -}; - -#endif // CEF_INCLUDE_CEF_PROXY_HANDLER_H_ diff --git a/include/internal/cef_types.h b/include/internal/cef_types.h index d6772fb5b..bca90a8fa 100644 --- a/include/internal/cef_types.h +++ b/include/internal/cef_types.h @@ -220,13 +220,6 @@ typedef struct _cef_settings_t { /// cef_string_t javascript_flags; - /// - // 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; - /// // The fully qualified path for the resources directory. If this value is // empty the cef.pak and/or devtools_resources.pak files must be located in @@ -1277,23 +1270,6 @@ typedef struct _cef_popup_features_t { cef_string_list_t additionalFeatures; } cef_popup_features_t; -/// -// Proxy types. -/// -enum cef_proxy_type_t { - CEF_PROXY_TYPE_DIRECT = 0, - CEF_PROXY_TYPE_NAMED, - CEF_PROXY_TYPE_PAC_STRING, -}; - -/// -// Proxy information. -/// -typedef struct _cef_proxy_info_t { - enum cef_proxy_type_t proxyType; - cef_string_t proxyList; -} cef_proxy_info_t; - /// // DOM document types. /// diff --git a/include/internal/cef_types_wrappers.h b/include/internal/cef_types_wrappers.h index 54e9dc917..bd5f838f5 100644 --- a/include/internal/cef_types_wrappers.h +++ b/include/internal/cef_types_wrappers.h @@ -311,9 +311,6 @@ struct CefSettingsTraits { cef_string_set(src->javascript_flags.str, src->javascript_flags.length, &target->javascript_flags, copy); - target->auto_detect_proxy_settings_enabled = - src->auto_detect_proxy_settings_enabled; - cef_string_set(src->resources_dir_path.str, src->resources_dir_path.length, &target->resources_dir_path, copy); cef_string_set(src->locales_dir_path.str, src->locales_dir_path.length, @@ -561,65 +558,6 @@ struct CefCookieTraits { typedef CefStructBase CefCookie; -struct CefProxyInfoTraits { - typedef cef_proxy_info_t struct_type; - - static inline void init(struct_type* s) {} - - static inline void clear(struct_type* s) { - cef_string_clear(&s->proxyList); - } - - static inline void set(const struct_type* src, struct_type* target, - bool copy) { - target->proxyType = src->proxyType; - cef_string_set(src->proxyList.str, src->proxyList.length, - &target->proxyList, copy); - } -}; - -/// -// Class representing the results of proxy resolution. -/// -class CefProxyInfo : public CefStructBase { - public: - /// - // Use a direction connection instead of a proxy. - /// - void UseDirect() { - proxyType = CEF_PROXY_TYPE_DIRECT; - } - - /// - // Use one or more named proxy servers specified in WinHTTP format. Each proxy - // server is of the form: - // - // ["://"][":"] - // - // Multiple values may be separated by semicolons or whitespace. For example, - // "foo1:80;foo2:80". - /// - void UseNamedProxy(const CefString& proxy_uri_list) { - proxyType = CEF_PROXY_TYPE_NAMED; - (CefString(&proxyList)) = proxy_uri_list; - } - - /// - // Use one or more named proxy servers specified in PAC script format. For - // example, "PROXY foobar:99; SOCKS fml:2; DIRECT". - /// - void UsePacString(const CefString& pac_string) { - proxyType = CEF_PROXY_TYPE_PAC_STRING; - (CefString(&proxyList)) = pac_string; - } - - bool IsDirect() const { return proxyType == CEF_PROXY_TYPE_DIRECT; } - bool IsNamedProxy() const { return proxyType == CEF_PROXY_TYPE_NAMED; } - bool IsPacString() const { return proxyType == CEF_PROXY_TYPE_PAC_STRING; } - - CefString ProxyList() const { return CefString(&proxyList); } -}; - struct CefGeopositionTraits { typedef cef_geoposition_t struct_type; diff --git a/libcef/browser/browser_main.cc b/libcef/browser/browser_main.cc index bab0152d6..e875f3069 100644 --- a/libcef/browser/browser_main.cc +++ b/libcef/browser/browser_main.cc @@ -14,6 +14,7 @@ #include "base/command_line.h" #include "base/message_loop.h" #include "base/string_number_conversions.h" +#include "chrome/browser/net/proxy_service_factory.h" #include "content/public/browser/gpu_data_manager.h" #include "content/public/common/content_client.h" #include "content/public/common/content_switches.h" @@ -54,12 +55,28 @@ int CefBrowserMainParts::PreCreateThreads() { // before the IO thread is started. content::GpuDataManager::GetInstance(); + // Initialize user preferences. + user_prefs_ = new BrowserPrefStore(); + user_prefs_->SetInitializationCompleted(); + + // Initialize proxy configuration tracker. + pref_proxy_config_tracker_.reset( + ProxyServiceFactory::CreatePrefProxyConfigTracker( + user_prefs_->CreateService())); + return 0; } void CefBrowserMainParts::PreMainMessageLoopRun() { browser_context_.reset(new CefBrowserContext()); + // Initialize proxy configuration service. + ChromeProxyConfigService* chrome_proxy_config_service = + ProxyServiceFactory::CreateProxyConfigService(true); + proxy_config_service_.reset(chrome_proxy_config_service); + pref_proxy_config_tracker_->SetChromeProxyConfigService( + chrome_proxy_config_service); + const CommandLine& command_line = *CommandLine::ForCurrentProcess(); if (command_line.HasSwitch(switches::kRemoteDebuggingPort)) { std::string port_str = @@ -76,9 +93,12 @@ void CefBrowserMainParts::PreMainMessageLoopRun() { void CefBrowserMainParts::PostMainMessageLoopRun() { if (devtools_delegate_) devtools_delegate_->Stop(); + pref_proxy_config_tracker_->DetachFromPrefService(); browser_context_.reset(); } void CefBrowserMainParts::PostDestroyThreads() { + pref_proxy_config_tracker_.reset(NULL); + PlatformCleanup(); } diff --git a/libcef/browser/browser_main.h b/libcef/browser/browser_main.h index ffbad5d32..19f3aa794 100644 --- a/libcef/browser/browser_main.h +++ b/libcef/browser/browser_main.h @@ -6,10 +6,14 @@ #define CEF_LIBCEF_BROWSER_BROWSER_MAIN_H_ #pragma once +#include "libcef/browser/browser_pref_store.h" + #include "base/basictypes.h" #include "base/memory/scoped_ptr.h" #include "base/string_piece.h" +#include "chrome/browser/net/pref_proxy_config_tracker.h" #include "content/public/browser/browser_main_parts.h" +#include "net/proxy/proxy_config_service.h" namespace base { class Thread; @@ -36,15 +40,20 @@ class CefBrowserMainParts : public content::BrowserMainParts { CefBrowserContext* browser_context() const { return browser_context_.get(); } CefDevToolsDelegate* devtools_delegate() const { return devtools_delegate_; } + scoped_ptr proxy_config_service() { + return proxy_config_service_.Pass(); + } private: void PlatformInitialize(); void PlatformCleanup(); scoped_ptr browser_context_; - - scoped_ptr message_loop_; CefDevToolsDelegate* devtools_delegate_; + scoped_ptr message_loop_; + scoped_ptr pref_proxy_config_tracker_; + scoped_ptr proxy_config_service_; + scoped_refptr user_prefs_; DISALLOW_COPY_AND_ASSIGN(CefBrowserMainParts); }; diff --git a/libcef/browser/browser_pref_store.cc b/libcef/browser/browser_pref_store.cc new file mode 100644 index 000000000..82e14f9cf --- /dev/null +++ b/libcef/browser/browser_pref_store.cc @@ -0,0 +1,34 @@ +// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +#include "libcef/browser/browser_pref_store.h" + +#include "base/command_line.h" +#include "base/values.h" +#include "chrome/browser/prefs/command_line_pref_store.h" +#include "chrome/browser/prefs/pref_service_builder.h" +#include "chrome/browser/prefs/pref_service_simple.h" +#include "chrome/browser/prefs/proxy_config_dictionary.h" +#include "chrome/common/pref_names.h" + +BrowserPrefStore::BrowserPrefStore() { +} + +PrefService* BrowserPrefStore::CreateService() { + PrefServiceBuilder builder; + builder.WithCommandLinePrefs( + new CommandLinePrefStore(CommandLine::ForCurrentProcess())); + builder.WithUserPrefs(this); + + PrefServiceSimple* service = builder.CreateSimple(); + + // Default settings. + service->RegisterDictionaryPref(prefs::kProxy, + ProxyConfigDictionary::CreateDirect()); + + return service; +} + +BrowserPrefStore::~BrowserPrefStore() { +} diff --git a/libcef/browser/browser_pref_store.h b/libcef/browser/browser_pref_store.h new file mode 100644 index 000000000..1a26335b8 --- /dev/null +++ b/libcef/browser/browser_pref_store.h @@ -0,0 +1,24 @@ +// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights +// reserved. Use of this source code is governed by a BSD-style license that can +// be found in the LICENSE file. + +#ifndef CEF_LIBCEF_BROWSER_BROWSER_PREF_STORE_H_ +#define CEF_LIBCEF_BROWSER_BROWSER_PREF_STORE_H_ + +#include "base/prefs/testing_pref_store.h" + +class PrefService; + +class BrowserPrefStore : public TestingPrefStore { + public: + BrowserPrefStore(); + + PrefService* CreateService(); + + protected: + virtual ~BrowserPrefStore(); + + DISALLOW_COPY_AND_ASSIGN(BrowserPrefStore); +}; + +#endif // CEF_LIBCEF_BROWSER_BROWSER_PREF_STORE_H_ diff --git a/libcef/browser/content_browser_client.cc b/libcef/browser/content_browser_client.cc index 4b4ea7d4b..be64046cc 100644 --- a/libcef/browser/content_browser_client.cc +++ b/libcef/browser/content_browser_client.cc @@ -23,6 +23,7 @@ #include "base/command_line.h" #include "base/file_path.h" #include "base/path_service.h" +#include "chrome/common/chrome_switches.h" #include "content/browser/plugin_service_impl.h" #include "content/public/browser/access_token_store.h" #include "content/public/browser/browser_url_handler.h" diff --git a/libcef/browser/context.cc b/libcef/browser/context.cc index 32e7338a4..1c056edce 100644 --- a/libcef/browser/context.cc +++ b/libcef/browser/context.cc @@ -304,6 +304,11 @@ CefDevToolsDelegate* CefContext::devtools_delegate() const { devtools_delegate(); } +scoped_ptr CefContext::proxy_config_service() const { + return main_delegate_->browser_client()->browser_main_parts()-> + proxy_config_service(); +} + CefTraceSubscriber* CefContext::GetTraceSubscriber() { CEF_REQUIRE_UIT(); if (shutting_down_) diff --git a/libcef/browser/context.h b/libcef/browser/context.h index c40d6398a..5d2d1b365 100644 --- a/libcef/browser/context.h +++ b/libcef/browser/context.h @@ -17,6 +17,7 @@ #include "base/files/scoped_temp_dir.h" #include "base/memory/scoped_ptr.h" #include "base/threading/platform_thread.h" +#include "net/proxy/proxy_config_service.h" namespace base { class WaitableEvent; @@ -66,6 +67,9 @@ class CefContext : public CefBase { CefBrowserContext* browser_context() const; CefDevToolsDelegate* devtools_delegate() const; + // Passes ownership. + scoped_ptr proxy_config_service() const; + CefTraceSubscriber* GetTraceSubscriber(); private: diff --git a/libcef/browser/proxy_stubs.cc b/libcef/browser/proxy_stubs.cc new file mode 100644 index 000000000..054b268c9 --- /dev/null +++ b/libcef/browser/proxy_stubs.cc @@ -0,0 +1,12 @@ +// Copyright (c) 2012 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/prefs/pref_service_syncable.h" + +// Required by PrefProxyConfigTrackerImpl::RegisterUserPrefs. +void PrefServiceSyncable::RegisterDictionaryPref(const char* path, + DictionaryValue* default_value, + PrefSyncStatus sync_status) { + NOTREACHED(); +} diff --git a/libcef/browser/url_request_context_getter.cc b/libcef/browser/url_request_context_getter.cc index 85003232e..8b9af3fea 100644 --- a/libcef/browser/url_request_context_getter.cc +++ b/libcef/browser/url_request_context_getter.cc @@ -16,6 +16,7 @@ #include "libcef/browser/url_request_context_proxy.h" #include "libcef/browser/url_request_interceptor.h" +#include "base/command_line.h" #include "base/file_util.h" #include "base/logging.h" #include "base/stl_util.h" @@ -23,6 +24,7 @@ #include "base/string_util.h" #include "base/threading/thread_restrictions.h" #include "base/threading/worker_pool.h" +#include "chrome/browser/net/proxy_service_factory.h" #include "chrome/browser/net/sqlite_persistent_cookie_store.h" #include "content/public/browser/browser_thread.h" #include "net/base/cert_verifier.h" @@ -35,9 +37,6 @@ #include "net/http/http_auth_handler_factory.h" #include "net/http/http_cache.h" #include "net/http/http_server_properties_impl.h" -#include "net/proxy/proxy_config_service.h" -#include "net/proxy/proxy_config_service_fixed.h" -#include "net/proxy/proxy_resolver.h" #include "net/proxy/proxy_service.h" #include "net/url_request/static_http_user_agent_settings.h" #include "net/url_request/url_request.h" @@ -52,76 +51,6 @@ using content::BrowserThread; #pragma comment(lib, "winhttp.lib") #endif -namespace { - -#if defined(OS_WIN) - -// ProxyConfigService implementation that does nothing. -class ProxyConfigServiceNull : public net::ProxyConfigService { - public: - ProxyConfigServiceNull() {} - virtual void AddObserver(Observer* observer) OVERRIDE {} - virtual void RemoveObserver(Observer* observer) OVERRIDE {} - virtual ProxyConfigService::ConfigAvailability - GetLatestProxyConfig(net::ProxyConfig* config) OVERRIDE { - return ProxyConfigService::CONFIG_VALID; - } - virtual void OnLazyPoll() OVERRIDE {} - - DISALLOW_COPY_AND_ASSIGN(ProxyConfigServiceNull); -}; - -#endif // defined(OS_WIN) - -// ProxyResolver implementation that forewards resolution to a CefProxyHandler. -class CefProxyResolver : public net::ProxyResolver { - public: - explicit CefProxyResolver(CefRefPtr handler) - : ProxyResolver(false), - handler_(handler) {} - virtual ~CefProxyResolver() {} - - virtual int GetProxyForURL(const GURL& url, - net::ProxyInfo* results, - const net::CompletionCallback& callback, - RequestHandle* request, - const net::BoundNetLog& net_log) OVERRIDE { - CefProxyInfo proxy_info; - handler_->GetProxyForUrl(url.spec(), proxy_info); - if (proxy_info.IsDirect()) - results->UseDirect(); - else if (proxy_info.IsNamedProxy()) - results->UseNamedProxy(proxy_info.ProxyList()); - else if (proxy_info.IsPacString()) - results->UsePacString(proxy_info.ProxyList()); - - return net::OK; - } - - virtual int SetPacScript( - const scoped_refptr& pac_script, - const net::CompletionCallback& callback) OVERRIDE { - return net::OK; - } - - virtual void CancelRequest(RequestHandle request) OVERRIDE {} - virtual net::LoadState GetLoadState(RequestHandle request) const OVERRIDE { - return net::LOAD_STATE_IDLE; - } - virtual net::LoadState GetLoadStateThreadSafe(RequestHandle request) const - OVERRIDE { - return net::LOAD_STATE_IDLE; - } - virtual void CancelSetPacScript() OVERRIDE {} - - protected: - CefRefPtr handler_; - - DISALLOW_COPY_AND_ASSIGN(CefProxyResolver); -}; - -} // namespace - CefURLRequestContextGetter::CefURLRequestContextGetter( bool ignore_certificate_errors, const FilePath& base_path, @@ -133,13 +62,6 @@ CefURLRequestContextGetter::CefURLRequestContextGetter( file_loop_(file_loop) { // Must first be created on the UI thread. CEF_REQUIRE_UIT(); - -#if !defined(OS_WIN) - // We must create the proxy config service on the UI loop on Linux because it - // must synchronously run on the glib message loop. This will be passed to - // the URLRequestContextStorage on the IO thread in GetURLRequestContext(). - CreateProxyConfigService(); -#endif } CefURLRequestContextGetter::~CefURLRequestContextGetter() { @@ -152,6 +74,7 @@ net::URLRequestContext* CefURLRequestContextGetter::GetURLRequestContext() { if (!url_request_context_.get()) { const FilePath& cache_path = _Context->cache_path(); + const CommandLine& command_line = *CommandLine::ForCurrentProcess(); url_request_context_.reset(new net::URLRequestContext()); storage_.reset( @@ -171,64 +94,14 @@ net::URLRequestContext* CefURLRequestContextGetter::GetURLRequestContext() { storage_->set_host_resolver(net::HostResolver::CreateDefaultResolver(NULL)); storage_->set_cert_verifier(net::CertVerifier::CreateDefault()); - bool proxy_service_set = false; - - CefRefPtr app = _Context->application(); - if (app.get()) { - CefRefPtr handler = - app->GetBrowserProcessHandler(); - if (handler.get()) { - CefRefPtr proxy_handler = handler->GetProxyHandler(); - if (proxy_handler.get()) { - // The client will provide proxy resolution. - CreateProxyConfigService(); - storage_->set_proxy_service( - new net::ProxyService(proxy_config_service_.release(), - new CefProxyResolver(proxy_handler), NULL)); - proxy_service_set = true; - } - } - } - - // TODO(jam): use v8 if possible, look at chrome code. -#if defined(OS_WIN) - if (!proxy_service_set) { - 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)); - proxy_service_set = true; - } - - 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) - - if (!proxy_service_set) { - CreateProxyConfigService(); - storage_->set_proxy_service( - net::ProxyService::CreateUsingSystemProxyResolver( - proxy_config_service_.release(), 0, NULL)); - } + scoped_ptr system_proxy_service; + system_proxy_service.reset( + ProxyServiceFactory::CreateProxyService( + NULL, + url_request_context_.get(), + _Context->proxy_config_service().release(), + command_line)); + storage_->set_proxy_service(system_proxy_service.release()); storage_->set_ssl_config_service(new net::SSLConfigServiceDefaults); diff --git a/libcef/common/cef_switches.cc b/libcef/common/cef_switches.cc index 33ad67f05..9f8ffcc1d 100644 --- a/libcef/common/cef_switches.cc +++ b/libcef/common/cef_switches.cc @@ -6,9 +6,6 @@ namespace switches { -// Product version string. -const char kProductVersion[] = "product-version"; - // Log file path. const char kLogFile[] = "log-file"; diff --git a/libcef/common/cef_switches.h b/libcef/common/cef_switches.h index 762811105..8b58e7e6d 100644 --- a/libcef/common/cef_switches.h +++ b/libcef/common/cef_switches.h @@ -10,7 +10,6 @@ namespace switches { -extern const char kProductVersion[]; extern const char kLogFile[]; extern const char kLogSeverity[]; extern const char kLogSeverity_Verbose[]; diff --git a/libcef/common/content_client.cc b/libcef/common/content_client.cc index d99e0dc84..cce784192 100644 --- a/libcef/common/content_client.cc +++ b/libcef/common/content_client.cc @@ -6,13 +6,13 @@ #include "include/cef_stream.h" #include "include/cef_version.h" #include "libcef/browser/scheme_registration.h" -#include "libcef/common/cef_switches.h" #include "libcef/common/scheme_registrar_impl.h" #include "base/command_line.h" #include "base/logging.h" #include "base/string_piece.h" #include "base/stringprintf.h" +#include "chrome/common/chrome_switches.h" #include "content/public/common/content_switches.h" #include "ui/base/resource/resource_bundle.h" #include "webkit/user_agent/user_agent_util.h" diff --git a/libcef/common/main_delegate.cc b/libcef/common/main_delegate.cc index 130c69db7..be52ab5ab 100644 --- a/libcef/common/main_delegate.cc +++ b/libcef/common/main_delegate.cc @@ -17,6 +17,7 @@ #include "base/string_util.h" #include "base/synchronization/waitable_event.h" #include "base/threading/thread.h" +#include "chrome/common/chrome_switches.h" #include "content/public/browser/browser_main_runner.h" #include "content/public/browser/render_process_host.h" #include "content/public/common/content_switches.h" diff --git a/libcef_dll/cpptoc/browser_process_handler_cpptoc.cc b/libcef_dll/cpptoc/browser_process_handler_cpptoc.cc index 380053a7b..6e755915a 100644 --- a/libcef_dll/cpptoc/browser_process_handler_cpptoc.cc +++ b/libcef_dll/cpptoc/browser_process_handler_cpptoc.cc @@ -11,29 +11,12 @@ // #include "libcef_dll/cpptoc/browser_process_handler_cpptoc.h" -#include "libcef_dll/cpptoc/proxy_handler_cpptoc.h" #include "libcef_dll/ctocpp/command_line_ctocpp.h" #include "libcef_dll/ctocpp/list_value_ctocpp.h" // MEMBER FUNCTIONS - Body may be edited by hand. -struct _cef_proxy_handler_t* CEF_CALLBACK browser_process_handler_get_proxy_handler( - struct _cef_browser_process_handler_t* self) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return NULL; - - // Execute - CefRefPtr _retval = CefBrowserProcessHandlerCppToC::Get( - self)->GetProxyHandler(); - - // Return type: refptr_same - return CefProxyHandlerCppToC::Wrap(_retval); -} - void CEF_CALLBACK browser_process_handler_on_context_initialized( struct _cef_browser_process_handler_t* self) { // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING @@ -89,7 +72,6 @@ CefBrowserProcessHandlerCppToC::CefBrowserProcessHandlerCppToC( CefBrowserProcessHandler* cls) : CefCppToC(cls) { - struct_.struct_.get_proxy_handler = browser_process_handler_get_proxy_handler; struct_.struct_.on_context_initialized = browser_process_handler_on_context_initialized; struct_.struct_.on_before_child_process_launch = diff --git a/libcef_dll/cpptoc/proxy_handler_cpptoc.cc b/libcef_dll/cpptoc/proxy_handler_cpptoc.cc deleted file mode 100644 index 98aaeb7b5..000000000 --- a/libcef_dll/cpptoc/proxy_handler_cpptoc.cc +++ /dev/null @@ -1,63 +0,0 @@ -// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool. If making changes by -// hand only do so within the body of existing method and function -// implementations. See the translator.README.txt file in the tools directory -// for more information. -// - -#include "libcef_dll/cpptoc/proxy_handler_cpptoc.h" - - -// MEMBER FUNCTIONS - Body may be edited by hand. - -void CEF_CALLBACK proxy_handler_get_proxy_for_url( - struct _cef_proxy_handler_t* self, const cef_string_t* url, - struct _cef_proxy_info_t* proxy_info) { - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - DCHECK(self); - if (!self) - return; - // Verify param: url; type: string_byref_const - DCHECK(url); - if (!url) - return; - // Verify param: proxy_info; type: struct_byref - DCHECK(proxy_info); - if (!proxy_info) - return; - - // Translate param: proxy_info; type: struct_byref - CefProxyInfo proxy_infoObj; - if (proxy_info) - proxy_infoObj.AttachTo(*proxy_info); - - // Execute - CefProxyHandlerCppToC::Get(self)->GetProxyForUrl( - CefString(url), - proxy_infoObj); - - // Restore param: proxy_info; type: struct_byref - if (proxy_info) - proxy_infoObj.DetachTo(*proxy_info); -} - - -// CONSTRUCTOR - Do not edit by hand. - -CefProxyHandlerCppToC::CefProxyHandlerCppToC(CefProxyHandler* cls) - : CefCppToC( - cls) { - struct_.struct_.get_proxy_for_url = proxy_handler_get_proxy_for_url; -} - -#ifndef NDEBUG -template<> long CefCppToC::DebugObjCt = 0; -#endif - diff --git a/libcef_dll/cpptoc/proxy_handler_cpptoc.h b/libcef_dll/cpptoc/proxy_handler_cpptoc.h deleted file mode 100644 index 560b82698..000000000 --- a/libcef_dll/cpptoc/proxy_handler_cpptoc.h +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool. If making changes by -// hand only do so within the body of existing method and function -// implementations. See the translator.README.txt file in the tools directory -// for more information. -// - -#ifndef CEF_LIBCEF_DLL_CPPTOC_PROXY_HANDLER_CPPTOC_H_ -#define CEF_LIBCEF_DLL_CPPTOC_PROXY_HANDLER_CPPTOC_H_ -#pragma once - -#ifndef USING_CEF_SHARED -#pragma message("Warning: "__FILE__" may be accessed wrapper-side only") -#else // USING_CEF_SHARED - -#include "include/cef_proxy_handler.h" -#include "include/capi/cef_proxy_handler_capi.h" -#include "libcef_dll/cpptoc/cpptoc.h" - -// Wrap a C++ class with a C structure. -// This class may be instantiated and accessed wrapper-side only. -class CefProxyHandlerCppToC - : public CefCppToC { - public: - explicit CefProxyHandlerCppToC(CefProxyHandler* cls); - virtual ~CefProxyHandlerCppToC() {} -}; - -#endif // USING_CEF_SHARED -#endif // CEF_LIBCEF_DLL_CPPTOC_PROXY_HANDLER_CPPTOC_H_ - diff --git a/libcef_dll/ctocpp/browser_process_handler_ctocpp.cc b/libcef_dll/ctocpp/browser_process_handler_ctocpp.cc index 53acb944a..fe5d45d96 100644 --- a/libcef_dll/ctocpp/browser_process_handler_ctocpp.cc +++ b/libcef_dll/ctocpp/browser_process_handler_ctocpp.cc @@ -13,24 +13,10 @@ #include "libcef_dll/cpptoc/command_line_cpptoc.h" #include "libcef_dll/cpptoc/list_value_cpptoc.h" #include "libcef_dll/ctocpp/browser_process_handler_ctocpp.h" -#include "libcef_dll/ctocpp/proxy_handler_ctocpp.h" // VIRTUAL METHODS - Body may be edited by hand. -CefRefPtr CefBrowserProcessHandlerCToCpp::GetProxyHandler() { - if (CEF_MEMBER_MISSING(struct_, get_proxy_handler)) - return NULL; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Execute - cef_proxy_handler_t* _retval = struct_->get_proxy_handler(struct_); - - // Return type: refptr_same - return CefProxyHandlerCToCpp::Wrap(_retval); -} - void CefBrowserProcessHandlerCToCpp::OnContextInitialized() { if (CEF_MEMBER_MISSING(struct_, on_context_initialized)) return; diff --git a/libcef_dll/ctocpp/browser_process_handler_ctocpp.h b/libcef_dll/ctocpp/browser_process_handler_ctocpp.h index 1d0a597cf..98cff43a5 100644 --- a/libcef_dll/ctocpp/browser_process_handler_ctocpp.h +++ b/libcef_dll/ctocpp/browser_process_handler_ctocpp.h @@ -34,7 +34,6 @@ class CefBrowserProcessHandlerCToCpp virtual ~CefBrowserProcessHandlerCToCpp() {} // CefBrowserProcessHandler methods - virtual CefRefPtr GetProxyHandler() OVERRIDE; virtual void OnContextInitialized() OVERRIDE; virtual void OnBeforeChildProcessLaunch( CefRefPtr command_line) OVERRIDE; diff --git a/libcef_dll/ctocpp/proxy_handler_ctocpp.cc b/libcef_dll/ctocpp/proxy_handler_ctocpp.cc deleted file mode 100644 index f93baa12c..000000000 --- a/libcef_dll/ctocpp/proxy_handler_ctocpp.cc +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool. If making changes by -// hand only do so within the body of existing method and function -// implementations. See the translator.README.txt file in the tools directory -// for more information. -// - -#include "libcef_dll/ctocpp/proxy_handler_ctocpp.h" - - -// VIRTUAL METHODS - Body may be edited by hand. - -void CefProxyHandlerCToCpp::GetProxyForUrl(const CefString& url, - CefProxyInfo& proxy_info) { - if (CEF_MEMBER_MISSING(struct_, get_proxy_for_url)) - return; - - // AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING - - // Verify param: url; type: string_byref_const - DCHECK(!url.empty()); - if (url.empty()) - return; - - // Execute - struct_->get_proxy_for_url(struct_, - url.GetStruct(), - &proxy_info); -} - - -#ifndef NDEBUG -template<> long CefCToCpp::DebugObjCt = 0; -#endif - diff --git a/libcef_dll/ctocpp/proxy_handler_ctocpp.h b/libcef_dll/ctocpp/proxy_handler_ctocpp.h deleted file mode 100644 index 4b87f1f61..000000000 --- a/libcef_dll/ctocpp/proxy_handler_ctocpp.h +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) 2013 The Chromium Embedded Framework Authors. All rights -// reserved. Use of this source code is governed by a BSD-style license that -// can be found in the LICENSE file. -// -// --------------------------------------------------------------------------- -// -// This file was generated by the CEF translator tool. If making changes by -// hand only do so within the body of existing method and function -// implementations. See the translator.README.txt file in the tools directory -// for more information. -// - -#ifndef CEF_LIBCEF_DLL_CTOCPP_PROXY_HANDLER_CTOCPP_H_ -#define CEF_LIBCEF_DLL_CTOCPP_PROXY_HANDLER_CTOCPP_H_ -#pragma once - -#ifndef BUILDING_CEF_SHARED -#pragma message("Warning: "__FILE__" may be accessed DLL-side only") -#else // BUILDING_CEF_SHARED - -#include "include/cef_proxy_handler.h" -#include "include/capi/cef_proxy_handler_capi.h" -#include "libcef_dll/ctocpp/ctocpp.h" - -// Wrap a C structure with a C++ class. -// This class may be instantiated and accessed DLL-side only. -class CefProxyHandlerCToCpp - : public CefCToCpp { - public: - explicit CefProxyHandlerCToCpp(cef_proxy_handler_t* str) - : CefCToCpp( - str) {} - virtual ~CefProxyHandlerCToCpp() {} - - // CefProxyHandler methods - virtual void GetProxyForUrl(const CefString& url, - CefProxyInfo& proxy_info) OVERRIDE; -}; - -#endif // BUILDING_CEF_SHARED -#endif // CEF_LIBCEF_DLL_CTOCPP_PROXY_HANDLER_CTOCPP_H_ - diff --git a/libcef_dll/libcef_dll.cc b/libcef_dll/libcef_dll.cc index 85cce1568..23316f080 100644 --- a/libcef_dll/libcef_dll.cc +++ b/libcef_dll/libcef_dll.cc @@ -84,7 +84,6 @@ #include "libcef_dll/ctocpp/keyboard_handler_ctocpp.h" #include "libcef_dll/ctocpp/life_span_handler_ctocpp.h" #include "libcef_dll/ctocpp/load_handler_ctocpp.h" -#include "libcef_dll/ctocpp/proxy_handler_ctocpp.h" #include "libcef_dll/ctocpp/read_handler_ctocpp.h" #include "libcef_dll/ctocpp/render_handler_ctocpp.h" #include "libcef_dll/ctocpp/render_process_handler_ctocpp.h" @@ -207,7 +206,6 @@ CEF_EXPORT void cef_shutdown() { DCHECK_EQ(CefLoadHandlerCToCpp::DebugObjCt, 0); DCHECK_EQ(CefMenuModelCppToC::DebugObjCt, 0); DCHECK_EQ(CefProcessMessageCppToC::DebugObjCt, 0); - DCHECK_EQ(CefProxyHandlerCToCpp::DebugObjCt, 0); DCHECK_EQ(CefQuotaCallbackCppToC::DebugObjCt, 0); DCHECK_EQ(CefReadHandlerCToCpp::DebugObjCt, 0); DCHECK_EQ(CefRenderHandlerCToCpp::DebugObjCt, 0); diff --git a/libcef_dll/wrapper/libcef_dll_wrapper.cc b/libcef_dll/wrapper/libcef_dll_wrapper.cc index 0559d0e4f..a651315d6 100644 --- a/libcef_dll/wrapper/libcef_dll_wrapper.cc +++ b/libcef_dll/wrapper/libcef_dll_wrapper.cc @@ -49,7 +49,6 @@ #include "libcef_dll/cpptoc/keyboard_handler_cpptoc.h" #include "libcef_dll/cpptoc/life_span_handler_cpptoc.h" #include "libcef_dll/cpptoc/load_handler_cpptoc.h" -#include "libcef_dll/cpptoc/proxy_handler_cpptoc.h" #include "libcef_dll/cpptoc/read_handler_cpptoc.h" #include "libcef_dll/cpptoc/render_handler_cpptoc.h" #include "libcef_dll/cpptoc/render_process_handler_cpptoc.h" @@ -199,7 +198,6 @@ CEF_GLOBAL void CefShutdown() { DCHECK_EQ(CefLoadHandlerCppToC::DebugObjCt, 0); DCHECK_EQ(CefMenuModelCToCpp::DebugObjCt, 0); DCHECK_EQ(CefProcessMessageCToCpp::DebugObjCt, 0); - DCHECK_EQ(CefProxyHandlerCppToC::DebugObjCt, 0); DCHECK_EQ(CefQuotaCallbackCToCpp::DebugObjCt, 0); DCHECK_EQ(CefReadHandlerCppToC::DebugObjCt, 0); DCHECK_EQ(CefRenderHandlerCppToC::DebugObjCt, 0); diff --git a/tests/cefclient/cefclient.cpp b/tests/cefclient/cefclient.cpp index 5fed17a35..9c2296256 100644 --- a/tests/cefclient/cefclient.cpp +++ b/tests/cefclient/cefclient.cpp @@ -76,32 +76,6 @@ void AppGetSettings(CefSettings& settings, CefRefPtr app) { CefString(&settings.cache_path) = g_command_line->GetSwitchValue(cefclient::kCachePath); - - // Retrieve command-line proxy configuration, if any. - bool has_proxy = false; - cef_proxy_type_t proxy_type = CEF_PROXY_TYPE_DIRECT; - CefString proxy_config; - - if (g_command_line->HasSwitch(cefclient::kProxyType)) { - std::string str = g_command_line->GetSwitchValue(cefclient::kProxyType); - if (str == cefclient::kProxyType_Direct) { - has_proxy = true; - proxy_type = CEF_PROXY_TYPE_DIRECT; - } else if (str == cefclient::kProxyType_Named || - str == cefclient::kProxyType_Pac) { - proxy_config = g_command_line->GetSwitchValue(cefclient::kProxyConfig); - if (!proxy_config.empty()) { - has_proxy = true; - proxy_type = (str == cefclient::kProxyType_Named? - CEF_PROXY_TYPE_NAMED:CEF_PROXY_TYPE_PAC_STRING); - } - } - } - - if (has_proxy) { - // Provide a ClientApp instance to handle proxy resolution. - app->SetProxyConfig(proxy_type, proxy_config); - } } bool AppIsOffScreenRenderingEnabled() { diff --git a/tests/cefclient/client_app.cpp b/tests/cefclient/client_app.cpp index 97f7e98bd..3fc87e534 100644 --- a/tests/cefclient/client_app.cpp +++ b/tests/cefclient/client_app.cpp @@ -174,8 +174,7 @@ class ClientAppExtensionHandler : public CefV8Handler { } // namespace -ClientApp::ClientApp() - : proxy_type_(CEF_PROXY_TYPE_DIRECT) { +ClientApp::ClientApp() { CreateBrowserDelegates(browser_delegates_); CreateRenderDelegates(render_delegates_); @@ -234,13 +233,6 @@ void ClientApp::OnRenderProcessThreadCreated( (*it)->OnRenderProcessThreadCreated(this, extra_info); } -void ClientApp::GetProxyForUrl(const CefString& url, - CefProxyInfo& proxy_info) { - proxy_info.proxyType = proxy_type_; - if (!proxy_config_.empty()) - CefString(&proxy_info.proxyList) = proxy_config_; -} - void ClientApp::OnRenderThreadCreated(CefRefPtr extra_info) { RenderDelegateSet::iterator it = render_delegates_.begin(); for (; it != render_delegates_.end(); ++it) diff --git a/tests/cefclient/client_app.h b/tests/cefclient/client_app.h index 656b0529e..0e371d1b5 100644 --- a/tests/cefclient/client_app.h +++ b/tests/cefclient/client_app.h @@ -15,7 +15,6 @@ class ClientApp : public CefApp, public CefBrowserProcessHandler, - public CefProxyHandler, public CefRenderProcessHandler { public: // Interface for browser delegates. All BrowserDelegates must be returned via @@ -118,13 +117,6 @@ class ClientApp : public CefApp, ClientApp(); - // Set the proxy configuration. Should only be called during initialization. - void SetProxyConfig(cef_proxy_type_t proxy_type, - const CefString& proxy_config) { - proxy_type_ = proxy_type; - proxy_config_ = proxy_config; - } - // Set a JavaScript callback for the specified |message_name| and |browser_id| // combination. Will automatically be removed when the associated context is // released. Callbacks can also be set in JavaScript using the @@ -165,17 +157,12 @@ class ClientApp : public CefApp, OVERRIDE { return this; } // CefBrowserProcessHandler methods. - virtual CefRefPtr GetProxyHandler() OVERRIDE { return this; } virtual void OnContextInitialized() OVERRIDE; virtual void OnBeforeChildProcessLaunch( CefRefPtr command_line) OVERRIDE; virtual void OnRenderProcessThreadCreated(CefRefPtr extra_info) OVERRIDE; - // CefProxyHandler methods. - virtual void GetProxyForUrl(const CefString& url, - CefProxyInfo& proxy_info) OVERRIDE; - // CefRenderProcessHandler methods. virtual void OnRenderThreadCreated(CefRefPtr extra_info) OVERRIDE; @@ -222,10 +209,6 @@ class ClientApp : public CefApp, CefProcessId source_process, CefRefPtr message) OVERRIDE; - // Proxy configuration. - cef_proxy_type_t proxy_type_; - CefString proxy_config_; - // Map of message callbacks. typedef std::map, std::pair, CefRefPtr > > diff --git a/tests/cefclient/client_switches.cpp b/tests/cefclient/client_switches.cpp index ed580aa4d..e621e1a95 100644 --- a/tests/cefclient/client_switches.cpp +++ b/tests/cefclient/client_switches.cpp @@ -60,11 +60,4 @@ const char kDeveloperToolsDisabled[] = "developer-tools-disabled"; const char kOffScreenRenderingEnabled[] = "off-screen-rendering-enabled"; const char kTransparentPaintingEnabled[] = "transparent-painting-enabled"; -// Other attributes. -const char kProxyType[] = "proxy-type"; -const char kProxyType_Direct[] = "direct"; -const char kProxyType_Named[] = "named"; -const char kProxyType_Pac[] = "pac"; -const char kProxyConfig[] = "proxy-config"; - } // namespace cefclient diff --git a/tests/cefclient/client_switches.h b/tests/cefclient/client_switches.h index 3ba64fd79..76c5f3b36 100644 --- a/tests/cefclient/client_switches.h +++ b/tests/cefclient/client_switches.h @@ -56,13 +56,6 @@ extern const char kDeveloperToolsDisabled[]; extern const char kOffScreenRenderingEnabled[]; extern const char kTransparentPaintingEnabled[]; -// Other attributes. -extern const char kProxyType[]; -extern const char kProxyType_Direct[]; -extern const char kProxyType_Named[]; -extern const char kProxyType_Pac[]; -extern const char kProxyConfig[]; - } // namespace cefclient #endif // CEF_TESTS_CEFCLIENT_CEFCLIENT_SWITCHES_H_ diff --git a/tests/unittests/v8_unittest.cc b/tests/unittests/v8_unittest.cc index d7c0ccd0d..2232de0d9 100644 --- a/tests/unittests/v8_unittest.cc +++ b/tests/unittests/v8_unittest.cc @@ -1628,7 +1628,8 @@ class V8RendererTest : public ClientApp::RenderDelegate { new Handler(&startup_test_success_)); } - virtual void OnWebKitInitialized(CefRefPtr app) { + virtual void OnBrowserCreated(CefRefPtr app, + CefRefPtr browser) { test_mode_ = g_current_test_mode; if (test_mode_ == V8TEST_NONE) { // Retrieve the test mode from the command line. @@ -1719,7 +1720,8 @@ class V8RendererTest : public ClientApp::RenderDelegate { V8_PROPERTY_ATTRIBUTE_NONE)); } - if (test_mode_ > V8TEST_NONE && url != kV8NavTestUrl) { + if (test_mode_ > V8TEST_NONE && url != kV8NavTestUrl && + url.find("http://tests/") != std::string::npos) { // Run the test asynchronously. CefPostTask(TID_RENDERER, NewCefRunnableMethod(this, &V8RendererTest::RunTest)); @@ -1734,7 +1736,7 @@ class V8RendererTest : public ClientApp::RenderDelegate { return; if (test_mode_ == V8TEST_CONTEXT_INVALID && - frame->GetURL().ToString() != kV8NavTestUrl) { + frame->GetURL().ToString() == kV8TestUrl) { test_context_ = browser_->GetMainFrame()->GetV8Context(); test_object_ = CefV8Value::CreateArray(10);