cef/libcef/browser/url_request_context_getter_proxy.cc
Marshall Greenblatt 385be456c3 Structural improvements for request handling (issue #1044)
- Add new CefRequestContext and CefRequestContextHandler classes.
- Add CefRequestContext argument to CefBrowserHost static factory methods.
- Move GetCookieManager from CefRequestHandler to CefRequestContextHandler.
- Use BrowserContext as the root proxy object for network requests.
- Move accessors for CefBrowserMainParts members from CefContext to CefContentBrowserClient.

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@1424 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
2013-09-03 16:43:31 +00:00

43 lines
1.3 KiB
C++

// Copyright (c) 2012 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/url_request_context_getter_proxy.h"
#include "libcef/browser/thread_util.h"
#include "libcef/browser/url_request_context_getter.h"
#include "libcef/browser/url_request_context_proxy.h"
CefURLRequestContextGetterProxy::CefURLRequestContextGetterProxy(
CefRefPtr<CefRequestContextHandler> handler,
CefURLRequestContextGetter* parent)
: handler_(handler),
parent_(parent),
context_proxy_(NULL) {
DCHECK(parent);
}
CefURLRequestContextGetterProxy::~CefURLRequestContextGetterProxy() {
CEF_REQUIRE_IOT();
if (context_proxy_)
parent_->ReleaseURLRequestContextProxy(context_proxy_);
}
net::URLRequestContext*
CefURLRequestContextGetterProxy::GetURLRequestContext() {
CEF_REQUIRE_IOT();
if (!context_proxy_) {
context_proxy_ = parent_->CreateURLRequestContextProxy();
context_proxy_->Initialize(handler_);
}
return context_proxy_;
}
scoped_refptr<base::SingleThreadTaskRunner>
CefURLRequestContextGetterProxy::GetNetworkTaskRunner() const {
return parent_->GetNetworkTaskRunner();
}
net::HostResolver* CefURLRequestContextGetterProxy::GetHostResolver() const {
return parent_->host_resolver();
}