2020-06-25 04:34:12 +02:00
|
|
|
// Copyright 2020 The Chromium Embedded Framework Authors.
|
|
|
|
// Portions copyright 2012 The Chromium 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_CHROME_CHROME_CONTENT_BROWSER_CLIENT_CEF_
|
|
|
|
#define CEF_LIBCEF_BROWSER_CHROME_CHROME_CONTENT_BROWSER_CLIENT_CEF_
|
|
|
|
|
|
|
|
#include <memory>
|
|
|
|
|
2024-05-11 17:48:38 +02:00
|
|
|
#include "base/memory/raw_ptr.h"
|
2024-04-30 17:45:07 +02:00
|
|
|
#include "cef/libcef/browser/request_context_impl.h"
|
2020-06-25 04:34:12 +02:00
|
|
|
#include "chrome/browser/chrome_content_browser_client.h"
|
2024-04-17 18:01:26 +02:00
|
|
|
#include "content/public/browser/web_contents_view_delegate.h"
|
2020-06-25 04:34:12 +02:00
|
|
|
|
|
|
|
class ChromeBrowserMainExtraPartsCef;
|
|
|
|
|
2020-09-25 03:40:47 +02:00
|
|
|
// CEF override of ChromeContentBrowserClient.
|
2020-06-25 04:34:12 +02:00
|
|
|
class ChromeContentBrowserClientCef : public ChromeContentBrowserClient {
|
|
|
|
public:
|
2020-12-02 23:31:49 +01:00
|
|
|
ChromeContentBrowserClientCef();
|
2021-12-06 21:40:25 +01:00
|
|
|
|
|
|
|
ChromeContentBrowserClientCef(const ChromeContentBrowserClientCef&) = delete;
|
|
|
|
ChromeContentBrowserClientCef& operator=(
|
|
|
|
const ChromeContentBrowserClientCef&) = delete;
|
|
|
|
|
2020-06-25 04:34:12 +02:00
|
|
|
~ChromeContentBrowserClientCef() override;
|
|
|
|
|
2024-05-13 23:36:09 +02:00
|
|
|
void CleanupOnUIThread() override;
|
|
|
|
|
2020-06-25 04:34:12 +02:00
|
|
|
// ChromeContentBrowserClient overrides.
|
|
|
|
std::unique_ptr<content::BrowserMainParts> CreateBrowserMainParts(
|
2022-05-19 12:28:44 +02:00
|
|
|
bool is_integration_test) override;
|
2020-06-25 04:34:12 +02:00
|
|
|
void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
|
|
|
|
int child_process_id) override;
|
2020-09-25 03:40:47 +02:00
|
|
|
void RenderProcessWillLaunch(content::RenderProcessHost* host) override;
|
2022-08-09 21:43:00 +02:00
|
|
|
void AllowCertificateError(
|
|
|
|
content::WebContents* web_contents,
|
|
|
|
int cert_error,
|
|
|
|
const net::SSLInfo& ssl_info,
|
|
|
|
const GURL& request_url,
|
|
|
|
bool is_main_frame_request,
|
|
|
|
bool strict_enforcement,
|
|
|
|
base::OnceCallback<void(content::CertificateRequestResultType)> callback)
|
|
|
|
override;
|
2020-09-25 03:40:47 +02:00
|
|
|
bool CanCreateWindow(content::RenderFrameHost* opener,
|
|
|
|
const GURL& opener_url,
|
|
|
|
const GURL& opener_top_level_frame_url,
|
|
|
|
const url::Origin& source_origin,
|
|
|
|
content::mojom::WindowContainerType container_type,
|
|
|
|
const GURL& target_url,
|
|
|
|
const content::Referrer& referrer,
|
|
|
|
const std::string& frame_name,
|
|
|
|
WindowOpenDisposition disposition,
|
|
|
|
const blink::mojom::WindowFeatures& features,
|
|
|
|
bool user_gesture,
|
|
|
|
bool opener_suppressed,
|
|
|
|
bool* no_javascript_access) override;
|
2021-04-18 03:12:54 +02:00
|
|
|
void OverrideWebkitPrefs(content::WebContents* web_contents,
|
|
|
|
blink::web_pref::WebPreferences* prefs) override;
|
2024-02-22 19:36:15 +01:00
|
|
|
void WillCreateURLLoaderFactory(
|
2020-09-25 03:40:47 +02:00
|
|
|
content::BrowserContext* browser_context,
|
|
|
|
content::RenderFrameHost* frame,
|
|
|
|
int render_process_id,
|
|
|
|
URLLoaderFactoryType type,
|
|
|
|
const url::Origin& request_initiator,
|
2024-04-23 22:06:00 +02:00
|
|
|
const net::IsolationInfo& isolation_info,
|
2024-01-26 03:12:43 +01:00
|
|
|
std::optional<int64_t> navigation_id,
|
2020-12-02 23:31:49 +01:00
|
|
|
ukm::SourceIdObj ukm_source_id,
|
2024-02-22 19:36:15 +01:00
|
|
|
network::URLLoaderFactoryBuilder& factory_builder,
|
2020-09-25 03:40:47 +02:00
|
|
|
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient>*
|
|
|
|
header_client,
|
|
|
|
bool* bypass_redirect_checks,
|
|
|
|
bool* disable_secure_dns,
|
2023-06-26 12:13:38 +02:00
|
|
|
network::mojom::URLLoaderFactoryOverridePtr* factory_override,
|
|
|
|
scoped_refptr<base::SequencedTaskRunner> navigation_response_task_runner)
|
|
|
|
override;
|
2020-09-25 03:40:47 +02:00
|
|
|
bool HandleExternalProtocol(
|
|
|
|
const GURL& url,
|
2021-07-23 18:40:13 +02:00
|
|
|
content::WebContents::Getter web_contents_getter,
|
2021-04-21 00:52:34 +02:00
|
|
|
int frame_tree_node_id,
|
2020-09-25 03:40:47 +02:00
|
|
|
content::NavigationUIData* navigation_data,
|
2022-03-26 02:12:30 +01:00
|
|
|
bool is_primary_main_frame,
|
|
|
|
bool is_in_fenced_frame_tree,
|
2021-10-19 00:17:16 +02:00
|
|
|
network::mojom::WebSandboxFlags sandbox_flags,
|
2020-09-25 03:40:47 +02:00
|
|
|
ui::PageTransition page_transition,
|
|
|
|
bool has_user_gesture,
|
2024-01-26 03:12:43 +01:00
|
|
|
const std::optional<url::Origin>& initiating_origin,
|
2022-01-25 21:26:51 +01:00
|
|
|
content::RenderFrameHost* initiator_document,
|
2020-09-25 03:40:47 +02:00
|
|
|
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory)
|
|
|
|
override;
|
|
|
|
bool HandleExternalProtocol(
|
|
|
|
content::WebContents::Getter web_contents_getter,
|
|
|
|
int frame_tree_node_id,
|
|
|
|
content::NavigationUIData* navigation_data,
|
2022-03-26 02:12:30 +01:00
|
|
|
bool is_primary_main_frame,
|
|
|
|
bool is_in_fenced_frame_tree,
|
2021-10-19 00:17:16 +02:00
|
|
|
network::mojom::WebSandboxFlags sandbox_flags,
|
2020-09-25 03:40:47 +02:00
|
|
|
const network::ResourceRequest& request,
|
2024-01-26 03:12:43 +01:00
|
|
|
const std::optional<url::Origin>& initiating_origin,
|
2022-01-25 21:26:51 +01:00
|
|
|
content::RenderFrameHost* initiator_document,
|
2020-09-25 03:40:47 +02:00
|
|
|
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory)
|
|
|
|
override;
|
|
|
|
std::vector<std::unique_ptr<content::NavigationThrottle>>
|
|
|
|
CreateThrottlesForNavigation(
|
|
|
|
content::NavigationHandle* navigation_handle) override;
|
2021-10-19 00:17:16 +02:00
|
|
|
bool ConfigureNetworkContextParams(
|
2020-09-25 03:40:47 +02:00
|
|
|
content::BrowserContext* context,
|
|
|
|
bool in_memory,
|
|
|
|
const base::FilePath& relative_partition_path,
|
|
|
|
network::mojom::NetworkContextParams* network_context_params,
|
2021-03-04 23:36:57 +01:00
|
|
|
cert_verifier::mojom::CertVerifierCreationParams*
|
|
|
|
cert_verifier_creation_params) override;
|
2020-09-25 03:40:47 +02:00
|
|
|
std::unique_ptr<content::LoginDelegate> CreateLoginDelegate(
|
|
|
|
const net::AuthChallengeInfo& auth_info,
|
|
|
|
content::WebContents* web_contents,
|
2024-01-26 03:12:43 +01:00
|
|
|
content::BrowserContext* browser_context,
|
2020-09-25 03:40:47 +02:00
|
|
|
const content::GlobalRequestID& request_id,
|
|
|
|
bool is_request_for_main_frame,
|
|
|
|
const GURL& url,
|
|
|
|
scoped_refptr<net::HttpResponseHeaders> response_headers,
|
|
|
|
bool first_auth_attempt,
|
|
|
|
LoginAuthRequiredCallback auth_required_callback) override;
|
2021-05-14 18:58:55 +02:00
|
|
|
void ExposeInterfacesToRenderer(
|
|
|
|
service_manager::BinderRegistry* registry,
|
|
|
|
blink::AssociatedInterfaceRegistry* associated_registry,
|
|
|
|
content::RenderProcessHost* render_process_host) override;
|
|
|
|
void RegisterBrowserInterfaceBindersForFrame(
|
|
|
|
content::RenderFrameHost* render_frame_host,
|
|
|
|
mojo::BinderMapWithContext<content::RenderFrameHost*>* map) override;
|
2024-04-17 18:01:26 +02:00
|
|
|
std::unique_ptr<content::WebContentsViewDelegate> GetWebContentsViewDelegate(
|
|
|
|
content::WebContents* web_contents) override;
|
2020-06-25 04:34:12 +02:00
|
|
|
|
2020-07-04 04:51:17 +02:00
|
|
|
CefRefPtr<CefRequestContextImpl> request_context() const;
|
|
|
|
|
2020-06-25 04:34:12 +02:00
|
|
|
scoped_refptr<base::SingleThreadTaskRunner> background_task_runner() const;
|
|
|
|
scoped_refptr<base::SingleThreadTaskRunner> user_visible_task_runner() const;
|
|
|
|
scoped_refptr<base::SingleThreadTaskRunner> user_blocking_task_runner() const;
|
|
|
|
|
|
|
|
private:
|
2024-04-17 18:01:26 +02:00
|
|
|
static std::unique_ptr<content::WebContentsViewDelegate>
|
|
|
|
CreateWebContentsViewDelegate(content::WebContents* web_contents);
|
|
|
|
|
2024-05-11 17:48:38 +02:00
|
|
|
raw_ptr<ChromeBrowserMainExtraPartsCef> browser_main_parts_ = nullptr;
|
2020-06-25 04:34:12 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CEF_LIBCEF_BROWSER_CHROME_CHROME_CONTENT_BROWSER_CLIENT_CEF_
|