- Add download handling support via new CefDownloadHandler and CefDownloadItem interfaces (issue #516).

- Fix setting of CefKeyEvent.focus_on_editable_field when the underlying RenderViewHost changes.
- Fix potential crash if URLRequest objects are still in-progress upon shutdown.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@715 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2012-06-28 17:21:18 +00:00
parent 14bbc90ddb
commit 421001ba9d
51 changed files with 2685 additions and 171 deletions

View File

@ -9,6 +9,8 @@
#include "libcef/browser/browser_host_impl.h"
#include "libcef/browser/cookie_manager_impl.h"
#include "libcef/browser/thread_util.h"
#include "libcef/browser/url_request_context_getter.h"
#include "libcef/browser/url_request_context_proxy.h"
#include "base/logging.h"
#include "base/message_loop_proxy.h"
@ -117,69 +119,32 @@ class CefCookieStoreProxy : public net::CookieStore {
DISALLOW_COPY_AND_ASSIGN(CefCookieStoreProxy);
};
class CefRequestContextProxy : public net::URLRequestContext {
public:
CefRequestContextProxy(CefBrowserHostImpl* browser,
net::URLRequestContextGetter* parent)
: parent_(parent) {
net::URLRequestContext* context = parent->GetURLRequestContext();
// Cookie store that proxies to the browser implementation.
cookie_store_proxy_ = new CefCookieStoreProxy(browser, context);
set_cookie_store(cookie_store_proxy_);
// All other values refer to the parent request context.
set_net_log(context->net_log());
set_host_resolver(context->host_resolver());
set_cert_verifier(context->cert_verifier());
set_server_bound_cert_service(context->server_bound_cert_service());
set_fraudulent_certificate_reporter(
context->fraudulent_certificate_reporter());
set_proxy_service(context->proxy_service());
set_ssl_config_service(context->ssl_config_service());
set_http_auth_handler_factory(context->http_auth_handler_factory());
set_http_transaction_factory(context->http_transaction_factory());
set_ftp_transaction_factory(context->ftp_transaction_factory());
set_network_delegate(context->network_delegate());
set_http_server_properties(context->http_server_properties());
set_transport_security_state(context->transport_security_state());
set_accept_charset(context->accept_charset());
set_accept_language(context->accept_language());
set_referrer_charset(context->referrer_charset());
set_job_factory(context->job_factory());
}
virtual const std::string& GetUserAgent(const GURL& url) const OVERRIDE {
return parent_->GetURLRequestContext()->GetUserAgent(url);
}
private:
net::URLRequestContextGetter* parent_;
scoped_refptr<net::CookieStore> cookie_store_proxy_;
DISALLOW_COPY_AND_ASSIGN(CefRequestContextProxy);
};
} // namespace
CefURLRequestContextGetterProxy::CefURLRequestContextGetterProxy(
CefBrowserHostImpl* browser,
net::URLRequestContextGetter* parent)
CefURLRequestContextGetter* parent)
: browser_(browser),
parent_(parent) {
parent_(parent),
context_proxy_(NULL) {
DCHECK(browser);
DCHECK(parent);
}
CefURLRequestContextGetterProxy::~CefURLRequestContextGetterProxy() {
if (context_proxy_)
parent_->ReleaseURLRequestContextProxy(context_proxy_);
}
net::URLRequestContext*
CefURLRequestContextGetterProxy::GetURLRequestContext() {
CEF_REQUIRE_IOT();
if (!context_proxy_.get()) {
context_proxy_.reset(
new CefRequestContextProxy(browser_, parent_));
if (!context_proxy_) {
context_proxy_ = parent_->CreateURLRequestContextProxy();
context_proxy_->Initialize(browser_);
}
return context_proxy_.get();
return context_proxy_;
}
scoped_refptr<base::SingleThreadTaskRunner>