2013-01-03 18:24:24 +01:00
|
|
|
// Copyright (c) 2013 The Chromium Embedded Framework Authors.
|
|
|
|
// Portions copyright (c) 2011 The Chromium Authors. All rights reserved.
|
2012-04-03 03:34:16 +02:00
|
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
|
|
// found in the LICENSE file.
|
|
|
|
|
2020-06-28 20:29:44 +02:00
|
|
|
#ifndef CEF_LIBCEF_RENDERER_ALLOY_ALLOY_CONTENT_RENDERER_CLIENT_H_
|
|
|
|
#define CEF_LIBCEF_RENDERER_ALLOY_ALLOY_CONTENT_RENDERER_CLIENT_H_
|
2012-04-03 03:34:16 +02:00
|
|
|
#pragma once
|
|
|
|
|
2012-04-24 20:01:48 +02:00
|
|
|
#include <list>
|
2012-04-03 03:34:16 +02:00
|
|
|
#include <map>
|
2016-10-21 21:52:29 +02:00
|
|
|
#include <memory>
|
2012-04-03 03:34:16 +02:00
|
|
|
#include <string>
|
2012-12-31 11:41:15 +01:00
|
|
|
#include <vector>
|
2012-04-03 03:34:16 +02:00
|
|
|
|
|
|
|
#include "libcef/renderer/browser_impl.h"
|
|
|
|
|
|
|
|
#include "base/compiler_specific.h"
|
2020-09-25 03:40:47 +02:00
|
|
|
#include "base/single_thread_task_runner.h"
|
2020-08-29 00:39:23 +02:00
|
|
|
#include "base/task/current_thread.h"
|
2017-12-07 22:44:24 +01:00
|
|
|
#include "chrome/common/plugin.mojom.h"
|
2021-08-09 23:18:43 +02:00
|
|
|
#include "chrome/renderer/media/chrome_key_systems_provider.h"
|
2012-04-03 03:34:16 +02:00
|
|
|
#include "content/public/renderer/content_renderer_client.h"
|
2017-12-07 22:44:24 +01:00
|
|
|
#include "content/public/renderer/render_thread.h"
|
2019-10-01 15:55:16 +02:00
|
|
|
#include "mojo/public/cpp/bindings/generic_pending_receiver.h"
|
2017-12-07 22:44:24 +01:00
|
|
|
#include "services/service_manager/public/cpp/local_interface_provider.h"
|
|
|
|
|
2015-07-16 23:40:01 +02:00
|
|
|
namespace extensions {
|
2015-11-10 21:18:16 +01:00
|
|
|
class CefExtensionsRendererClient;
|
2015-07-16 23:40:01 +02:00
|
|
|
class Dispatcher;
|
|
|
|
class DispatcherDelegate;
|
|
|
|
class ExtensionsClient;
|
|
|
|
class ExtensionsGuestViewContainerDispatcher;
|
|
|
|
class ExtensionsRendererClient;
|
2015-10-12 20:13:13 +02:00
|
|
|
class ResourceRequestPolicy;
|
2017-07-27 01:19:27 +02:00
|
|
|
} // namespace extensions
|
2015-07-16 23:40:01 +02:00
|
|
|
|
2020-02-10 18:10:17 +01:00
|
|
|
namespace visitedlink {
|
|
|
|
class VisitedLinkReader;
|
|
|
|
}
|
|
|
|
|
2014-09-27 01:48:19 +02:00
|
|
|
namespace web_cache {
|
2016-05-25 01:35:43 +02:00
|
|
|
class WebCacheImpl;
|
2014-09-27 01:48:19 +02:00
|
|
|
}
|
|
|
|
|
2021-05-14 18:58:55 +02:00
|
|
|
class AlloyRenderThreadObserver;
|
|
|
|
class CefRenderManager;
|
2015-07-16 23:40:01 +02:00
|
|
|
class ChromePDFPrintClient;
|
2014-10-07 22:44:33 +02:00
|
|
|
class SpellCheck;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2020-06-28 20:29:44 +02:00
|
|
|
class AlloyContentRendererClient
|
2018-11-30 23:21:07 +01:00
|
|
|
: public content::ContentRendererClient,
|
|
|
|
public service_manager::LocalInterfaceProvider,
|
2020-08-29 00:39:23 +02:00
|
|
|
public base::CurrentThread::DestructionObserver {
|
2012-04-03 03:34:16 +02:00
|
|
|
public:
|
2020-06-28 20:29:44 +02:00
|
|
|
AlloyContentRendererClient();
|
|
|
|
~AlloyContentRendererClient() override;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2020-06-28 20:29:44 +02:00
|
|
|
// Returns the singleton AlloyContentRendererClient instance.
|
2020-06-28 23:05:36 +02:00
|
|
|
// This method is deprecated and should not be used in new callsites.
|
2020-06-28 20:29:44 +02:00
|
|
|
static AlloyContentRendererClient* Get();
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2013-01-03 18:24:24 +01:00
|
|
|
// Render thread task runner.
|
2017-09-21 13:57:40 +02:00
|
|
|
base::SingleThreadTaskRunner* render_task_runner() const {
|
2013-01-03 18:24:24 +01:00
|
|
|
return render_task_runner_.get();
|
|
|
|
}
|
|
|
|
|
2015-10-09 17:23:12 +02:00
|
|
|
// Returns the task runner for the current thread. Returns NULL if the current
|
|
|
|
// thread is not the main render process thread.
|
2017-09-21 13:57:40 +02:00
|
|
|
scoped_refptr<base::SingleThreadTaskRunner> GetCurrentTaskRunner();
|
2013-01-03 18:24:24 +01:00
|
|
|
|
2013-02-02 01:21:59 +01:00
|
|
|
// Perform cleanup work that needs to occur before shutdown when running in
|
|
|
|
// single-process mode. Blocks until cleanup is complete.
|
|
|
|
void RunSingleProcessCleanup();
|
|
|
|
|
2012-04-03 03:34:16 +02:00
|
|
|
// ContentRendererClient implementation.
|
2020-07-20 20:16:48 +02:00
|
|
|
void PostIOThreadCreated(
|
|
|
|
base::SingleThreadTaskRunner* io_thread_task_runner) override;
|
2014-11-12 20:25:15 +01:00
|
|
|
void RenderThreadStarted() override;
|
2020-02-10 18:10:17 +01:00
|
|
|
void ExposeInterfacesToBrowser(mojo::BinderMap* binders) override;
|
2017-05-31 17:33:30 +02:00
|
|
|
void RenderThreadConnected() override;
|
2014-11-12 20:25:15 +01:00
|
|
|
void RenderFrameCreated(content::RenderFrame* render_frame) override;
|
2021-07-23 18:40:13 +02:00
|
|
|
void WebViewCreated(blink::WebView* web_view) override;
|
2019-07-24 23:12:00 +02:00
|
|
|
bool IsPluginHandledExternally(content::RenderFrame* render_frame,
|
|
|
|
const blink::WebElement& plugin_element,
|
|
|
|
const GURL& original_url,
|
|
|
|
const std::string& mime_type) override;
|
2017-05-17 11:29:28 +02:00
|
|
|
bool OverrideCreatePlugin(content::RenderFrame* render_frame,
|
|
|
|
const blink::WebPluginParams& params,
|
|
|
|
blink::WebPlugin** plugin) override;
|
2018-04-19 17:44:42 +02:00
|
|
|
void WillSendRequest(blink::WebLocalFrame* frame,
|
2018-02-15 01:12:09 +01:00
|
|
|
ui::PageTransition transition_type,
|
|
|
|
const blink::WebURL& url,
|
2020-03-04 01:29:39 +01:00
|
|
|
const net::SiteForCookies& site_for_cookies,
|
2018-04-19 17:44:42 +02:00
|
|
|
const url::Origin* initiator_origin,
|
2021-01-28 00:13:12 +01:00
|
|
|
GURL* new_url) override;
|
2019-04-16 16:38:48 +02:00
|
|
|
uint64_t VisitedLinkHash(const char* canonical_url, size_t length) override;
|
|
|
|
bool IsLinkVisited(uint64_t link_hash) override;
|
2018-04-19 17:44:42 +02:00
|
|
|
bool IsOriginIsolatedPepperPlugin(const base::FilePath& plugin_path) override;
|
2016-05-25 01:35:43 +02:00
|
|
|
void AddSupportedKeySystems(
|
|
|
|
std::vector<std::unique_ptr<::media::KeySystemProperties>>* key_systems)
|
|
|
|
override;
|
2021-08-09 23:18:43 +02:00
|
|
|
bool IsKeySystemsUpdateNeeded() override;
|
2016-04-27 22:38:52 +02:00
|
|
|
void RunScriptsAtDocumentStart(content::RenderFrame* render_frame) override;
|
|
|
|
void RunScriptsAtDocumentEnd(content::RenderFrame* render_frame) override;
|
2017-04-20 21:28:17 +02:00
|
|
|
void RunScriptsAtDocumentIdle(content::RenderFrame* render_frame) override;
|
2018-02-15 01:12:09 +01:00
|
|
|
void DevToolsAgentAttached() override;
|
|
|
|
void DevToolsAgentDetached() override;
|
2021-04-21 00:52:34 +02:00
|
|
|
std::unique_ptr<blink::URLLoaderThrottleProvider>
|
2019-07-24 23:12:00 +02:00
|
|
|
CreateURLLoaderThrottleProvider(
|
2021-04-21 00:52:34 +02:00
|
|
|
blink::URLLoaderThrottleProviderType provider_type) override;
|
2017-12-07 22:44:24 +01:00
|
|
|
|
|
|
|
// service_manager::LocalInterfaceProvider implementation.
|
|
|
|
void GetInterface(const std::string& name,
|
|
|
|
mojo::ScopedMessagePipeHandle request_handle) override;
|
2012-04-03 03:34:16 +02:00
|
|
|
|
2018-11-30 23:21:07 +01:00
|
|
|
// MessageLoopCurrent::DestructionObserver implementation.
|
2014-11-12 20:25:15 +01:00
|
|
|
void WillDestroyCurrentMessageLoop() override;
|
2013-02-02 01:21:59 +01:00
|
|
|
|
2014-04-04 18:50:38 +02:00
|
|
|
private:
|
2020-09-25 03:40:47 +02:00
|
|
|
void OnBrowserCreated(content::RenderView* render_view,
|
2021-06-04 03:34:56 +02:00
|
|
|
absl::optional<bool> is_windowless);
|
2014-01-02 23:41:11 +01:00
|
|
|
|
2013-02-02 01:21:59 +01:00
|
|
|
// Perform cleanup work for single-process mode.
|
|
|
|
void RunSingleProcessCleanupOnUIThread();
|
|
|
|
|
2018-03-20 21:15:08 +01:00
|
|
|
// Time at which this object was created. This is very close to the time at
|
|
|
|
// which the RendererMain function was entered.
|
|
|
|
base::TimeTicks main_entry_time_;
|
|
|
|
|
2021-05-14 18:58:55 +02:00
|
|
|
std::unique_ptr<CefRenderManager> render_manager_;
|
2020-09-25 03:40:47 +02:00
|
|
|
|
2017-09-21 13:57:40 +02:00
|
|
|
scoped_refptr<base::SingleThreadTaskRunner> render_task_runner_;
|
2021-05-14 18:58:55 +02:00
|
|
|
std::unique_ptr<AlloyRenderThreadObserver> observer_;
|
2016-05-25 01:35:43 +02:00
|
|
|
std::unique_ptr<web_cache::WebCacheImpl> web_cache_impl_;
|
2016-04-27 22:38:52 +02:00
|
|
|
std::unique_ptr<SpellCheck> spellcheck_;
|
2020-02-10 18:10:17 +01:00
|
|
|
std::unique_ptr<visitedlink::VisitedLinkReader> visited_link_slave_;
|
2019-05-11 00:14:48 +02:00
|
|
|
|
2016-04-27 22:38:52 +02:00
|
|
|
std::unique_ptr<ChromePDFPrintClient> pdf_print_client_;
|
2015-07-16 23:40:01 +02:00
|
|
|
|
2016-04-27 22:38:52 +02:00
|
|
|
std::unique_ptr<extensions::ExtensionsClient> extensions_client_;
|
|
|
|
std::unique_ptr<extensions::CefExtensionsRendererClient>
|
2015-11-10 21:18:16 +01:00
|
|
|
extensions_renderer_client_;
|
2015-07-16 23:40:01 +02:00
|
|
|
|
2021-08-09 23:18:43 +02:00
|
|
|
// Used to refresh the list of supported key systems after Widevine is
|
|
|
|
// installed as a component update.
|
|
|
|
ChromeKeySystemsProvider key_systems_provider_;
|
|
|
|
|
2013-02-02 01:21:59 +01:00
|
|
|
// Used in single-process mode to test when cleanup is complete.
|
|
|
|
// Access must be protected by |single_process_cleanup_lock_|.
|
2020-09-25 03:40:47 +02:00
|
|
|
bool single_process_cleanup_complete_ = false;
|
2013-02-02 01:21:59 +01:00
|
|
|
base::Lock single_process_cleanup_lock_;
|
2016-11-23 21:54:29 +01:00
|
|
|
|
2020-06-28 20:29:44 +02:00
|
|
|
DISALLOW_COPY_AND_ASSIGN(AlloyContentRendererClient);
|
2012-04-03 03:34:16 +02:00
|
|
|
};
|
|
|
|
|
2020-06-28 20:29:44 +02:00
|
|
|
#endif // CEF_LIBCEF_RENDERER_ALLOY_ALLOY_CONTENT_RENDERER_CLIENT_H_
|