mirror of
https://bitbucket.org/chromiumembedded/cef
synced 2024-12-15 10:58:33 +01:00
047e8f9349
- Building on macOS now requires the 10.15 SDK. Xcode 11.3 is recommended as Xcode 11.4 is not currently supported (see https://crbug.com/1065146). - Jumbo build configuration is no longer supported. Chromium is skipping the M82 release and consequently no CEF 4085 branch will be created. For details on the Chromium decision see https://groups.google.com/a/chromium.org/d/msg/chromium-dev/Vn7uzglqLz0/JItlSrZxBAAJ
229 lines
9.9 KiB
C++
229 lines
9.9 KiB
C++
// Copyright (c) 2011 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_CONTENT_BROWSER_CLIENT_H_
|
|
#define CEF_LIBCEF_BROWSER_CONTENT_BROWSER_CLIENT_H_
|
|
#pragma once
|
|
|
|
#include <string>
|
|
#include <utility>
|
|
|
|
#include "include/cef_request_context_handler.h"
|
|
#include "libcef/browser/request_context_impl.h"
|
|
|
|
#include "base/macros.h"
|
|
#include "base/memory/ref_counted.h"
|
|
#include "build/build_config.h"
|
|
#include "content/public/browser/content_browser_client.h"
|
|
#include "third_party/skia/include/core/SkColor.h"
|
|
|
|
class CefBrowserMainParts;
|
|
class CefDevToolsDelegate;
|
|
|
|
namespace content {
|
|
class PluginServiceFilter;
|
|
class SiteInstance;
|
|
} // namespace content
|
|
|
|
namespace extensions {
|
|
class Extension;
|
|
}
|
|
|
|
class CefContentBrowserClient : public content::ContentBrowserClient {
|
|
public:
|
|
CefContentBrowserClient();
|
|
~CefContentBrowserClient() override;
|
|
|
|
// Returns the singleton CefContentBrowserClient instance.
|
|
static CefContentBrowserClient* Get();
|
|
|
|
// ContentBrowserClient implementation.
|
|
std::unique_ptr<content::BrowserMainParts> CreateBrowserMainParts(
|
|
const content::MainFunctionParams& parameters) override;
|
|
void RenderProcessWillLaunch(content::RenderProcessHost* host) override;
|
|
bool ShouldUseProcessPerSite(content::BrowserContext* browser_context,
|
|
const GURL& effective_url) override;
|
|
bool DoesSiteRequireDedicatedProcess(content::BrowserContext* browser_context,
|
|
const GURL& effective_site_url) override;
|
|
void GetAdditionalWebUISchemes(
|
|
std::vector<std::string>* additional_schemes) override;
|
|
void GetAdditionalViewSourceSchemes(
|
|
std::vector<std::string>* additional_schemes) override;
|
|
void GetAdditionalAllowedSchemesForFileSystem(
|
|
std::vector<std::string>* additional_allowed_schemes) override;
|
|
bool IsWebUIAllowedToMakeNetworkRequests(const url::Origin& origin) override;
|
|
bool IsHandledURL(const GURL& url) override;
|
|
void SiteInstanceGotProcess(content::SiteInstance* site_instance) override;
|
|
void SiteInstanceDeleting(content::SiteInstance* site_instance) override;
|
|
void BindHostReceiverForRenderer(
|
|
content::RenderProcessHost* render_process_host,
|
|
mojo::GenericPendingReceiver receiver) override;
|
|
base::Optional<service_manager::Manifest> GetServiceManifestOverlay(
|
|
base::StringPiece name) override;
|
|
void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
|
|
int child_process_id) override;
|
|
std::string GetApplicationLocale() override;
|
|
scoped_refptr<network::SharedURLLoaderFactory>
|
|
GetSystemSharedURLLoaderFactory() override;
|
|
network::mojom::NetworkContext* GetSystemNetworkContext() override;
|
|
scoped_refptr<content::QuotaPermissionContext> CreateQuotaPermissionContext()
|
|
override;
|
|
content::MediaObserver* GetMediaObserver() override;
|
|
content::SpeechRecognitionManagerDelegate*
|
|
CreateSpeechRecognitionManagerDelegate() override;
|
|
content::GeneratedCodeCacheSettings GetGeneratedCodeCacheSettings(
|
|
content::BrowserContext* context) override;
|
|
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;
|
|
base::OnceClosure SelectClientCertificate(
|
|
content::WebContents* web_contents,
|
|
net::SSLCertRequestInfo* cert_request_info,
|
|
net::ClientCertIdentityList client_certs,
|
|
std::unique_ptr<content::ClientCertificateDelegate> delegate) 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;
|
|
void OverrideWebkitPrefs(content::RenderViewHost* rvh,
|
|
content::WebPreferences* prefs) override;
|
|
void BrowserURLHandlerCreated(content::BrowserURLHandler* handler) override;
|
|
std::string GetDefaultDownloadName() override;
|
|
void DidCreatePpapiPlugin(content::BrowserPpapiHost* browser_host) override;
|
|
content::DevToolsManagerDelegate* GetDevToolsManagerDelegate() override;
|
|
std::vector<std::unique_ptr<content::NavigationThrottle>>
|
|
CreateThrottlesForNavigation(
|
|
content::NavigationHandle* navigation_handle) override;
|
|
std::vector<std::unique_ptr<blink::URLLoaderThrottle>>
|
|
CreateURLLoaderThrottles(
|
|
const network::ResourceRequest& request,
|
|
content::BrowserContext* browser_context,
|
|
const base::RepeatingCallback<content::WebContents*()>& wc_getter,
|
|
content::NavigationUIData* navigation_ui_data,
|
|
int frame_tree_node_id) override;
|
|
|
|
#if defined(OS_LINUX)
|
|
void GetAdditionalMappedFilesForChildProcess(
|
|
const base::CommandLine& command_line,
|
|
int child_process_id,
|
|
content::PosixFileDescriptorInfo* mappings) override;
|
|
#endif
|
|
|
|
#if defined(OS_WIN)
|
|
const wchar_t* GetResourceDllName();
|
|
bool PreSpawnRenderer(sandbox::TargetPolicy* policy,
|
|
RendererSpawnFlags flags) override;
|
|
#endif
|
|
|
|
void ExposeInterfacesToRenderer(
|
|
service_manager::BinderRegistry* registry,
|
|
blink::AssociatedInterfaceRegistry* associated_registry,
|
|
content::RenderProcessHost* render_process_host) override;
|
|
std::unique_ptr<net::ClientCertStore> CreateClientCertStore(
|
|
content::BrowserContext* browser_context) 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;
|
|
void RegisterNonNetworkNavigationURLLoaderFactories(
|
|
int frame_tree_node_id,
|
|
NonNetworkURLLoaderFactoryMap* factories) override;
|
|
void RegisterNonNetworkSubresourceURLLoaderFactories(
|
|
int render_process_id,
|
|
int render_frame_id,
|
|
NonNetworkURLLoaderFactoryMap* factories) 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,
|
|
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;
|
|
void OnNetworkServiceCreated(
|
|
network::mojom::NetworkService* network_service) override;
|
|
mojo::Remote<network::mojom::NetworkContext> CreateNetworkContext(
|
|
content::BrowserContext* context,
|
|
bool in_memory,
|
|
const base::FilePath& relative_partition_path) override;
|
|
std::vector<base::FilePath> GetNetworkContextsParentDirectory() override;
|
|
bool HandleExternalProtocol(
|
|
const GURL& url,
|
|
base::OnceCallback<content::WebContents*()> 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::unique_ptr<content::OverlayWindow> CreateWindowForPictureInPicture(
|
|
content::PictureInPictureWindowController* controller) override;
|
|
void RegisterBrowserInterfaceBindersForFrame(
|
|
content::RenderFrameHost* render_frame_host,
|
|
service_manager::BinderMapWithContext<content::RenderFrameHost*>* map)
|
|
override;
|
|
base::FilePath GetSandboxedStorageServiceDataDirectory() override;
|
|
std::string GetProduct() override;
|
|
std::string GetChromeProduct() override;
|
|
std::string GetUserAgent() override;
|
|
blink::UserAgentMetadata GetUserAgentMetadata() override;
|
|
base::flat_set<std::string> GetPluginMimeTypesWithExternalHandlers(
|
|
content::BrowserContext* browser_context) override;
|
|
|
|
// Perform browser process registration for the custom scheme.
|
|
void RegisterCustomScheme(const std::string& scheme);
|
|
|
|
CefRefPtr<CefRequestContextImpl> request_context() const;
|
|
CefDevToolsDelegate* devtools_delegate() const;
|
|
|
|
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:
|
|
// Returns the extension or app associated with |site_instance| or NULL.
|
|
const extensions::Extension* GetExtension(
|
|
content::SiteInstance* site_instance);
|
|
|
|
CefBrowserMainParts* browser_main_parts_;
|
|
|
|
std::unique_ptr<content::PluginServiceFilter> plugin_service_filter_;
|
|
};
|
|
|
|
#endif // CEF_LIBCEF_BROWSER_CONTENT_BROWSER_CLIENT_H_
|