mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2025-02-02 20:26:59 +01:00
Introduce chrome proxy implementation based on command-line flags (issue #600).
git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1080 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
parent
bccce6258f
commit
81d27df883
35
cef.gyp
35
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"', {
|
||||
|
@ -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',
|
||||
|
@ -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.
|
||||
|
@ -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_
|
@ -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<CefProxyHandler> GetProxyHandler() {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
///
|
||||
// Called on the browser process UI thread immediately after the CEF context
|
||||
// has been initialized.
|
||||
|
@ -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_
|
@ -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.
|
||||
///
|
||||
|
@ -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<CefCookieTraits> 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<CefProxyInfoTraits> {
|
||||
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:
|
||||
//
|
||||
// [<scheme>"://"]<server>[":"<port>]
|
||||
//
|
||||
// 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;
|
||||
|
||||
|
@ -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();
|
||||
}
|
||||
|
@ -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<net::ProxyConfigService> proxy_config_service() {
|
||||
return proxy_config_service_.Pass();
|
||||
}
|
||||
|
||||
private:
|
||||
void PlatformInitialize();
|
||||
void PlatformCleanup();
|
||||
|
||||
scoped_ptr<CefBrowserContext> browser_context_;
|
||||
|
||||
scoped_ptr<MessageLoop> message_loop_;
|
||||
CefDevToolsDelegate* devtools_delegate_;
|
||||
scoped_ptr<MessageLoop> message_loop_;
|
||||
scoped_ptr<PrefProxyConfigTracker> pref_proxy_config_tracker_;
|
||||
scoped_ptr<net::ProxyConfigService> proxy_config_service_;
|
||||
scoped_refptr<BrowserPrefStore> user_prefs_;
|
||||
|
||||
DISALLOW_COPY_AND_ASSIGN(CefBrowserMainParts);
|
||||
};
|
||||
|
34
libcef/browser/browser_pref_store.cc
Normal file
34
libcef/browser/browser_pref_store.cc
Normal file
@ -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() {
|
||||
}
|
24
libcef/browser/browser_pref_store.h
Normal file
24
libcef/browser/browser_pref_store.h
Normal file
@ -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_
|
@ -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"
|
||||
|
@ -304,6 +304,11 @@ CefDevToolsDelegate* CefContext::devtools_delegate() const {
|
||||
devtools_delegate();
|
||||
}
|
||||
|
||||
scoped_ptr<net::ProxyConfigService> 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_)
|
||||
|
@ -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<net::ProxyConfigService> proxy_config_service() const;
|
||||
|
||||
CefTraceSubscriber* GetTraceSubscriber();
|
||||
|
||||
private:
|
||||
|
12
libcef/browser/proxy_stubs.cc
Normal file
12
libcef/browser/proxy_stubs.cc
Normal file
@ -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();
|
||||
}
|
@ -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<CefProxyHandler> 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<net::ProxyResolverScriptData>& 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<CefProxyHandler> 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<CefApp> app = _Context->application();
|
||||
if (app.get()) {
|
||||
CefRefPtr<CefBrowserProcessHandler> handler =
|
||||
app->GetBrowserProcessHandler();
|
||||
if (handler.get()) {
|
||||
CefRefPtr<CefProxyHandler> 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<net::ProxyService> 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);
|
||||
|
||||
|
@ -6,9 +6,6 @@
|
||||
|
||||
namespace switches {
|
||||
|
||||
// Product version string.
|
||||
const char kProductVersion[] = "product-version";
|
||||
|
||||
// Log file path.
|
||||
const char kLogFile[] = "log-file";
|
||||
|
||||
|
@ -10,7 +10,6 @@
|
||||
|
||||
namespace switches {
|
||||
|
||||
extern const char kProductVersion[];
|
||||
extern const char kLogFile[];
|
||||
extern const char kLogSeverity[];
|
||||
extern const char kLogSeverity_Verbose[];
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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<CefProxyHandler> _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<CefBrowserProcessHandlerCppToC, CefBrowserProcessHandler,
|
||||
cef_browser_process_handler_t>(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 =
|
||||
|
@ -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<CefProxyHandlerCppToC, CefProxyHandler, cef_proxy_handler_t>(
|
||||
cls) {
|
||||
struct_.struct_.get_proxy_for_url = proxy_handler_get_proxy_for_url;
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
template<> long CefCppToC<CefProxyHandlerCppToC, CefProxyHandler,
|
||||
cef_proxy_handler_t>::DebugObjCt = 0;
|
||||
#endif
|
||||
|
@ -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<CefProxyHandlerCppToC, CefProxyHandler,
|
||||
cef_proxy_handler_t> {
|
||||
public:
|
||||
explicit CefProxyHandlerCppToC(CefProxyHandler* cls);
|
||||
virtual ~CefProxyHandlerCppToC() {}
|
||||
};
|
||||
|
||||
#endif // USING_CEF_SHARED
|
||||
#endif // CEF_LIBCEF_DLL_CPPTOC_PROXY_HANDLER_CPPTOC_H_
|
||||
|
@ -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<CefProxyHandler> 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;
|
||||
|
@ -34,7 +34,6 @@ class CefBrowserProcessHandlerCToCpp
|
||||
virtual ~CefBrowserProcessHandlerCToCpp() {}
|
||||
|
||||
// CefBrowserProcessHandler methods
|
||||
virtual CefRefPtr<CefProxyHandler> GetProxyHandler() OVERRIDE;
|
||||
virtual void OnContextInitialized() OVERRIDE;
|
||||
virtual void OnBeforeChildProcessLaunch(
|
||||
CefRefPtr<CefCommandLine> command_line) OVERRIDE;
|
||||
|
@ -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<CefProxyHandlerCToCpp, CefProxyHandler,
|
||||
cef_proxy_handler_t>::DebugObjCt = 0;
|
||||
#endif
|
||||
|
@ -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<CefProxyHandlerCToCpp, CefProxyHandler,
|
||||
cef_proxy_handler_t> {
|
||||
public:
|
||||
explicit CefProxyHandlerCToCpp(cef_proxy_handler_t* str)
|
||||
: CefCToCpp<CefProxyHandlerCToCpp, CefProxyHandler, cef_proxy_handler_t>(
|
||||
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_
|
||||
|
@ -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);
|
||||
|
@ -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);
|
||||
|
@ -76,32 +76,6 @@ void AppGetSettings(CefSettings& settings, CefRefPtr<ClientApp> 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() {
|
||||
|
@ -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<CefListValue> extra_info) {
|
||||
RenderDelegateSet::iterator it = render_delegates_.begin();
|
||||
for (; it != render_delegates_.end(); ++it)
|
||||
|
@ -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<CefProxyHandler> GetProxyHandler() OVERRIDE { return this; }
|
||||
virtual void OnContextInitialized() OVERRIDE;
|
||||
virtual void OnBeforeChildProcessLaunch(
|
||||
CefRefPtr<CefCommandLine> command_line) OVERRIDE;
|
||||
virtual void OnRenderProcessThreadCreated(CefRefPtr<CefListValue> extra_info)
|
||||
OVERRIDE;
|
||||
|
||||
// CefProxyHandler methods.
|
||||
virtual void GetProxyForUrl(const CefString& url,
|
||||
CefProxyInfo& proxy_info) OVERRIDE;
|
||||
|
||||
// CefRenderProcessHandler methods.
|
||||
virtual void OnRenderThreadCreated(CefRefPtr<CefListValue> extra_info)
|
||||
OVERRIDE;
|
||||
@ -222,10 +209,6 @@ class ClientApp : public CefApp,
|
||||
CefProcessId source_process,
|
||||
CefRefPtr<CefProcessMessage> message) OVERRIDE;
|
||||
|
||||
// Proxy configuration.
|
||||
cef_proxy_type_t proxy_type_;
|
||||
CefString proxy_config_;
|
||||
|
||||
// Map of message callbacks.
|
||||
typedef std::map<std::pair<std::string, int>,
|
||||
std::pair<CefRefPtr<CefV8Context>, CefRefPtr<CefV8Value> > >
|
||||
|
@ -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
|
||||
|
@ -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_
|
||||
|
@ -1628,7 +1628,8 @@ class V8RendererTest : public ClientApp::RenderDelegate {
|
||||
new Handler(&startup_test_success_));
|
||||
}
|
||||
|
||||
virtual void OnWebKitInitialized(CefRefPtr<ClientApp> app) {
|
||||
virtual void OnBrowserCreated(CefRefPtr<ClientApp> app,
|
||||
CefRefPtr<CefBrowser> 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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user