2012-04-03 03:34:16 +02:00
|
|
|
// 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"
|
2012-06-28 19:21:18 +02:00
|
|
|
#include "libcef/browser/url_request_context_getter.h"
|
|
|
|
#include "libcef/browser/url_request_context_proxy.h"
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
CefURLRequestContextGetterProxy::CefURLRequestContextGetterProxy(
|
2013-09-03 18:43:31 +02:00
|
|
|
CefRefPtr<CefRequestContextHandler> handler,
|
2012-06-28 19:21:18 +02:00
|
|
|
CefURLRequestContextGetter* parent)
|
2013-09-03 18:43:31 +02:00
|
|
|
: handler_(handler),
|
2012-06-28 19:21:18 +02:00
|
|
|
parent_(parent),
|
|
|
|
context_proxy_(NULL) {
|
2012-04-03 03:34:16 +02:00
|
|
|
DCHECK(parent);
|
|
|
|
}
|
|
|
|
|
2012-06-28 19:21:18 +02:00
|
|
|
CefURLRequestContextGetterProxy::~CefURLRequestContextGetterProxy() {
|
2012-12-04 02:12:11 +01:00
|
|
|
CEF_REQUIRE_IOT();
|
2012-06-28 19:21:18 +02:00
|
|
|
if (context_proxy_)
|
|
|
|
parent_->ReleaseURLRequestContextProxy(context_proxy_);
|
|
|
|
}
|
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
net::URLRequestContext*
|
|
|
|
CefURLRequestContextGetterProxy::GetURLRequestContext() {
|
|
|
|
CEF_REQUIRE_IOT();
|
2012-06-28 19:21:18 +02:00
|
|
|
if (!context_proxy_) {
|
|
|
|
context_proxy_ = parent_->CreateURLRequestContextProxy();
|
2013-09-03 18:43:31 +02:00
|
|
|
context_proxy_->Initialize(handler_);
|
2012-04-03 03:34:16 +02:00
|
|
|
}
|
2012-06-28 19:21:18 +02:00
|
|
|
return context_proxy_;
|
2012-04-03 03:34:16 +02:00
|
|
|
}
|
|
|
|
|
2012-06-22 00:50:34 +02:00
|
|
|
scoped_refptr<base::SingleThreadTaskRunner>
|
|
|
|
CefURLRequestContextGetterProxy::GetNetworkTaskRunner() const {
|
|
|
|
return parent_->GetNetworkTaskRunner();
|
2012-04-03 03:34:16 +02:00
|
|
|
}
|
2013-09-03 18:43:31 +02:00
|
|
|
|
|
|
|
net::HostResolver* CefURLRequestContextGetterProxy::GetHostResolver() const {
|
|
|
|
return parent_->host_resolver();
|
|
|
|
}
|