2012-04-03 01:34:16 +00:00
|
|
|
// 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>
|
|
|
|
|
2013-09-03 16:43:31 +00:00
|
|
|
#include "include/cef_request_context_handler.h"
|
2015-02-13 23:17:08 +00:00
|
|
|
#include "libcef/browser/browser_context_impl.h"
|
2015-11-25 21:53:12 -05:00
|
|
|
#include "libcef/browser/net/url_request_context_getter_impl.h"
|
2013-09-03 16:43:31 +00:00
|
|
|
|
2016-01-06 14:20:54 -05:00
|
|
|
#include "base/macros.h"
|
2012-12-30 11:17:49 +00:00
|
|
|
#include "base/memory/ref_counted.h"
|
2012-04-03 01:34:16 +00:00
|
|
|
#include "base/memory/scoped_ptr.h"
|
2016-01-06 14:20:54 -05:00
|
|
|
#include "build/build_config.h"
|
2012-04-03 01:34:16 +00:00
|
|
|
#include "content/public/browser/content_browser_client.h"
|
2015-03-04 01:15:50 +00:00
|
|
|
#include "third_party/skia/include/core/SkColor.h"
|
2012-04-03 01:34:16 +00:00
|
|
|
|
|
|
|
class CefBrowserMainParts;
|
2013-09-03 16:43:31 +00:00
|
|
|
class CefDevToolsDelegate;
|
2012-06-25 21:21:27 +00:00
|
|
|
class CefResourceDispatcherHostDelegate;
|
2012-04-03 01:34:16 +00:00
|
|
|
|
|
|
|
namespace content {
|
2015-09-25 14:59:30 +03:00
|
|
|
class PluginServiceFilter;
|
2012-04-03 01:34:16 +00:00
|
|
|
class SiteInstance;
|
|
|
|
}
|
|
|
|
|
|
|
|
class CefContentBrowserClient : public content::ContentBrowserClient {
|
|
|
|
public:
|
|
|
|
CefContentBrowserClient();
|
2014-11-12 19:25:15 +00:00
|
|
|
~CefContentBrowserClient() override;
|
2012-04-03 01:34:16 +00:00
|
|
|
|
2012-11-20 20:08:36 +00:00
|
|
|
// Returns the singleton CefContentBrowserClient instance.
|
|
|
|
static CefContentBrowserClient* Get();
|
|
|
|
|
2013-09-03 16:43:31 +00:00
|
|
|
// ContentBrowserClient implementation.
|
2014-11-12 19:25:15 +00:00
|
|
|
content::BrowserMainParts* CreateBrowserMainParts(
|
|
|
|
const content::MainFunctionParams& parameters) override;
|
|
|
|
void RenderProcessWillLaunch(
|
|
|
|
content::RenderProcessHost* host) override;
|
2015-07-16 17:40:01 -04:00
|
|
|
bool ShouldUseProcessPerSite(content::BrowserContext* browser_context,
|
|
|
|
const GURL& effective_url) override;
|
2014-11-12 19:25:15 +00:00
|
|
|
net::URLRequestContextGetter* CreateRequestContext(
|
2013-02-23 00:43:28 +00:00
|
|
|
content::BrowserContext* browser_context,
|
2014-04-04 16:50:38 +00:00
|
|
|
content::ProtocolHandlerMap* protocol_handlers,
|
2014-06-12 20:28:58 +00:00
|
|
|
content::URLRequestInterceptorScopedVector request_interceptors)
|
2014-11-12 19:25:15 +00:00
|
|
|
override;
|
|
|
|
net::URLRequestContextGetter* CreateRequestContextForStoragePartition(
|
2013-02-23 00:43:28 +00:00
|
|
|
content::BrowserContext* browser_context,
|
|
|
|
const base::FilePath& partition_path,
|
|
|
|
bool in_memory,
|
2014-04-04 16:50:38 +00:00
|
|
|
content::ProtocolHandlerMap* protocol_handlers,
|
2014-06-12 20:28:58 +00:00
|
|
|
content::URLRequestInterceptorScopedVector request_interceptors)
|
2014-11-12 19:25:15 +00:00
|
|
|
override;
|
|
|
|
bool IsHandledURL(const GURL& url) override;
|
2015-08-14 10:41:08 -04:00
|
|
|
bool IsNPAPIEnabled() override;
|
2014-11-12 19:25:15 +00:00
|
|
|
void AppendExtraCommandLineSwitches(base::CommandLine* command_line,
|
|
|
|
int child_process_id) override;
|
|
|
|
content::QuotaPermissionContext*
|
|
|
|
CreateQuotaPermissionContext() override;
|
|
|
|
content::MediaObserver* GetMediaObserver() override;
|
|
|
|
content::SpeechRecognitionManagerDelegate*
|
2014-12-13 20:18:31 +00:00
|
|
|
CreateSpeechRecognitionManagerDelegate() override;
|
2014-11-12 19:25:15 +00:00
|
|
|
void AllowCertificateError(
|
2015-12-09 11:10:16 -05:00
|
|
|
content::WebContents* web_contents,
|
2013-04-04 17:50:35 +00:00
|
|
|
int cert_error,
|
|
|
|
const net::SSLInfo& ssl_info,
|
|
|
|
const GURL& request_url,
|
2014-09-04 17:53:40 +00:00
|
|
|
content::ResourceType resource_type,
|
2013-04-04 17:50:35 +00:00
|
|
|
bool overridable,
|
|
|
|
bool strict_enforcement,
|
2014-09-04 17:53:40 +00:00
|
|
|
bool expired_previous_decision,
|
2013-04-04 17:50:35 +00:00
|
|
|
const base::Callback<void(bool)>& callback,
|
2014-11-12 19:25:15 +00:00
|
|
|
content::CertificateRequestResultType* result) override;
|
2015-05-19 13:55:58 -04:00
|
|
|
void SelectClientCertificate(
|
|
|
|
content::WebContents* web_contents,
|
|
|
|
net::SSLCertRequestInfo* cert_request_info,
|
|
|
|
scoped_ptr<content::ClientCertificateDelegate> delegate) override;
|
2014-11-12 19:25:15 +00:00
|
|
|
content::AccessTokenStore* CreateAccessTokenStore() override;
|
|
|
|
bool CanCreateWindow(const GURL& opener_url,
|
|
|
|
const GURL& opener_top_level_frame_url,
|
|
|
|
const GURL& source_origin,
|
|
|
|
WindowContainerType container_type,
|
|
|
|
const GURL& target_url,
|
|
|
|
const content::Referrer& referrer,
|
|
|
|
WindowOpenDisposition disposition,
|
|
|
|
const blink::WebWindowFeatures& features,
|
|
|
|
bool user_gesture,
|
|
|
|
bool opener_suppressed,
|
|
|
|
content::ResourceContext* context,
|
|
|
|
int render_process_id,
|
2015-07-23 20:06:56 -04:00
|
|
|
int opener_render_view_id,
|
|
|
|
int opener_render_frame_id,
|
2014-11-12 19:25:15 +00:00
|
|
|
bool* no_javascript_access) override;
|
|
|
|
void ResourceDispatcherHostCreated() override;
|
|
|
|
void OverrideWebkitPrefs(content::RenderViewHost* rvh,
|
|
|
|
content::WebPreferences* prefs) override;
|
|
|
|
void BrowserURLHandlerCreated(
|
|
|
|
content::BrowserURLHandler* handler) override;
|
|
|
|
std::string GetDefaultDownloadName() override;
|
2015-03-25 17:22:47 -04:00
|
|
|
void DidCreatePpapiPlugin(content::BrowserPpapiHost* browser_host) override;
|
2014-11-12 19:25:15 +00:00
|
|
|
content::DevToolsManagerDelegate* GetDevToolsManagerDelegate()
|
|
|
|
override;
|
2015-10-09 11:23:12 -04:00
|
|
|
ScopedVector<content::NavigationThrottle> CreateThrottlesForNavigation(
|
|
|
|
content::NavigationHandle* navigation_handle) override;
|
2012-11-21 00:40:15 +00:00
|
|
|
|
2013-11-21 22:43:36 +00:00
|
|
|
#if defined(OS_POSIX) && !defined(OS_MACOSX)
|
2014-11-12 19:25:15 +00:00
|
|
|
void GetAdditionalMappedFilesForChildProcess(
|
2014-04-04 16:50:38 +00:00
|
|
|
const base::CommandLine& command_line,
|
2013-11-21 22:43:36 +00:00
|
|
|
int child_process_id,
|
2014-11-12 19:25:15 +00:00
|
|
|
content::FileDescriptorInfo* mappings) override;
|
2013-11-21 22:43:36 +00:00
|
|
|
#endif
|
|
|
|
|
2012-09-10 22:19:19 +00:00
|
|
|
#if defined(OS_WIN)
|
2014-11-12 19:25:15 +00:00
|
|
|
const wchar_t* GetResourceDllName() override;
|
2015-12-09 11:10:16 -05:00
|
|
|
bool PreSpawnRenderer(sandbox::TargetPolicy* policy) override;
|
2012-09-10 22:19:19 +00:00
|
|
|
#endif
|
2012-04-03 01:34:16 +00:00
|
|
|
|
2013-06-04 23:37:26 +00:00
|
|
|
// Perform browser process registration for the custom scheme.
|
|
|
|
void RegisterCustomScheme(const std::string& scheme);
|
2013-06-04 17:41:37 +00:00
|
|
|
|
2015-02-13 23:17:08 +00:00
|
|
|
scoped_refptr<CefBrowserContextImpl> browser_context() const;
|
2013-09-03 16:43:31 +00:00
|
|
|
CefDevToolsDelegate* devtools_delegate() const;
|
2013-02-23 00:43:28 +00:00
|
|
|
|
2013-09-03 16:43:31 +00:00
|
|
|
private:
|
2012-04-03 01:34:16 +00:00
|
|
|
CefBrowserMainParts* browser_main_parts_;
|
|
|
|
|
2015-09-25 14:59:30 +03:00
|
|
|
scoped_ptr<content::PluginServiceFilter> plugin_service_filter_;
|
2012-06-25 21:21:27 +00:00
|
|
|
scoped_ptr<CefResourceDispatcherHostDelegate>
|
|
|
|
resource_dispatcher_host_delegate_;
|
2012-04-03 01:34:16 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // CEF_LIBCEF_BROWSER_CONTENT_BROWSER_CLIENT_H_
|