2012-06-19 18:29:49 +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.
|
|
|
|
|
2019-05-11 00:14:48 +02:00
|
|
|
#ifndef CEF_LIBCEF_BROWSER_NET_SERVICE_BROWSER_URLREQUEST_IMPL_H_
|
|
|
|
#define CEF_LIBCEF_BROWSER_NET_SERVICE_BROWSER_URLREQUEST_IMPL_H_
|
2012-06-19 18:29:49 +02:00
|
|
|
|
2019-05-11 00:14:48 +02:00
|
|
|
#include <memory>
|
2017-05-17 11:29:28 +02:00
|
|
|
|
2019-05-11 00:14:48 +02:00
|
|
|
#include "include/cef_urlrequest.h"
|
2012-06-19 18:29:49 +02:00
|
|
|
|
2021-06-04 03:34:56 +02:00
|
|
|
#include "third_party/abseil-cpp/absl/types/optional.h"
|
2019-07-12 22:44:43 +02:00
|
|
|
|
|
|
|
namespace content {
|
|
|
|
struct GlobalRequestID;
|
|
|
|
}
|
|
|
|
|
2012-06-19 18:29:49 +02:00
|
|
|
class CefBrowserURLRequest : public CefURLRequest {
|
|
|
|
public:
|
|
|
|
class Context;
|
|
|
|
|
2019-07-12 22:44:43 +02:00
|
|
|
// TODO(network): After the old network code path is deleted move the
|
|
|
|
// CefURLRequestClient::GetAuthCredentials callback to the context thread and
|
|
|
|
// return just the CefBrowserURLRequest object here. The *Client object can
|
|
|
|
// then be retrieved by calling GetClient() from the required thread.
|
|
|
|
using RequestInfo = std::pair<CefRefPtr<CefBrowserURLRequest>,
|
|
|
|
CefRefPtr<CefURLRequestClient>>;
|
|
|
|
|
|
|
|
// Retrieve the request objects, if any, associated with |request_id|.
|
2021-06-04 03:34:56 +02:00
|
|
|
static absl::optional<RequestInfo> FromRequestID(int32_t request_id);
|
|
|
|
static absl::optional<RequestInfo> FromRequestID(
|
2019-07-12 22:44:43 +02:00
|
|
|
const content::GlobalRequestID& request_id);
|
|
|
|
|
2019-05-11 00:14:48 +02:00
|
|
|
// If |frame| is nullptr requests can still be intercepted but no
|
|
|
|
// browser/frame will be associated with them.
|
|
|
|
CefBrowserURLRequest(CefRefPtr<CefFrame> frame,
|
|
|
|
CefRefPtr<CefRequest> request,
|
2015-03-02 21:25:14 +01:00
|
|
|
CefRefPtr<CefURLRequestClient> client,
|
|
|
|
CefRefPtr<CefRequestContext> request_context);
|
2014-11-12 20:25:15 +01:00
|
|
|
~CefBrowserURLRequest() override;
|
2012-06-19 18:29:49 +02:00
|
|
|
|
|
|
|
bool Start();
|
|
|
|
|
|
|
|
// CefURLRequest methods.
|
2014-11-12 20:25:15 +01:00
|
|
|
CefRefPtr<CefRequest> GetRequest() override;
|
|
|
|
CefRefPtr<CefURLRequestClient> GetClient() override;
|
|
|
|
Status GetRequestStatus() override;
|
|
|
|
ErrorCode GetRequestError() override;
|
|
|
|
CefRefPtr<CefResponse> GetResponse() override;
|
2018-01-03 22:14:29 +01:00
|
|
|
bool ResponseWasCached() override;
|
2014-11-12 20:25:15 +01:00
|
|
|
void Cancel() override;
|
2012-06-19 18:29:49 +02:00
|
|
|
|
|
|
|
private:
|
|
|
|
bool VerifyContext();
|
|
|
|
|
2019-05-11 00:14:48 +02:00
|
|
|
std::unique_ptr<Context> context_;
|
2012-06-19 18:29:49 +02:00
|
|
|
|
|
|
|
IMPLEMENT_REFCOUNTING(CefBrowserURLRequest);
|
|
|
|
};
|
|
|
|
|
2019-05-11 00:14:48 +02:00
|
|
|
#endif // CEF_LIBCEF_BROWSER_NET_SERVICE_BROWSER_URLREQUEST_IMPL_H_
|