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.
|
|
|
|
|
2015-11-26 03:53:12 +01:00
|
|
|
#ifndef CEF_LIBCEF_BROWSER_NET_URL_REQUEST_CONTEXT_GETTER_PROXY_H_
|
|
|
|
#define CEF_LIBCEF_BROWSER_NET_URL_REQUEST_CONTEXT_GETTER_PROXY_H_
|
2012-04-03 03:34:16 +02:00
|
|
|
#pragma once
|
|
|
|
|
2017-08-04 00:55:19 +02:00
|
|
|
#include "include/cef_request_context.h"
|
2013-09-03 18:43:31 +02:00
|
|
|
#include "include/cef_request_context_handler.h"
|
2015-11-26 03:53:12 +01:00
|
|
|
#include "libcef/browser/net/url_request_context_getter.h"
|
|
|
|
#include "libcef/browser/net/url_request_context_getter_impl.h"
|
2013-09-03 18:43:31 +02:00
|
|
|
|
2012-06-28 19:21:18 +02:00
|
|
|
class CefURLRequestContextProxy;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2015-02-14 00:17:08 +01:00
|
|
|
// URLRequestContextGetter implementation for a particular CefRequestContext.
|
2015-03-02 21:25:14 +01:00
|
|
|
// Life span is primarily controlled by CefResourceContext. Created on the UI
|
|
|
|
// thread but accessed and destroyed on the IO thread. See browser_context.h for
|
|
|
|
// an object relationship diagram.
|
2015-02-14 00:17:08 +01:00
|
|
|
class CefURLRequestContextGetterProxy : public CefURLRequestContextGetter {
|
2012-04-03 03:34:16 +02:00
|
|
|
public:
|
2015-02-14 00:17:08 +01:00
|
|
|
CefURLRequestContextGetterProxy(
|
|
|
|
CefRefPtr<CefRequestContextHandler> handler,
|
|
|
|
scoped_refptr<CefURLRequestContextGetterImpl> parent);
|
2014-11-12 20:25:15 +01:00
|
|
|
~CefURLRequestContextGetterProxy() override;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2017-04-20 21:28:17 +02:00
|
|
|
// Called when the StoragePartitionProxy is destroyed.
|
|
|
|
void ShutdownOnUIThread();
|
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
// net::URLRequestContextGetter implementation.
|
2014-11-12 20:25:15 +01:00
|
|
|
net::URLRequestContext* GetURLRequestContext() override;
|
2017-05-17 11:29:28 +02:00
|
|
|
scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner()
|
|
|
|
const override;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2015-02-14 00:17:08 +01:00
|
|
|
// CefURLRequestContextGetter implementation.
|
|
|
|
net::HostResolver* GetHostResolver() const override;
|
2013-09-03 18:43:31 +02:00
|
|
|
|
|
|
|
CefRefPtr<CefRequestContextHandler> handler() const { return handler_; }
|
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
private:
|
2017-04-20 21:28:17 +02:00
|
|
|
void ShutdownOnIOThread();
|
|
|
|
|
2013-09-03 18:43:31 +02:00
|
|
|
CefRefPtr<CefRequestContextHandler> handler_;
|
2012-06-28 19:21:18 +02:00
|
|
|
|
2015-02-14 00:17:08 +01:00
|
|
|
// The CefURLRequestContextImpl owned by |parent_| is passed as a raw pointer
|
|
|
|
// to CefURLRequestContextProxy and CefCookieStoreProxy. This reference is
|
|
|
|
// necessary to keep it alive.
|
|
|
|
scoped_refptr<CefURLRequestContextGetterImpl> parent_;
|
|
|
|
|
2016-04-27 22:38:52 +02:00
|
|
|
std::unique_ptr<CefURLRequestContextProxy> context_proxy_;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2017-04-20 21:28:17 +02:00
|
|
|
bool shutting_down_ = false;
|
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
DISALLOW_COPY_AND_ASSIGN(CefURLRequestContextGetterProxy);
|
|
|
|
};
|
|
|
|
|
2015-11-26 03:53:12 +01:00
|
|
|
#endif // CEF_LIBCEF_BROWSER_NET_URL_REQUEST_CONTEXT_GETTER_PROXY_H_
|