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>
|
|
|
|
|
2020-07-04 04:51:17 +02:00
|
|
|
#include "libcef/browser/request_context_impl.h"
|
|
|
|
|
2020-06-25 04:34:12 +02:00
|
|
|
#include "base/macros.h"
|
|
|
|
#include "chrome/browser/chrome_content_browser_client.h"
|
|
|
|
|
|
|
|
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();
|
2020-06-25 04:34:12 +02:00
|
|
|
~ChromeContentBrowserClientCef() override;
|
|
|
|
|
|
|
|
// ChromeContentBrowserClient overrides.
|
|
|
|
std::unique_ptr<content::BrowserMainParts> CreateBrowserMainParts(
|
|
|
|
const content::MainFunctionParams& parameters) override;
|
|
|
|
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;
|
|
|
|
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;
|
|
|
|
bool WillCreateURLLoaderFactory(
|
|
|
|
content::BrowserContext* browser_context,
|
|
|
|
content::RenderFrameHost* frame,
|
|
|
|
int render_process_id,
|
|
|
|
URLLoaderFactoryType type,
|
|
|
|
const url::Origin& request_initiator,
|
|
|
|
base::Optional<int64_t> navigation_id,
|
2020-12-02 23:31:49 +01:00
|
|
|
ukm::SourceIdObj ukm_source_id,
|
2020-09-25 03:40:47 +02:00
|
|
|
mojo::PendingReceiver<network::mojom::URLLoaderFactory>* factory_receiver,
|
|
|
|
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient>*
|
|
|
|
header_client,
|
|
|
|
bool* bypass_redirect_checks,
|
|
|
|
bool* disable_secure_dns,
|
|
|
|
network::mojom::URLLoaderFactoryOverridePtr* factory_override) override;
|
|
|
|
bool HandleExternalProtocol(
|
|
|
|
const GURL& url,
|
|
|
|
content::WebContents::OnceGetter web_contents_getter,
|
|
|
|
int child_id,
|
|
|
|
content::NavigationUIData* navigation_data,
|
|
|
|
bool is_main_frame,
|
|
|
|
ui::PageTransition page_transition,
|
|
|
|
bool has_user_gesture,
|
|
|
|
const base::Optional<url::Origin>& initiating_origin,
|
|
|
|
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,
|
|
|
|
const network::ResourceRequest& request,
|
|
|
|
mojo::PendingRemote<network::mojom::URLLoaderFactory>* out_factory)
|
|
|
|
override;
|
|
|
|
std::vector<std::unique_ptr<content::NavigationThrottle>>
|
|
|
|
CreateThrottlesForNavigation(
|
|
|
|
content::NavigationHandle* navigation_handle) override;
|
|
|
|
void ConfigureNetworkContextParams(
|
|
|
|
content::BrowserContext* context,
|
|
|
|
bool in_memory,
|
|
|
|
const base::FilePath& relative_partition_path,
|
|
|
|
network::mojom::NetworkContextParams* network_context_params,
|
|
|
|
network::mojom::CertVerifierCreationParams* cert_verifier_creation_params)
|
|
|
|
override;
|
|
|
|
std::unique_ptr<content::LoginDelegate> CreateLoginDelegate(
|
|
|
|
const net::AuthChallengeInfo& auth_info,
|
|
|
|
content::WebContents* web_contents,
|
|
|
|
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-02-16 00:24:28 +01:00
|
|
|
void BrowserURLHandlerCreated(content::BrowserURLHandler* handler) override;
|
|
|
|
bool IsWebUIAllowedToMakeNetworkRequests(const url::Origin& origin) 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:
|
|
|
|
ChromeBrowserMainExtraPartsCef* browser_main_parts_ = nullptr;
|
|
|
|
|
|
|
|
DISALLOW_COPY_AND_ASSIGN(ChromeContentBrowserClientCef);
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CEF_LIBCEF_BROWSER_CHROME_CHROME_CONTENT_BROWSER_CLIENT_CEF_
|