2017-11-28 18:00:50 -05:00
|
|
|
// Copyright (c) 2017 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.
|
|
|
|
|
|
|
|
#ifndef CEF_LIBCEF_BROWSER_NET_NET_UTIL_H_
|
|
|
|
#define CEF_LIBCEF_BROWSER_NET_NET_UTIL_H_
|
|
|
|
#pragma once
|
|
|
|
|
2019-04-24 02:50:25 +00:00
|
|
|
#include "include/cef_resource_request_handler.h"
|
|
|
|
#include "libcef/common/request_impl.h"
|
|
|
|
|
|
|
|
#include "content/public/browser/resource_request_info.h"
|
|
|
|
|
2017-11-28 18:00:50 -05:00
|
|
|
namespace net {
|
|
|
|
class URLRequest;
|
|
|
|
}
|
|
|
|
|
2019-04-24 02:50:25 +00:00
|
|
|
class GURL;
|
|
|
|
|
2019-05-24 23:23:43 +03:00
|
|
|
class CefBrowserHostImpl;
|
|
|
|
class CefBrowserInfo;
|
|
|
|
|
2017-11-28 18:00:50 -05:00
|
|
|
namespace net_util {
|
|
|
|
|
|
|
|
// Returns true if |request| is handled internally and should not be exposed via
|
|
|
|
// the CEF API.
|
2018-02-05 19:21:14 -05:00
|
|
|
bool IsInternalRequest(const net::URLRequest* request);
|
2017-11-28 18:00:50 -05:00
|
|
|
|
2019-05-24 23:23:43 +03:00
|
|
|
// Returns the browser associated with the specified URLRequest.
|
|
|
|
CefRefPtr<CefBrowserHostImpl> GetBrowserForRequest(
|
|
|
|
const net::URLRequest* request);
|
|
|
|
|
|
|
|
// Returns the frame associated with the specified URLRequest.
|
|
|
|
CefRefPtr<CefFrame> GetFrameForRequest(
|
|
|
|
scoped_refptr<CefBrowserInfo> browser_info,
|
|
|
|
const net::URLRequest* request);
|
|
|
|
|
2019-04-24 02:50:25 +00:00
|
|
|
// Returns the appropriate CefResourceRequestHandler as determined by the
|
|
|
|
// associated CefBrowser/CefRequestHandler and/or CefRequestContextHandler, if
|
|
|
|
// any. The out-params will be nullptr if no handler is returned. Otherwise,
|
|
|
|
// the |cef_request| parameter will be set based on the contents of |request|
|
|
|
|
// (read-only by default), and the |cef_browser| and |cef_frame| parameters
|
|
|
|
// will be set if the request is associated with a browser.
|
|
|
|
CefRefPtr<CefResourceRequestHandler> GetResourceRequestHandler(
|
|
|
|
const net::URLRequest* request,
|
|
|
|
CefRefPtr<CefRequestImpl>& cef_request,
|
|
|
|
CefRefPtr<CefBrowser>& cef_browser,
|
|
|
|
CefRefPtr<CefFrame>& cef_frame);
|
|
|
|
|
|
|
|
void HandleExternalProtocol(
|
|
|
|
CefRefPtr<CefRequestImpl> request,
|
|
|
|
const content::ResourceRequestInfo::WebContentsGetter& web_contents_getter);
|
|
|
|
|
2019-03-13 21:27:37 +00:00
|
|
|
} // namespace net_util
|
2017-11-28 18:00:50 -05:00
|
|
|
|
|
|
|
#endif // CEF_LIBCEF_BROWSER_NET_NET_UTIL_H_
|