Update to Chromium version 87.0.4280.0 (#812852)

- Windows: VS2015 Update 2 is now the minimum version requirement for linking
  cef_sandbox from official build binary distributions.
This commit is contained in:
Marshall Greenblatt 2020-10-08 15:54:42 -04:00
parent cae194f493
commit 015e3621a3
156 changed files with 1709 additions and 2088 deletions

View File

@ -859,6 +859,7 @@ static_library("libcef_static") {
"//components/google/core/common",
"//components/keyed_service/content:content",
"//components/keyed_service/core:core",
"//components/media_router/common/mojom:media_router",
"//components/navigation_interception",
"//components/network_session_configurator/common",
"//components/pdf/browser",
@ -906,7 +907,6 @@ static_library("libcef_static") {
"//printing/buildflags",
"//services/network:network_service",
"//services/network/public/cpp",
"//services/service_manager/embedder",
"//services/service_manager/public/cpp",
"//skia",
"//storage/browser",
@ -1186,7 +1186,6 @@ static_library("libcef_static") {
sources += [
# Support for UI input events.
# Part of //ui/aura:test_support which is testingonly.
"//ui/aura/test/x11_event_sender.cc",
"//ui/aura/test/x11_event_sender.h",
# Part of //ui/views:test_support which is testingonly.
"//ui/views/test/ui_controls_factory_desktop_aurax11.cc",

View File

@ -7,5 +7,5 @@
# https://bitbucket.org/chromiumembedded/cef/wiki/BranchesAndBuilding
{
'chromium_checkout': 'refs/tags/86.0.4240.0'
'chromium_checkout': 'refs/tags/87.0.4280.0'
}

View File

@ -53,8 +53,8 @@
# installed. Only 64-bit builds are supported.
#
# - Windows requirements:
# Visual Studio 2015 or newer building on Windows 7 or newer. Visual Studio
# 2019 and Windows 10 64-bit are recommended.
# Visual Studio 2015 Update 2 or newer building on Windows 7 or newer. Visual
# Studio 2019 and Windows 10 64-bit are recommended.
#
# BUILD EXAMPLES
#

View File

@ -33,7 +33,7 @@
// by hand. See the translator.README.txt file in the tools directory for
// more information.
//
// $hash=14cf03e02d8ca3416e65f756470afd8185c7bc78$
// $hash=19337a70a13352e70452be7fcc25ef2de4b1ae4c$
//
#ifndef CEF_INCLUDE_CAPI_CEF_PARSER_CAPI_H_
@ -153,13 +153,11 @@ CEF_EXPORT struct _cef_value_t* cef_parse_json_buffer(
///
// Parses the specified |json_string| and returns a dictionary or list
// representation. If JSON parsing fails this function returns NULL and
// populates |error_code_out| and |error_msg_out| with an error code and a
// formatted error message respectively.
// populates |error_msg_out| with a formatted error message.
///
CEF_EXPORT struct _cef_value_t* cef_parse_jsonand_return_error(
const cef_string_t* json_string,
cef_json_parser_options_t options,
cef_json_parser_error_t* error_code_out,
cef_string_t* error_msg_out);
///

View File

@ -42,13 +42,13 @@
// way that may cause binary incompatibility with other builds. The universal
// hash value will change if any platform is affected whereas the platform hash
// values will change only if that particular platform is affected.
#define CEF_API_HASH_UNIVERSAL "988c60ace9a075ec0d6d5439f8a845296549f666"
#define CEF_API_HASH_UNIVERSAL "22df40aa24a8bd920a2d18500c94dcc1b2c9508f"
#if defined(OS_WIN)
#define CEF_API_HASH_PLATFORM "9928400d4500073e22954f2793c9ab78749b7b67"
#define CEF_API_HASH_PLATFORM "7698e6c4e3bc0f749609a0172a24d34cddbe8a1f"
#elif defined(OS_MAC)
#define CEF_API_HASH_PLATFORM "1c49b8f3d13ac6dd5b04d827f283ede33c7aba7b"
#define CEF_API_HASH_PLATFORM "5189bd75f9d076d7f136bf140b6cc5990ad452ec"
#elif defined(OS_LINUX)
#define CEF_API_HASH_PLATFORM "7634bb7366cf7be31efdbf7c86815ad47b412317"
#define CEF_API_HASH_PLATFORM "96412a3d498054d352e5f9dcf5ad8ff90917c361"
#endif
#ifdef __cplusplus

View File

@ -146,14 +146,12 @@ CefRefPtr<CefValue> CefParseJSON(const void* json,
///
// Parses the specified |json_string| and returns a dictionary or list
// representation. If JSON parsing fails this method returns NULL and populates
// |error_code_out| and |error_msg_out| with an error code and a formatted error
// message respectively.
// |error_msg_out| with a formatted error message.
///
/*--cef()--*/
CefRefPtr<CefValue> CefParseJSONAndReturnError(
const CefString& json_string,
cef_json_parser_options_t options,
cef_json_parser_error_t& error_code_out,
CefString& error_msg_out);
///

View File

@ -2367,22 +2367,6 @@ typedef enum {
JSON_PARSER_ALLOW_TRAILING_COMMAS = 1 << 0,
} cef_json_parser_options_t;
///
// Error codes that can be returned from CefParseJSONAndReturnError.
///
typedef enum {
JSON_NO_ERROR = 0,
JSON_INVALID_ESCAPE,
JSON_SYNTAX_ERROR,
JSON_UNEXPECTED_TOKEN,
JSON_TRAILING_COMMA,
JSON_TOO_MUCH_NESTING,
JSON_UNEXPECTED_DATA_AFTER_ROOT,
JSON_UNSUPPORTED_ENCODING,
JSON_UNQUOTED_DICTIONARY_KEY,
JSON_PARSE_ERROR_COUNT
} cef_json_parser_error_t;
///
// Options that can be passed to CefWriteJSON.
///

View File

@ -240,8 +240,12 @@ CefRefPtr<AlloyBrowserHostImpl> AlloyBrowserHostImpl::CreateInternal(
// expected order.
// 1. Notify the browser's LifeSpanHandler. This must always be the first
// notification for the browser.
browser->OnAfterCreated();
// notification for the browser. Block navigation to avoid issues with focus
// changes being sent to an unbound interface.
{
auto navigation_lock = browser_info->CreateNavigationLock();
browser->OnAfterCreated();
}
// 2. Notify the platform delegate. With Views this will result in a call to
// CefBrowserViewDelegate::OnBrowserCreated().
@ -1368,7 +1372,7 @@ bool AlloyBrowserHostImpl::PreHandleGestureEvent(
bool AlloyBrowserHostImpl::CanDragEnter(content::WebContents* source,
const content::DropData& data,
blink::WebDragOperationsMask mask) {
blink::DragOperationsMask mask) {
CefRefPtr<CefDragHandler> handler;
if (client_)
handler = client_->GetDragHandler();
@ -1734,10 +1738,10 @@ gfx::Point AlloyBrowserHostImpl::GetScreenPoint(const gfx::Point& view) const {
void AlloyBrowserHostImpl::StartDragging(
const content::DropData& drop_data,
blink::WebDragOperationsMask allowed_ops,
blink::DragOperationsMask allowed_ops,
const gfx::ImageSkia& image,
const gfx::Vector2d& image_offset,
const content::DragEventSourceInfo& event_info,
const blink::mojom::DragEventSourceInfo& event_info,
content::RenderWidgetHostImpl* source_rwh) {
if (platform_delegate_) {
platform_delegate_->StartDragging(drop_data, allowed_ops, image,
@ -1745,7 +1749,7 @@ void AlloyBrowserHostImpl::StartDragging(
}
}
void AlloyBrowserHostImpl::UpdateDragCursor(blink::WebDragOperation operation) {
void AlloyBrowserHostImpl::UpdateDragCursor(blink::DragOperation operation) {
if (platform_delegate_)
platform_delegate_->UpdateDragCursor(operation);
}

View File

@ -198,12 +198,12 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
gfx::Point GetScreenPoint(const gfx::Point& view) const;
void StartDragging(const content::DropData& drop_data,
blink::WebDragOperationsMask allowed_ops,
blink::DragOperationsMask allowed_ops,
const gfx::ImageSkia& image,
const gfx::Vector2d& image_offset,
const content::DragEventSourceInfo& event_info,
const blink::mojom::DragEventSourceInfo& event_info,
content::RenderWidgetHostImpl* source_rwh);
void UpdateDragCursor(blink::WebDragOperation operation);
void UpdateDragCursor(blink::DragOperation operation);
// Thread safe accessors.
SkColor GetBackgroundColor() const;
@ -267,7 +267,7 @@ class AlloyBrowserHostImpl : public CefBrowserHostBase,
const blink::WebGestureEvent& event) override;
bool CanDragEnter(content::WebContents* source,
const content::DropData& data,
blink::WebDragOperationsMask operations_allowed) override;
blink::DragOperationsMask operations_allowed) override;
void GetCustomWebContentsView(
content::WebContents* web_contents,
const GURL& target_url,

View File

@ -27,15 +27,16 @@
#include "base/strings/string_number_conversions.h"
#include "base/task/post_task.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/media/router/chrome_media_router_factory.h"
#include "chrome/browser/net/system_network_context_manager.h"
#include "chrome/browser/plugins/plugin_finder.h"
#include "components/constrained_window/constrained_window_views.h"
#include "content/public/browser/gpu_data_manager.h"
#include "content/public/browser/network_service_instance.h"
#include "content/public/common/result_codes.h"
#include "extensions/browser/extension_system.h"
#include "extensions/common/constants.h"
#include "net/base/net_module.h"
#include "services/service_manager/embedder/result_codes.h"
#include "ui/base/resource/resource_bundle.h"
#if defined(USE_AURA) && defined(USE_X11)
@ -88,7 +89,7 @@ int AlloyBrowserMainParts::PreEarlyInitialization() {
ui::InitializeInputMethodForTesting();
#endif
return service_manager::RESULT_CODE_NORMAL_EXIT;
return content::RESULT_CODE_NORMAL_EXIT;
}
void AlloyBrowserMainParts::ToolkitInitialized() {
@ -130,6 +131,8 @@ void AlloyBrowserMainParts::PreMainMessageLoopStart() {
// setup.exe. In Chrome, these strings are in the locale files.
ChromeBrowserMainPartsWin::SetupInstallerUtilStrings();
#endif // defined(OS_WIN)
media_router::ChromeMediaRouterFactory::DoPlatformInit();
}
void AlloyBrowserMainParts::PostMainMessageLoopStart() {

View File

@ -75,8 +75,8 @@
#include "components/content_settings/core/browser/cookie_settings.h"
#include "components/spellcheck/common/spellcheck.mojom.h"
#include "components/version_info/version_info.h"
#include "content/browser/frame_host/render_frame_host_impl.h"
#include "content/browser/plugin_service_impl.h"
#include "content/browser/renderer_host/render_frame_host_impl.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/browser_ppapi_host.h"
#include "content/public/browser/browser_thread.h"
@ -97,7 +97,6 @@
#include "content/public/common/storage_quota_params.h"
#include "content/public/common/url_constants.h"
#include "content/public/common/user_agent.h"
#include "content/public/common/web_preferences.h"
#include "extensions/browser/extension_message_filter.h"
#include "extensions/browser/extension_protocols.h"
#include "extensions/browser/extension_registry.h"
@ -117,9 +116,9 @@
#include "sandbox/policy/switches.h"
#include "services/network/public/cpp/network_switches.h"
#include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.h"
#include "services/service_manager/embedder/switches.h"
#include "services/service_manager/public/mojom/connector.mojom.h"
#include "storage/browser/quota/quota_settings.h"
#include "third_party/blink/public/common/web_preferences/web_preferences.h"
#include "third_party/blink/public/mojom/insecure_input/insecure_input_service.mojom.h"
#include "third_party/blink/public/mojom/prerender/prerender.mojom.h"
#include "third_party/blink/public/web/web_window_features.h"
@ -758,7 +757,7 @@ void AlloyContentBrowserClient::AppendExtraCommandLineSwitches(
}
#if defined(OS_LINUX)
if (process_type == service_manager::switches::kZygoteProcess) {
if (process_type == switches::kZygoteProcess) {
// Propagate the following switches to the zygote command line (along with
// any associated values) if present in the browser command line.
static const char* const kSwitchNames[] = {
@ -966,7 +965,7 @@ bool AlloyContentBrowserClient::CanCreateWindow(
void AlloyContentBrowserClient::OverrideWebkitPrefs(
content::RenderViewHost* rvh,
content::WebPreferences* prefs) {
blink::web_pref::WebPreferences* prefs) {
// Using RVH instead of RFH here because rvh->GetMainFrame() may be nullptr
// when this method is called.
renderer_prefs::PopulateWebPreferences(rvh, *prefs);
@ -979,7 +978,7 @@ void AlloyContentBrowserClient::OverrideWebkitPrefs(
bool AlloyContentBrowserClient::OverrideWebPreferencesAfterNavigation(
content::WebContents* web_contents,
content::WebPreferences* prefs) {
blink::web_pref::WebPreferences* prefs) {
return renderer_prefs::PopulateWebPreferencesAfterNavigation(web_contents,
*prefs);
}
@ -1045,7 +1044,7 @@ void AlloyContentBrowserClient::GetAdditionalMappedFilesForChildProcess(
content::PosixFileDescriptorInfo* mappings) {
int crash_signal_fd = GetCrashSignalFD(command_line);
if (crash_signal_fd >= 0) {
mappings->Share(service_manager::kCrashDumpSignal, crash_signal_fd);
mappings->Share(kCrashDumpSignal, crash_signal_fd);
}
}
#endif // defined(OS_LINUX)
@ -1100,6 +1099,7 @@ AlloyContentBrowserClient::CreateLoginDelegate(
void AlloyContentBrowserClient::RegisterNonNetworkNavigationURLLoaderFactories(
int frame_tree_node_id,
base::UkmSourceId ukm_source_id,
NonNetworkURLLoaderFactoryDeprecatedMap* uniquely_owned_factories,
NonNetworkURLLoaderFactoryMap* factories) {
if (!extensions::ExtensionsEnabled())
return;
@ -1116,6 +1116,7 @@ void AlloyContentBrowserClient::RegisterNonNetworkNavigationURLLoaderFactories(
void AlloyContentBrowserClient::RegisterNonNetworkSubresourceURLLoaderFactories(
int render_process_id,
int render_frame_id,
NonNetworkURLLoaderFactoryDeprecatedMap* uniquely_owned_factories,
NonNetworkURLLoaderFactoryMap* factories) {
if (!extensions::ExtensionsEnabled())
return;
@ -1157,10 +1158,10 @@ void AlloyContentBrowserClient::RegisterNonNetworkSubresourceURLLoaderFactories(
allowed_webui_hosts.emplace_back(chrome::kChromeUIThemeHost);
}
if (!allowed_webui_hosts.empty()) {
factories->emplace(
content::kChromeUIScheme,
content::CreateWebUIURLLoader(frame_host, content::kChromeUIScheme,
std::move(allowed_webui_hosts)));
factories->emplace(content::kChromeUIScheme,
content::CreateWebUIURLLoaderFactory(
frame_host, content::kChromeUIScheme,
std::move(allowed_webui_hosts)));
}
}
@ -1171,6 +1172,7 @@ bool AlloyContentBrowserClient::WillCreateURLLoaderFactory(
URLLoaderFactoryType type,
const url::Origin& request_initiator,
base::Optional<int64_t> navigation_id,
base::UkmSourceId ukm_source_id,
mojo::PendingReceiver<network::mojom::URLLoaderFactory>* factory_receiver,
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient>*
header_client,

View File

@ -102,10 +102,10 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
bool opener_suppressed,
bool* no_javascript_access) override;
void OverrideWebkitPrefs(content::RenderViewHost* rvh,
content::WebPreferences* prefs) override;
blink::web_pref::WebPreferences* prefs) override;
bool OverrideWebPreferencesAfterNavigation(
content::WebContents* web_contents,
content::WebPreferences* prefs) override;
blink::web_pref::WebPreferences* prefs) override;
void BrowserURLHandlerCreated(content::BrowserURLHandler* handler) override;
std::string GetDefaultDownloadName() override;
void DidCreatePpapiPlugin(content::BrowserPpapiHost* browser_host) override;
@ -151,10 +151,12 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
void RegisterNonNetworkNavigationURLLoaderFactories(
int frame_tree_node_id,
base::UkmSourceId ukm_source_id,
NonNetworkURLLoaderFactoryDeprecatedMap* uniquely_owned_factories,
NonNetworkURLLoaderFactoryMap* factories) override;
void RegisterNonNetworkSubresourceURLLoaderFactories(
int render_process_id,
int render_frame_id,
NonNetworkURLLoaderFactoryDeprecatedMap* uniquely_owned_factories,
NonNetworkURLLoaderFactoryMap* factories) override;
bool WillCreateURLLoaderFactory(
content::BrowserContext* browser_context,
@ -163,6 +165,7 @@ class AlloyContentBrowserClient : public content::ContentBrowserClient {
URLLoaderFactoryType type,
const url::Origin& request_initiator,
base::Optional<int64_t> navigation_id,
base::UkmSourceId ukm_source_id,
mojo::PendingReceiver<network::mojom::URLLoaderFactory>* factory_receiver,
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient>*
header_client,

View File

@ -25,6 +25,15 @@
#include "extensions/browser/process_manager.h"
#include "third_party/blink/public/mojom/frame/find_in_page.mojom.h"
namespace {
printing::CefPrintViewManager* GetPrintViewManager(
content::WebContents* web_contents) {
return printing::CefPrintViewManager::FromWebContents(web_contents);
}
} // namespace
CefBrowserPlatformDelegateAlloy::CefBrowserPlatformDelegateAlloy()
: weak_ptr_factory_(this) {}
@ -348,11 +357,9 @@ void CefBrowserPlatformDelegateAlloy::Print() {
auto rfh = actionable_contents->GetMainFrame();
if (IsPrintPreviewSupported()) {
printing::CefPrintViewManager::FromWebContents(actionable_contents)
->PrintPreviewNow(rfh, false);
GetPrintViewManager(actionable_contents)->PrintPreviewNow(rfh, false);
} else {
printing::PrintViewManager::FromWebContents(actionable_contents)
->PrintNow(rfh);
GetPrintViewManager(actionable_contents)->PrintNow(rfh);
}
}
@ -370,7 +377,7 @@ void CefBrowserPlatformDelegateAlloy::PrintToPDF(
pdf_callback = base::Bind(&CefPdfPrintCallback::OnPdfPrintFinished,
callback.get(), path);
}
printing::CefPrintViewManager::FromWebContents(actionable_contents)
GetPrintViewManager(actionable_contents)
->PrintToPDF(actionable_contents->GetMainFrame(), base::FilePath(path),
settings, pdf_callback);
}
@ -394,7 +401,7 @@ void CefBrowserPlatformDelegateAlloy::Find(int identifier,
auto options = blink::mojom::FindOptions::New();
options->forward = forward;
options->match_case = matchCase;
options->find_next_if_selection_matches = findNext;
options->find_match = findNext;
web_contents_->Find(identifier, searchText, std::move(options));
}

View File

@ -325,6 +325,12 @@ ChromeBrowserProcessAlloy::floc_blocklist_service() {
return nullptr;
}
federated_learning::FlocSortingLshClustersService*
ChromeBrowserProcessAlloy::floc_sorting_lsh_clusters_service() {
NOTREACHED();
return nullptr;
}
optimization_guide::OptimizationGuideService*
ChromeBrowserProcessAlloy::optimization_guide_service() {
NOTREACHED();

View File

@ -83,6 +83,8 @@ class ChromeBrowserProcessAlloy : public BrowserProcess {
subresource_filter::RulesetService* subresource_filter_ruleset_service()
override;
federated_learning::FlocBlocklistService* floc_blocklist_service() override;
federated_learning::FlocSortingLshClustersService*
floc_sorting_lsh_clusters_service() override;
optimization_guide::OptimizationGuideService* optimization_guide_service()
override;
StartupData* startup_data() override;

View File

@ -23,9 +23,10 @@ class CefVariationsClient : public variations::VariationsClient {
return browser_context_->IsOffTheRecord();
}
std::string GetVariationsHeader() const override {
variations::mojom::VariationsHeadersPtr GetVariationsHeaders()
const override {
return variations::VariationsIdsProvider::GetInstance()
->GetClientDataHeader(false /* is_signed_in */);
->GetClientDataHeaders(false /* is_signed_in */);
}
private:
@ -171,3 +172,7 @@ base::Time ChromeProfileAlloy::GetCreationTime() const {
void ChromeProfileAlloy::SetCreationTimeForTesting(base::Time creation_time) {
NOTREACHED();
}
void ChromeProfileAlloy::RecordMainFrameNavigation() {
NOTREACHED();
}

View File

@ -50,6 +50,7 @@ class ChromeProfileAlloy : public Profile {
ExitType GetLastSessionExitType() const override;
base::Time GetCreationTime() const override;
void SetCreationTimeForTesting(base::Time creation_time) override;
void RecordMainFrameNavigation() override;
private:
std::unique_ptr<variations::VariationsClient> variations_client_;

View File

@ -6,6 +6,7 @@
#include "libcef/common/extensions/extensions_util.h"
#include "chrome/browser/content_settings/cookie_settings_factory.h"
#include "chrome/browser/media/router/chrome_media_router_factory.h"
#include "chrome/browser/plugins/plugin_prefs_factory.h"
#include "chrome/browser/profiles/renderer_updater_factory.h"
#include "chrome/browser/spellchecker/spellcheck_factory.h"
@ -19,6 +20,7 @@ namespace cef {
void EnsureBrowserContextKeyedServiceFactoriesBuilt() {
CookieSettingsFactory::GetInstance();
media_router::ChromeMediaRouterFactory::GetInstance();
PluginPrefsFactory::GetInstance();
PrefsTabHelper::GetServiceInstance();
RendererUpdaterFactory::GetInstance();

View File

@ -9,8 +9,8 @@
#include "libcef/common/values_impl.h"
#include "base/logging.h"
#include "content/browser/frame_host/frame_tree_node.h"
#include "content/browser/frame_host/render_frame_host_impl.h"
#include "content/browser/renderer_host/frame_tree_node.h"
#include "content/browser/renderer_host/render_frame_host_impl.h"
#include "content/public/browser/render_process_host.h"
#include "ipc/ipc_message.h"

View File

@ -309,16 +309,16 @@ void CefBrowserPlatformDelegate::DragTargetDrop(const CefMouseEvent& event) {
void CefBrowserPlatformDelegate::StartDragging(
const content::DropData& drop_data,
blink::WebDragOperationsMask allowed_ops,
blink::DragOperationsMask allowed_ops,
const gfx::ImageSkia& image,
const gfx::Vector2d& image_offset,
const content::DragEventSourceInfo& event_info,
const blink::mojom::DragEventSourceInfo& event_info,
content::RenderWidgetHostImpl* source_rwh) {
NOTREACHED();
}
void CefBrowserPlatformDelegate::UpdateDragCursor(
blink::WebDragOperation operation) {
blink::DragOperation operation) {
NOTREACHED();
}

View File

@ -16,7 +16,8 @@
#include "base/callback_forward.h"
#include "extensions/common/view_type.h"
#include "third_party/blink/public/common/page/web_drag_operation.h"
#include "third_party/blink/public/common/page/drag_operation.h"
#include "third_party/blink/public/mojom/page/drag.mojom-forward.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/base/window_open_disposition.h"
@ -33,7 +34,6 @@ class WebTouchEvent;
namespace content {
struct AXEventNotificationDetails;
struct AXLocationChangeNotificationDetails;
struct DragEventSourceInfo;
struct DropData;
struct NativeWebKeyboardEvent;
class RenderViewHost;
@ -320,13 +320,14 @@ class CefBrowserPlatformDelegate {
cef_drag_operations_mask_t allowed_ops);
virtual void DragTargetDragLeave();
virtual void DragTargetDrop(const CefMouseEvent& event);
virtual void StartDragging(const content::DropData& drop_data,
blink::WebDragOperationsMask allowed_ops,
const gfx::ImageSkia& image,
const gfx::Vector2d& image_offset,
const content::DragEventSourceInfo& event_info,
content::RenderWidgetHostImpl* source_rwh);
virtual void UpdateDragCursor(blink::WebDragOperation operation);
virtual void StartDragging(
const content::DropData& drop_data,
blink::DragOperationsMask allowed_ops,
const gfx::ImageSkia& image,
const gfx::Vector2d& image_offset,
const blink::mojom::DragEventSourceInfo& event_info,
content::RenderWidgetHostImpl* source_rwh);
virtual void UpdateDragCursor(blink::DragOperation operation);
virtual void DragSourceEndedAt(int x, int y, cef_drag_operations_mask_t op);
virtual void DragSourceSystemDragEnded();
virtual void AccessibilityEventReceived(

View File

@ -154,6 +154,7 @@ bool ChromeContentBrowserClientCef::WillCreateURLLoaderFactory(
URLLoaderFactoryType type,
const url::Origin& request_initiator,
base::Optional<int64_t> navigation_id,
base::UkmSourceId ukm_source_id,
mojo::PendingReceiver<network::mojom::URLLoaderFactory>* factory_receiver,
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient>*
header_client,
@ -162,8 +163,8 @@ bool ChromeContentBrowserClientCef::WillCreateURLLoaderFactory(
network::mojom::URLLoaderFactoryOverridePtr* factory_override) {
bool use_proxy = ChromeContentBrowserClient::WillCreateURLLoaderFactory(
browser_context, frame, render_process_id, type, request_initiator,
navigation_id, factory_receiver, header_client, bypass_redirect_checks,
disable_secure_dns, factory_override);
navigation_id, ukm_source_id, factory_receiver, header_client,
bypass_redirect_checks, disable_secure_dns, factory_override);
if (use_proxy) {
// The chrome layer will handle the request.
return use_proxy;

View File

@ -47,6 +47,7 @@ class ChromeContentBrowserClientCef : public ChromeContentBrowserClient {
URLLoaderFactoryType type,
const url::Origin& request_initiator,
base::Optional<int64_t> navigation_id,
base::UkmSourceId ukm_source_id,
mojo::PendingReceiver<network::mojom::URLLoaderFactory>* factory_receiver,
mojo::PendingRemote<network::mojom::TrustedURLLoaderHeaderClient>*
header_client,

View File

@ -54,6 +54,7 @@
#include "net/traffic_annotation/network_traffic_annotation.h"
#include "services/network/public/cpp/simple_url_loader.h"
#include "services/network/public/cpp/simple_url_loader_stream_consumer.h"
#include "services/network/public/cpp/wrapper_shared_url_loader_factory.h"
#include "services/network/public/mojom/url_response_head.mojom.h"
#include "storage/browser/file_system/native_file_util.h"
@ -445,15 +446,15 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
resource_request->site_for_cookies = net::SiteForCookies::FromUrl(gurl);
resource_request->headers.AddHeadersFromString(headers);
std::unique_ptr<network::mojom::URLLoaderFactory> file_url_loader_factory;
scoped_refptr<network::SharedURLLoaderFactory> network_url_loader_factory;
std::unique_ptr<network::mojom::URLLoaderFactory> webui_url_loader_factory;
network::mojom::URLLoaderFactory* url_loader_factory;
scoped_refptr<network::SharedURLLoaderFactory> url_loader_factory;
if (gurl.SchemeIsFile()) {
file_url_loader_factory = content::CreateFileURLLoaderFactory(
base::FilePath() /* profile_path */,
nullptr /* shared_cors_origin_access_list */);
url_loader_factory = file_url_loader_factory.get();
mojo::PendingRemote<network::mojom::URLLoaderFactory> pending_remote =
content::CreateFileURLLoaderFactory(
base::FilePath() /* profile_path */,
nullptr /* shared_cors_origin_access_list */);
url_loader_factory = network::SharedURLLoaderFactory::Create(
std::make_unique<network::WrapperPendingSharedURLLoaderFactory>(
std::move(pending_remote)));
} else if (content::HasWebUIScheme(gurl)) {
base::DictionaryValue response;
response.SetInteger("statusCode", 403);
@ -462,15 +463,13 @@ void CefDevToolsFrontend::HandleMessageFromDevToolsFrontend(
} else {
auto* partition = content::BrowserContext::GetStoragePartitionForSite(
web_contents()->GetBrowserContext(), gurl);
network_url_loader_factory =
partition->GetURLLoaderFactoryForBrowserProcess();
url_loader_factory = network_url_loader_factory.get();
url_loader_factory = partition->GetURLLoaderFactoryForBrowserProcess();
}
auto simple_url_loader = network::SimpleURLLoader::Create(
std::move(resource_request), traffic_annotation);
auto resource_loader = std::make_unique<NetworkResourceLoader>(
stream_id, this, std::move(simple_url_loader), url_loader_factory,
stream_id, this, std::move(simple_url_loader), url_loader_factory.get(),
request_id);
loaders_.insert(std::move(resource_loader));
return;

View File

@ -130,6 +130,14 @@ ExecuteCodeFunction::InitResult ExecuteCodeInTabFunction::Init() {
return set_init_result(SUCCESS);
}
bool ExecuteCodeInTabFunction::ShouldInsertCSS() const {
return false;
}
bool ExecuteCodeInTabFunction::ShouldRemoveCSS() const {
return false;
}
bool ExecuteCodeInTabFunction::CanExecuteScriptOnPage(std::string* error) {
CHECK_GE(execute_tab_id_, 0);
@ -225,11 +233,11 @@ void ExecuteCodeInTabFunction::LoadFileComplete(
DidLoadAndLocalizeFile(file, success, std::move(data));
}
bool TabsExecuteScriptFunction::ShouldInsertCSS() const {
return false;
bool TabsInsertCSSFunction::ShouldInsertCSS() const {
return true;
}
bool TabsInsertCSSFunction::ShouldInsertCSS() const {
bool TabsRemoveCSSFunction::ShouldRemoveCSS() const {
return true;
}

View File

@ -42,7 +42,7 @@ class TabsCreateFunction : public ExtensionFunction {
const CefExtensionFunctionDetails cef_details_;
};
// Implement API call tabs.executeScript and tabs.insertCSS.
// Implement API calls tabs.executeScript, tabs.insertCSS, and tabs.removeCSS.
class ExecuteCodeInTabFunction : public ExecuteCodeFunction {
public:
ExecuteCodeInTabFunction();
@ -52,6 +52,8 @@ class ExecuteCodeInTabFunction : public ExecuteCodeFunction {
// Initializes |execute_tab_id_| and |details_|.
InitResult Init() override;
bool ShouldInsertCSS() const override;
bool ShouldRemoveCSS() const override;
bool CanExecuteScriptOnPage(std::string* error) override;
ScriptExecutor* GetScriptExecutor(std::string* error) override;
bool IsWebView() const override;
@ -69,9 +71,6 @@ class ExecuteCodeInTabFunction : public ExecuteCodeFunction {
};
class TabsExecuteScriptFunction : public ExecuteCodeInTabFunction {
protected:
bool ShouldInsertCSS() const override;
private:
~TabsExecuteScriptFunction() override {}
@ -87,6 +86,15 @@ class TabsInsertCSSFunction : public ExecuteCodeInTabFunction {
DECLARE_EXTENSION_FUNCTION("tabs.insertCSS", TABS_INSERTCSS)
};
class TabsRemoveCSSFunction : public ExecuteCodeInTabFunction {
private:
~TabsRemoveCSSFunction() override {}
bool ShouldRemoveCSS() const override;
DECLARE_EXTENSION_FUNCTION("tabs.removeCSS", TABS_INSERTCSS)
};
// Based on ChromeAsyncExtensionFunction.
class ZoomAPIFunction : public ExtensionFunction {
public:

View File

@ -64,8 +64,7 @@ content::WebContents* GetOwnerForGuestContents(content::WebContents* guest) {
content::BrowserPluginGuest* plugin_guest =
guest_impl->GetBrowserPluginGuest();
if (plugin_guest) {
return content::WebContents::FromRenderFrameHost(
plugin_guest->GetEmbedderFrame());
return plugin_guest->owner_web_contents();
}
// Maybe it's a print preview dialog.

View File

@ -53,6 +53,7 @@ const char* const kSupportedAPIs[] = {
EXTENSION_FUNCTION_NAME(cefimpl::TabsCreateFunction),
EXTENSION_FUNCTION_NAME(cefimpl::TabsExecuteScriptFunction),
EXTENSION_FUNCTION_NAME(cefimpl::TabsInsertCSSFunction),
EXTENSION_FUNCTION_NAME(cefimpl::TabsRemoveCSSFunction),
EXTENSION_FUNCTION_NAME(cefimpl::TabsSetZoomFunction),
EXTENSION_FUNCTION_NAME(cefimpl::TabsGetZoomFunction),
EXTENSION_FUNCTION_NAME(cefimpl::TabsSetZoomSettingsFunction),
@ -91,6 +92,7 @@ void ChromeFunctionRegistry::RegisterAll(ExtensionFunctionRegistry* registry) {
registry->RegisterFunction<StorageStorageAreaGetBytesInUseFunction>();
registry->RegisterFunction<cefimpl::TabsExecuteScriptFunction>();
registry->RegisterFunction<cefimpl::TabsInsertCSSFunction>();
registry->RegisterFunction<cefimpl::TabsRemoveCSSFunction>();
registry->RegisterFunction<cefimpl::TabsGetFunction>();
registry->RegisterFunction<cefimpl::TabsCreateFunction>();
registry->RegisterFunction<cefimpl::TabsSetZoomFunction>();

View File

@ -17,7 +17,7 @@
#include "libcef/common/request_impl.h"
#include "libcef/common/task_runner_impl.h"
#include "content/browser/frame_host/frame_tree_node.h"
#include "content/browser/renderer_host/frame_tree_node.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"

View File

@ -21,11 +21,12 @@
#include "base/synchronization/lock.h"
#include "base/synchronization/waitable_event.h"
#include "base/threading/thread.h"
#include "content/app/content_service_manager_main_delegate.h"
#include "content/app/content_main_runner_impl.h"
#include "content/browser/scheduler/browser_task_executor.h"
#include "content/public/app/content_main.h"
#include "content/public/app/content_main_runner.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/common/content_switches.h"
#include "services/service_manager/embedder/main.h"
#if defined(OS_WIN)
#include <Objbase.h>
@ -362,7 +363,10 @@ int CefMainRunner::ContentMainInitialize(const CefMainArgs& args,
main_delegate_->BeforeMainThreadInitialize(args);
// Initialize the content runner.
content::ContentMainParams params(main_delegate_->GetContentMainDelegate());
main_runner_ = content::ContentMainRunner::Create();
main_params_ = std::make_unique<content::ContentMainParams>(
main_delegate_->GetContentMainDelegate());
#if defined(OS_WIN)
sandbox::SandboxInterfaceInfo sandbox_info = {0};
if (windows_sandbox_info == nullptr) {
@ -370,25 +374,15 @@ int CefMainRunner::ContentMainInitialize(const CefMainArgs& args,
*no_sandbox = true;
}
params.instance = args.instance;
params.sandbox_info =
main_params_->instance = args.instance;
main_params_->sandbox_info =
static_cast<sandbox::SandboxInterfaceInfo*>(windows_sandbox_info);
#else
params.argc = args.argc;
params.argv = const_cast<const char**>(args.argv);
main_params_->argc = args.argc;
main_params_->argv = const_cast<const char**>(args.argv);
#endif
sm_main_delegate_.reset(
new content::ContentServiceManagerMainDelegate(params));
sm_main_params_.reset(
new service_manager::MainParams(sm_main_delegate_.get()));
#if defined(OS_POSIX) && !defined(OS_ANDROID)
sm_main_params_->argc = params.argc;
sm_main_params_->argv = params.argv;
#endif
return service_manager::MainInitialize(*sm_main_params_);
return content::ContentMainInitialize(*main_params_, main_runner_.get());
}
bool CefMainRunner::ContentMainRun(bool* initialized,
@ -402,7 +396,8 @@ bool CefMainRunner::ContentMainRun(bool* initialized,
if (!CreateUIThread(base::BindOnce(
[](CefMainRunner* runner, base::WaitableEvent* event) {
service_manager::MainRun(*runner->sm_main_params_);
content::ContentMainRun(*runner->main_params_,
runner->main_runner_.get());
event->Signal();
},
base::Unretained(this),
@ -412,11 +407,11 @@ bool CefMainRunner::ContentMainRun(bool* initialized,
*initialized = true;
// We need to wait until service_manager::MainRun has finished.
// We need to wait until content::ContentMainRun has finished.
uithread_startup_event.Wait();
} else {
*initialized = true;
service_manager::MainRun(*sm_main_params_);
content::ContentMainRun(*main_params_, main_runner_.get());
}
if (CEF_CURRENTLY_ON_UIT()) {
@ -484,7 +479,8 @@ void CefMainRunner::FinishShutdownOnUIThread(
base::WaitableEvent* uithread_shutdown_event) {
CEF_REQUIRE_UIT();
sm_main_delegate_->ShutdownOnUIThread();
static_cast<content::ContentMainRunnerImpl*>(main_runner_.get())
->ShutdownOnUIThread();
std::move(shutdown_on_ui_thread).Run();
main_delegate_->AfterUIThreadShutdown();
@ -508,10 +504,10 @@ void CefMainRunner::FinalizeShutdown(base::OnceClosure finalize_shutdown) {
}
// Shut down the content runner.
service_manager::MainShutdown(*sm_main_params_);
content::ContentMainShutdown(*main_params_, main_runner_.get());
sm_main_params_.reset();
sm_main_delegate_.reset();
main_params_.reset();
main_runner_.reset();
std::move(finalize_shutdown).Run();
main_delegate_->AfterMainThreadShutdown();

View File

@ -20,15 +20,10 @@ class WaitableEvent;
}
namespace content {
class ContentMainDelegate;
class ContentServiceManagerMainDelegate;
struct MainFunctionParams;
class ContentMainRunner;
struct ContentMainParams;
} // namespace content
namespace service_manager {
struct MainParams;
}
class CefUIThread;
// Manages the main process lifespan and related objects.
@ -87,8 +82,8 @@ class CefMainRunner : public CefMainRunnerHandler {
const bool external_message_pump_;
std::unique_ptr<CefMainRunnerDelegate> main_delegate_;
std::unique_ptr<content::ContentServiceManagerMainDelegate> sm_main_delegate_;
std::unique_ptr<service_manager::MainParams> sm_main_params_;
std::unique_ptr<content::ContentMainRunner> main_runner_;
std::unique_ptr<content::ContentMainParams> main_params_;
std::unique_ptr<content::BrowserMainRunner> browser_runner_;
std::unique_ptr<CefUIThread> ui_thread_;

View File

@ -9,7 +9,7 @@
#include "include/cef_media_router.h"
#include "libcef/browser/browser_context.h"
#include "chrome/common/media_router/media_route.h"
#include "components/media_router/common/media_route.h"
// Implementation of the CefMediaRoute interface. Only created on the UI thread.
class CefMediaRouteImpl : public CefMediaRoute {

View File

@ -9,7 +9,7 @@
#include "include/cef_media_router.h"
#include "libcef/browser/browser_context.h"
#include "chrome/common/media_router/mojom/media_router.mojom.h"
#include "components/media_router/common/mojom/media_router.mojom.h"
class CefRegistrationImpl;

View File

@ -7,10 +7,10 @@
#include "libcef/browser/browser_context.h"
#include "libcef/browser/thread_util.h"
#include "chrome/browser/media/router/media_router_factory.h"
#include "chrome/browser/media/router/media_routes_observer.h"
#include "chrome/browser/media/router/route_message_observer.h"
#include "chrome/browser/media/router/route_message_util.h"
#include "components/media_router/browser/media_router_factory.h"
#include "components/media_router/browser/media_routes_observer.h"
#include "components/media_router/browser/route_message_observer.h"
#include "components/media_router/browser/route_message_util.h"
namespace {

View File

@ -10,9 +10,9 @@
#include "base/memory/weak_ptr.h"
#include "base/observer_list.h"
#include "chrome/browser/media/router/media_router.h"
#include "chrome/browser/ui/media_router/query_result_manager.h"
#include "chrome/common/media_router/mojom/media_router.mojom.h"
#include "components/media_router/browser/media_router.h"
#include "components/media_router/common/mojom/media_router.mojom.h"
namespace content {
class BrowserContext;

View File

@ -9,8 +9,8 @@
#include "base/strings/string_number_conversions.h"
#include "chrome/browser/media/router/discovery/dial/dial_media_sink_service_impl.h"
#include "chrome/browser/media/router/providers/cast/dual_media_sink_service.h"
#include "chrome/common/media_router/discovery/media_sink_internal.h"
#include "chrome/common/media_router/discovery/media_sink_service_base.h"
#include "components/media_router/common/discovery/media_sink_internal.h"
#include "components/media_router/common/discovery/media_sink_service_base.h"
namespace {

View File

@ -8,7 +8,7 @@
#include "include/cef_media_router.h"
#include "chrome/common/media_router/media_sink.h"
#include "components/media_router/common/media_sink.h"
// Implementation of the CefMediaSink interface. May be created on any thread.
class CefMediaSinkImpl : public CefMediaSink {

View File

@ -8,7 +8,7 @@
#include "include/cef_media_router.h"
#include "chrome/common/media_router/media_source.h"
#include "components/media_router/common/media_source.h"
// Implementation of the CefMediaSource interface. May be created on any thread.
class CefMediaSourceImpl : public CefMediaSource {

View File

@ -72,12 +72,20 @@ bool CefBrowserPlatformDelegateNativeLinux::CreateHostWindow() {
#if defined(USE_X11)
DCHECK(!window_x11_);
x11::Window parent_window = x11::Window::None;
if (window_info_.parent_window != kNullWindowHandle) {
parent_window = static_cast<x11::Window>(window_info_.parent_window);
}
// Create a new window object. It will delete itself when the associated X11
// window is destroyed.
window_x11_ =
new CefWindowX11(browser_, window_info_.parent_window, rect,
new CefWindowX11(browser_, parent_window, rect,
CefString(&window_info_.window_name).ToString());
window_info_.window = window_x11_->xwindow();
DCHECK_NE(window_x11_->xwindow(), x11::Window::None);
window_info_.window =
static_cast<cef_window_handle_t>(window_x11_->xwindow());
host_window_created_ = true;

View File

@ -92,9 +92,9 @@ std::wstring FormatFilterForExtensions(
if (unique_exts.size() > 1) {
std::wstring ext;
auto it = unique_exts.cbegin();
ext = it->as_string();
ext = std::wstring(*it);
for (++it; it != unique_exts.cend(); ++it) {
ext += L";" + it->as_string();
ext += L";" + std::wstring(*it);
}
std::wstring desc =
l10n_util::GetStringUTF16(IDS_CUSTOM_FILES) + L" (" + ext + L")";

View File

@ -4,10 +4,6 @@
// found in the LICENSE file.
#include "libcef/browser/native/window_x11.h"
#include <X11/Xatom.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/extensions/XInput2.h>
#include "libcef/browser/alloy/alloy_browser_host_impl.h"
#include "libcef/browser/browser_host_base.h"
@ -16,73 +12,49 @@
#include "ui/base/x/x11_util.h"
#include "ui/events/platform/platform_event_source.h"
#include "ui/events/x/x11_event_translation.h"
#include "ui/events/x/x11_window_event_manager.h"
#include "ui/gfx/x/connection.h"
#include "ui/gfx/x/xproto_util.h"
#include "ui/platform_window/x11/x11_topmost_window_finder.h"
#include "ui/views/widget/desktop_aura/desktop_window_tree_host_linux.h"
namespace {
// Restore Xlib constants that were #undef'ed by gen/ui/gfx/x/xproto.h.
constexpr int CopyFromParent = 0;
constexpr int InputOutput = 1;
const char kAtom[] = "ATOM";
const char kWMDeleteWindow[] = "WM_DELETE_WINDOW";
const char kWMProtocols[] = "WM_PROTOCOLS";
const char kNetWMName[] = "_NET_WM_NAME";
const char kNetWMPid[] = "_NET_WM_PID";
const char kNetWMPing[] = "_NET_WM_PING";
const char kNetWMState[] = "_NET_WM_STATE";
const char kNetWMStateKeepAbove[] = "_NET_WM_STATE_KEEP_ABOVE";
const char kWMDeleteWindow[] = "WM_DELETE_WINDOW";
const char kWMProtocols[] = "WM_PROTOCOLS";
const char kXdndProxy[] = "XdndProxy";
const char kUTF8String[] = "UTF8_STRING";
// See https://crbug.com/1066670#c57 for background.
inline x11::Window ToX11Window(::Window window) {
return static_cast<x11::Window>(window);
}
inline ::Window ToWindow(x11::Window window) {
return static_cast<::Window>(window);
}
// See https://crbug.com/1066670#c29 for background.
inline ::Atom GetAtom(const std::string& atom_name) {
return static_cast<::Atom>(gfx::GetAtom(atom_name));
}
::Window FindChild(::Display* display, ::Window window) {
::Window root;
::Window parent;
::Window* children;
::Window child_window = x11::None;
unsigned int nchildren;
if (XQueryTree(display, window, &root, &parent, &children, &nchildren) &&
nchildren == 1) {
child_window = children[0];
XFree(children);
x11::Window FindChild(x11::Window window) {
auto query_tree = x11::Connection::Get()->QueryTree({window}).Sync();
if (query_tree && query_tree->children.size() == 1U) {
return query_tree->children[0];
}
return child_window;
return x11::Window::None;
}
::Window FindToplevelParent(::Display* display, ::Window window) {
::Window top_level_window = window;
::Window root = x11::None;
::Window parent = x11::None;
::Window* children = nullptr;
unsigned int nchildren = 0;
// Enumerate all parents of "window" to find the highest level window
// that either:
// - has a parent that does not contain the _NET_WM_PID property
// - has a parent that is the root window.
while (XQueryTree(display, window, &root, &parent, &children, &nchildren)) {
if (children) {
XFree(children);
}
x11::Window FindToplevelParent(x11::Window window) {
x11::Window top_level_window = window;
do {
auto query_tree = x11::Connection::Get()->QueryTree({window}).Sync();
if (!query_tree)
break;
top_level_window = window;
if (!ui::PropertyExists(ToX11Window(parent), kNetWMPid) || parent == root) {
if (!ui::PropertyExists(query_tree->parent, kNetWMPid) ||
query_tree->parent == query_tree->root) {
break;
}
window = parent;
}
window = query_tree->parent;
} while (true);
return top_level_window;
}
@ -95,85 +67,93 @@ CEF_EXPORT XDisplay* cef_get_xdisplay() {
}
CefWindowX11::CefWindowX11(CefRefPtr<CefBrowserHostBase> browser,
::Window parent_xwindow,
x11::Window parent_xwindow,
const gfx::Rect& bounds,
const std::string& title)
: browser_(browser),
xdisplay_(gfx::GetXDisplay()),
connection_(x11::Connection::Get()),
parent_xwindow_(parent_xwindow),
xwindow_(0),
window_mapped_(false),
bounds_(bounds),
focus_pending_(false),
weak_ptr_factory_(this) {
if (parent_xwindow_ == x11::None)
parent_xwindow_ = DefaultRootWindow(xdisplay_);
if (parent_xwindow_ == x11::Window::None)
parent_xwindow_ = ui::GetX11RootWindow();
XSetWindowAttributes swa;
memset(&swa, 0, sizeof(swa));
swa.background_pixmap = x11::None;
swa.override_redirect = false;
xwindow_ = XCreateWindow(xdisplay_, parent_xwindow_, bounds.x(), bounds.y(),
bounds.width(), bounds.height(),
0, // border width
CopyFromParent, // depth
InputOutput,
nullptr, // visual
CWBackPixmap | CWOverrideRedirect, &swa);
CHECK(xwindow_);
x11::VisualId visual;
uint8_t depth;
x11::ColorMap colormap;
ui::XVisualManager::GetInstance()->ChooseVisualForWindow(
/*want_argb_visual=*/false, &visual, &depth, &colormap,
/*visual_has_alpha=*/nullptr);
xwindow_ = connection_->GenerateId<x11::Window>();
connection_->CreateWindow({
.depth = depth,
.wid = xwindow_,
.parent = parent_xwindow_,
.x = bounds.x(),
.y = bounds.y(),
.width = bounds.width(),
.height = bounds.height(),
.c_class = x11::WindowClass::InputOutput,
.visual = visual,
.background_pixel = 0,
.border_pixel = 0,
.override_redirect = x11::Bool32(false),
.event_mask = x11::EventMask::FocusChange |
x11::EventMask::StructureNotify |
x11::EventMask::PropertyChange,
.colormap = colormap,
});
connection_->Flush();
DCHECK(ui::X11EventSource::HasInstance());
ui::X11EventSource::GetInstance()->AddXEventDispatcher(this);
long event_mask = FocusChangeMask | StructureNotifyMask | PropertyChangeMask;
XSelectInput(xdisplay_, xwindow_, event_mask);
XFlush(xdisplay_);
std::vector<x11::Atom> protocols = {
gfx::GetAtom(kWMDeleteWindow),
gfx::GetAtom(kNetWMPing),
};
ui::SetArrayProperty(xwindow_, gfx::GetAtom(kWMProtocols), x11::Atom::ATOM,
protocols);
// TODO(erg): We currently only request window deletion events. We also
// should listen for activation events and anything else that GTK+ listens
// for, and do something useful.
::Atom protocols[2];
protocols[0] = GetAtom(kWMDeleteWindow);
protocols[1] = GetAtom(kNetWMPing);
XSetWMProtocols(xdisplay_, xwindow_, protocols, 2);
// We need a WM_CLIENT_MACHINE and WM_LOCALE_NAME value so we integrate with
// the desktop environment.
XSetWMProperties(xdisplay_, xwindow_, NULL, NULL, NULL, 0, NULL, NULL, NULL);
// We need a WM_CLIENT_MACHINE value so we integrate with the desktop
// environment.
ui::SetStringProperty(xwindow_, x11::Atom::WM_CLIENT_MACHINE,
x11::Atom::STRING, net::GetHostName());
// Likewise, the X server needs to know this window's pid so it knows which
// program to kill if the window hangs.
// XChangeProperty() expects "pid" to be long.
static_assert(sizeof(long) >= sizeof(pid_t),
"pid_t should not be larger than long");
long pid = getpid();
XChangeProperty(xdisplay_, xwindow_, GetAtom(kNetWMPid), XA_CARDINAL, 32,
PropModeReplace, reinterpret_cast<unsigned char*>(&pid), 1);
static_assert(sizeof(uint32_t) >= sizeof(pid_t),
"pid_t should not be larger than uint32_t");
uint32_t pid = getpid();
ui::SetProperty(xwindow_, gfx::GetAtom(kNetWMPid), x11::Atom::CARDINAL, pid);
// Set the initial window name, if provided.
if (!title.empty()) {
XChangeProperty(xdisplay_, xwindow_, GetAtom(kNetWMName),
GetAtom(kUTF8String), 8, PropModeReplace,
reinterpret_cast<const unsigned char*>(title.c_str()),
title.size());
ui::SetStringProperty(xwindow_, x11::Atom::WM_NAME, x11::Atom::STRING,
title);
ui::SetStringProperty(xwindow_, x11::Atom::WM_ICON_NAME, x11::Atom::STRING,
title);
}
}
CefWindowX11::~CefWindowX11() {
DCHECK(!xwindow_);
DCHECK_EQ(xwindow_, x11::Window::None);
DCHECK(ui::X11EventSource::HasInstance());
ui::X11EventSource::GetInstance()->RemoveXEventDispatcher(this);
}
void CefWindowX11::Close() {
XEvent ev = {0};
ev.xclient.type = ClientMessage;
ev.xclient.window = xwindow_;
ev.xclient.message_type = GetAtom(kWMProtocols);
ev.xclient.format = 32;
ev.xclient.data.l[0] = GetAtom(kWMDeleteWindow);
ev.xclient.data.l[1] = x11::CurrentTime;
XSendEvent(xdisplay_, xwindow_, false, NoEventMask, &ev);
if (xwindow_ == x11::Window::None)
return;
ui::SendClientMessage(
xwindow_, xwindow_, gfx::GetAtom(kWMProtocols),
{static_cast<uint32_t>(gfx::GetAtom(kWMDeleteWindow)),
static_cast<uint32_t>(x11::Time::CurrentTime), 0, 0, 0},
x11::EventMask::NoEvent);
auto host = GetHost();
if (host)
@ -181,120 +161,122 @@ void CefWindowX11::Close() {
}
void CefWindowX11::Show() {
if (xwindow_ == x11::None)
if (xwindow_ == x11::Window::None)
return;
if (!window_mapped_) {
// Before we map the window, set size hints. Otherwise, some window managers
// will ignore toplevel XMoveWindow commands.
XSizeHints size_hints;
size_hints.flags = PPosition | PWinGravity;
ui::SizeHints size_hints;
memset(&size_hints, 0, sizeof(size_hints));
ui::GetWmNormalHints(xwindow_, &size_hints);
size_hints.flags |= ui::SIZE_HINT_P_POSITION;
size_hints.x = bounds_.x();
size_hints.y = bounds_.y();
// Set StaticGravity so that the window position is not affected by the
// frame width when running with window manager.
size_hints.win_gravity = StaticGravity;
XSetWMNormalHints(xdisplay_, xwindow_, &size_hints);
ui::SetWmNormalHints(xwindow_, size_hints);
XMapWindow(xdisplay_, xwindow_);
connection_->MapWindow({xwindow_});
// TODO(thomasanderson): Find out why this flush is necessary.
XFlush(xdisplay_);
connection_->Flush();
window_mapped_ = true;
// Setup the drag and drop proxy on the top level window of the application
// to be the child of this window.
::Window child = FindChild(xdisplay_, xwindow_);
::Window toplevel_window = FindToplevelParent(xdisplay_, xwindow_);
DCHECK(toplevel_window);
if (child && toplevel_window) {
auto child = FindChild(xwindow_);
auto toplevel_window = FindToplevelParent(xwindow_);
DCHECK_NE(toplevel_window, x11::Window::None);
if (child != x11::Window::None && toplevel_window != x11::Window::None) {
// Configure the drag&drop proxy property for the top-most window so
// that all drag&drop-related messages will be sent to the child
// DesktopWindowTreeHostLinux. The proxy property is referenced by
// DesktopDragDropClientAuraX11::FindWindowFor.
x11::Window window = x11::Window::None;
ui::GetProperty(ToX11Window(toplevel_window), gfx::GetAtom(kXdndProxy),
&window);
::Window proxy_target = ToWindow(window);
auto dndproxy_atom = gfx::GetAtom(kXdndProxy);
ui::GetProperty(toplevel_window, dndproxy_atom, &window);
if (proxy_target != child) {
if (window != child) {
// Set the proxy target for the top-most window.
XChangeProperty(xdisplay_, toplevel_window, GetAtom(kXdndProxy),
XA_WINDOW, 32, PropModeReplace,
reinterpret_cast<unsigned char*>(&child), 1);
ui::SetProperty(toplevel_window, dndproxy_atom, x11::Atom::WINDOW,
child);
// Do the same for the proxy target per the spec.
XChangeProperty(xdisplay_, child, GetAtom(kXdndProxy), XA_WINDOW, 32,
PropModeReplace,
reinterpret_cast<unsigned char*>(&child), 1);
ui::SetProperty(child, dndproxy_atom, x11::Atom::WINDOW, child);
}
}
}
}
void CefWindowX11::Hide() {
if (xwindow_ == x11::None)
if (xwindow_ == x11::Window::None)
return;
if (window_mapped_) {
XWithdrawWindow(xdisplay_, xwindow_, 0);
ui::WithdrawWindow(xwindow_);
window_mapped_ = false;
}
}
void CefWindowX11::Focus() {
if (xwindow_ == x11::None || !window_mapped_)
if (xwindow_ == x11::Window::None || !window_mapped_)
return;
x11::Window focus_target = xwindow_;
if (browser_.get()) {
::Window child = FindChild(xdisplay_, xwindow_);
if (child && ui::IsWindowVisible(ToX11Window(child))) {
auto child = FindChild(xwindow_);
if (child != x11::Window::None && ui::IsWindowVisible(child)) {
// Give focus to the child DesktopWindowTreeHostLinux.
XSetInputFocus(xdisplay_, child, RevertToParent, x11::CurrentTime);
focus_target = child;
}
} else {
XSetInputFocus(xdisplay_, xwindow_, RevertToParent, x11::CurrentTime);
}
// Directly ask the X server to give focus to the window. Note that the call
// would have raised an X error if the window is not mapped.
connection_
->SetInputFocus(
{x11::InputFocus::Parent, focus_target, x11::Time::CurrentTime})
.IgnoreError();
}
void CefWindowX11::SetBounds(const gfx::Rect& bounds) {
if (xwindow_ == x11::None)
if (xwindow_ == x11::Window::None)
return;
x11::ConfigureWindowRequest req{.window = xwindow_};
bool origin_changed = bounds_.origin() != bounds.origin();
bool size_changed = bounds_.size() != bounds.size();
XWindowChanges changes = {0};
unsigned value_mask = 0;
if (size_changed) {
changes.width = bounds.width();
changes.height = bounds.height();
value_mask = CWHeight | CWWidth;
req.width = bounds.width();
req.height = bounds.height();
}
if (origin_changed) {
changes.x = bounds.x();
changes.y = bounds.y();
value_mask |= CWX | CWY;
req.x = bounds.x();
req.y = bounds.y();
}
if (value_mask)
XConfigureWindow(xdisplay_, xwindow_, value_mask, &changes);
if (origin_changed || size_changed) {
connection_->ConfigureWindow(req);
}
}
gfx::Rect CefWindowX11::GetBoundsInScreen() {
int x, y;
Window child;
if (XTranslateCoordinates(xdisplay_, xwindow_, DefaultRootWindow(xdisplay_),
0, 0, &x, &y, &child)) {
return gfx::Rect(gfx::Point(x, y), bounds_.size());
if (auto coords =
connection_
->TranslateCoordinates({xwindow_, ui::GetX11RootWindow(), 0, 0})
.Sync()) {
return gfx::Rect(gfx::Point(coords->dst_x, coords->dst_y), bounds_.size());
}
return gfx::Rect();
}
views::DesktopWindowTreeHostLinux* CefWindowX11::GetHost() {
if (browser_.get()) {
::Window child = FindChild(xdisplay_, xwindow_);
if (child) {
auto child = FindChild(xwindow_);
if (child != x11::Window::None) {
return static_cast<views::DesktopWindowTreeHostLinux*>(
views::DesktopWindowTreeHostLinux::GetHostForWidget(
static_cast<gfx::AcceleratedWidget>(child)));
@ -304,12 +286,12 @@ views::DesktopWindowTreeHostLinux* CefWindowX11::GetHost() {
}
bool CefWindowX11::CanDispatchEvent(const ui::PlatformEvent& event) {
DCHECK_NE(xwindow_, x11::None);
DCHECK_NE(xwindow_, x11::Window::None);
return !!current_xevent_;
}
uint32_t CefWindowX11::DispatchEvent(const ui::PlatformEvent& event) {
DCHECK_NE(xwindow_, x11::None);
DCHECK_NE(xwindow_, x11::Window::None);
DCHECK(event);
DCHECK(current_xevent_);
@ -347,44 +329,27 @@ void CefWindowX11::ContinueFocus() {
}
bool CefWindowX11::TopLevelAlwaysOnTop() const {
::Window toplevel_window = FindToplevelParent(xdisplay_, xwindow_);
auto toplevel_window = FindToplevelParent(xwindow_);
if (toplevel_window == x11::Window::None)
return false;
Atom state_atom = GetAtom("_NET_WM_STATE");
Atom state_keep_above = GetAtom("_NET_WM_STATE_KEEP_ABOVE");
Atom* states;
Atom actual_type;
int actual_format;
unsigned long num_items;
unsigned long bytes_after;
XGetWindowProperty(xdisplay_, toplevel_window, state_atom, 0, 1024,
x11::False, XA_ATOM, &actual_type, &actual_format,
&num_items, &bytes_after,
reinterpret_cast<unsigned char**>(&states));
bool always_on_top = false;
for (unsigned long i = 0; i < num_items; ++i) {
if (states[i] == state_keep_above) {
always_on_top = true;
break;
}
std::vector<x11::Atom> wm_states;
if (ui::GetAtomArrayProperty(toplevel_window, kNetWMState, &wm_states)) {
x11::Atom keep_above_atom = gfx::GetAtom(kNetWMStateKeepAbove);
if (base::Contains(wm_states, keep_above_atom))
return true;
}
XFree(states);
return always_on_top;
return false;
}
bool CefWindowX11::IsTargetedBy(const x11::Event& x11_event) const {
return ToWindow(x11_event.window()) == xwindow_;
return x11_event.window() == xwindow_;
}
void CefWindowX11::ProcessXEvent(x11::Event* event) {
if (auto* configure = event->As<x11::ConfigureNotifyEvent>()) {
DCHECK_EQ(xwindow_, ToWindow(configure->event));
DCHECK_EQ(xwindow_, ToWindow(configure->window));
DCHECK_EQ(xwindow_, configure->event);
DCHECK_EQ(xwindow_, configure->window);
// It's possible that the X window may be resized by some other means
// than from within Aura (e.g. the X window manager can change the
// size). Make sure the root window size is maintained properly.
@ -392,13 +357,15 @@ void CefWindowX11::ProcessXEvent(x11::Event* event) {
configure->height);
if (browser_.get()) {
::Window child = FindChild(xdisplay_, xwindow_);
if (child) {
auto child = FindChild(xwindow_);
if (child != x11::Window::None) {
// Resize the child DesktopWindowTreeHostLinux to match this window.
XWindowChanges changes = {0};
changes.width = bounds_.width();
changes.height = bounds_.height();
XConfigureWindow(xdisplay_, child, CWHeight | CWWidth, &changes);
x11::ConfigureWindowRequest req{
.window = child,
.width = bounds_.width(),
.height = bounds_.height(),
};
connection_->ConfigureWindow(req);
browser_->NotifyMoveOrResizeStarted();
}
@ -410,9 +377,8 @@ void CefWindowX11::ProcessXEvent(x11::Event* event) {
// We have received a close message from the window manager.
if (!browser_ || browser_->TryCloseBrowser()) {
// Allow the close.
XDestroyWindow(xdisplay_, xwindow_);
xwindow_ = x11::None;
connection_->DestroyWindow({xwindow_});
xwindow_ = x11::Window::None;
if (browser_) {
// Force the browser to be destroyed and release the reference
@ -425,10 +391,10 @@ void CefWindowX11::ProcessXEvent(x11::Event* event) {
}
} else if (protocol == gfx::GetAtom(kNetWMPing)) {
x11::ClientMessageEvent reply_event = *client;
reply_event.window = ToX11Window(parent_xwindow_);
ui::SendEvent(reply_event, reply_event.window,
x11::EventMask::SubstructureNotify |
x11::EventMask::SubstructureRedirect);
reply_event.window = parent_xwindow_;
x11::SendEvent(reply_event, reply_event.window,
x11::EventMask::SubstructureNotify |
x11::EventMask::SubstructureRedirect);
}
}
} else if (auto* focus = event->As<x11::FocusEvent>()) {
@ -456,27 +422,14 @@ void CefWindowX11::ProcessXEvent(x11::Event* event) {
if (property->atom == gfx::GetAtom(kNetWMState)) {
// State change event like minimize/maximize.
if (browser_.get()) {
::Window child = FindChild(xdisplay_, xwindow_);
if (child) {
auto child = FindChild(xwindow_);
if (child != x11::Window::None) {
// Forward the state change to the child DesktopWindowTreeHostLinux
// window so that resource usage will be reduced while the window is
// minimized.
// minimized. |atom_list| may be empty.
std::vector<x11::Atom> atom_list;
if (ui::GetAtomArrayProperty(ToX11Window(xwindow_), kNetWMState,
&atom_list) &&
!atom_list.empty()) {
ui::SetAtomArrayProperty(ToX11Window(child), kNetWMState, "ATOM",
atom_list);
} else {
// Set an empty list of property values to pass the check in
// DesktopWindowTreeHostLinux::OnWMStateUpdated().
XChangeProperty(xdisplay_, child,
GetAtom(kNetWMState), // name
GetAtom(kAtom), // type
32, // size in bits of items in 'value'
PropModeReplace, NULL,
0); // num items
}
ui::GetAtomArrayProperty(xwindow_, kNetWMState, &atom_list);
ui::SetAtomArrayProperty(child, kNetWMState, kAtom, atom_list);
}
}
}

View File

@ -7,10 +7,7 @@
#define CEF_LIBCEF_BROWSER_NATIVE_WINDOW_X11_H_
#pragma once
// Avoid including <X11/Xlib.h>
typedef unsigned long Window;
struct _XDisplay;
typedef struct _XDisplay Display;
#include <memory>
#include "include/internal/cef_ptr.h"
@ -19,6 +16,11 @@ typedef struct _XDisplay Display;
#include "ui/events/platform/x11/x11_event_source.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/x/x11_atom_cache.h"
#include "ui/gfx/x/x11_types.h"
namespace ui {
class XScopedEventSelector;
}
namespace views {
class DesktopWindowTreeHostLinux;
@ -32,7 +34,7 @@ class CefWindowX11 : public ui::PlatformEventDispatcher,
public ui::XEventDispatcher {
public:
CefWindowX11(CefRefPtr<CefBrowserHostBase> browser,
::Window parent_xwindow,
x11::Window parent_xwindow,
const gfx::Rect& bounds,
const std::string& title);
~CefWindowX11() override;
@ -60,7 +62,7 @@ class CefWindowX11 : public ui::PlatformEventDispatcher,
ui::PlatformEventDispatcher* GetPlatformEventDispatcher() override;
bool DispatchXEvent(x11::Event* x11_event) override;
::Window xwindow() const { return xwindow_; }
x11::Window xwindow() const { return xwindow_; }
gfx::Rect bounds() const { return bounds_; }
bool TopLevelAlwaysOnTop() const;
@ -74,17 +76,20 @@ class CefWindowX11 : public ui::PlatformEventDispatcher,
CefRefPtr<CefBrowserHostBase> browser_;
// The display and the native X window hosting the root window.
::Display* xdisplay_;
::Window parent_xwindow_;
::Window xwindow_;
x11::Connection* const connection_;
x11::Window parent_xwindow_;
x11::Window xwindow_;
// Events selected on |xwindow_|.
std::unique_ptr<ui::XScopedEventSelector> xwindow_events_;
// Is the window mapped to the screen?
bool window_mapped_;
bool window_mapped_ = false;
// The bounds of |xwindow_|.
gfx::Rect bounds_;
bool focus_pending_;
bool focus_pending_ = false;
// Tells if this dispatcher can process next translated event based on a
// previous check in ::CheckCanDispatchNextPlatformEvent based on a XID

View File

@ -34,7 +34,7 @@
#include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h"
#include "chrome/browser/ui/webui/theme_source.h"
#include "chrome/common/url_constants.h"
#include "content/browser/frame_host/debug_urls.h"
#include "content/browser/renderer_host/debug_urls.h"
#include "content/browser/webui/content_web_ui_controller_factory.h"
#include "content/public/browser/browser_url_handler.h"
#include "content/public/browser/content_browser_client.h"

View File

@ -42,16 +42,6 @@ base::Optional<std::string> GetHeaderString(
return header_value;
}
bool IsOutOfBlinkCorsEnabled() {
static int state = -1;
if (state == -1) {
state = base::FeatureList::IsEnabled(network::features::kOutOfBlinkCors)
? 1
: 0;
}
return !!state;
}
void CreateProxyHelper(
content::WebContents::Getter web_contents_getter,
mojo::PendingReceiver<network::mojom::URLLoaderFactory> loader_receiver,
@ -439,7 +429,7 @@ void InterceptedRequest::Restart() {
current_request_uses_header_client_ =
!!factory_->url_loader_header_client_receiver_;
if (IsOutOfBlinkCorsEnabled() && request_.request_initiator &&
if (request_.request_initiator &&
network::cors::ShouldCheckCors(request_.url, request_.request_initiator,
request_.mode)) {
if (scheme::IsCorsEnabledScheme(request_.url.scheme())) {
@ -1010,8 +1000,7 @@ void InterceptedRequest::ContinueToResponseStarted(int error_code) {
// CORS check for requests that are handled by the client. Requests handled
// by the network process will be checked there.
if (IsOutOfBlinkCorsEnabled() && stream_loader_ && !is_redirect &&
request_.request_initiator &&
if (stream_loader_ && !is_redirect && request_.request_initiator &&
network::cors::ShouldCheckCors(request_.url, request_.request_initiator,
request_.mode)) {
const auto error_status = network::cors::CheckAccess(

View File

@ -10,7 +10,7 @@
#include "base/threading/thread_task_runner_handle.h"
#include "content/browser/devtools/devtools_instrumentation.h"
#include "content/browser/frame_host/render_frame_host_impl.h"
#include "content/browser/renderer_host/render_frame_host_impl.h"
#include "content/public/browser/browser_context.h"
#include "content/public/browser/storage_partition.h"
#include "content/public/common/content_client.h"
@ -65,7 +65,7 @@ scoped_refptr<URLLoaderFactoryGetter> URLLoaderFactoryGetter::Create(
should_proxy |= browser_client->WillCreateURLLoaderFactory(
browser_context, render_frame_host, render_process_id,
content::ContentBrowserClient::URLLoaderFactoryType::kDocumentSubResource,
url::Origin(), base::nullopt /* navigation_id */,
url::Origin(), base::nullopt /* navigation_id */, base::UkmSourceId(),
&maybe_proxy_factory_request, nullptr /* header_client */,
nullptr /* bypass_redirect_checks */, nullptr /* disable_secure_dns */,
nullptr /* factory_override */);

View File

@ -312,8 +312,8 @@ void CefBrowserPlatformDelegateOsr::DragTargetDragEnter(
base::AutoLock lock_scope(data_impl->lock());
content::DropData* drop_data = data_impl->drop_data();
const gfx::Point& screen_pt = GetScreenPoint(client_pt);
blink::WebDragOperationsMask ops =
static_cast<blink::WebDragOperationsMask>(allowed_ops);
blink::DragOperationsMask ops =
static_cast<blink::DragOperationsMask>(allowed_ops);
int modifiers = TranslateWebEventModifiers(event.modifiers);
current_rwh_for_drag_->FilterDropData(drop_data);
@ -376,8 +376,8 @@ void CefBrowserPlatformDelegateOsr::DragTargetDragOver(
if (!drag_data_)
return;
blink::WebDragOperationsMask ops =
static_cast<blink::WebDragOperationsMask>(allowed_ops);
blink::DragOperationsMask ops =
static_cast<blink::DragOperationsMask>(allowed_ops);
int modifiers = TranslateWebEventModifiers(event.modifiers);
target_rwh->DragTargetDragOver(transformed_pt, gfx::PointF(screen_pt), ops,
@ -459,10 +459,10 @@ void CefBrowserPlatformDelegateOsr::DragTargetDrop(const CefMouseEvent& event) {
void CefBrowserPlatformDelegateOsr::StartDragging(
const content::DropData& drop_data,
blink::WebDragOperationsMask allowed_ops,
blink::DragOperationsMask allowed_ops,
const gfx::ImageSkia& image,
const gfx::Vector2d& image_offset,
const content::DragEventSourceInfo& event_info,
const blink::mojom::DragEventSourceInfo& event_info,
content::RenderWidgetHostImpl* source_rwh) {
drag_start_rwh_ = source_rwh->GetWeakPtr();
@ -480,7 +480,7 @@ void CefBrowserPlatformDelegateOsr::StartDragging(
handled = handler->StartDragging(
browser_, drag_data.get(),
static_cast<CefRenderHandler::DragOperationsMask>(allowed_ops),
event_info.event_location.x(), event_info.event_location.y());
event_info.location.x(), event_info.location.y());
}
if (!handled)
@ -488,7 +488,7 @@ void CefBrowserPlatformDelegateOsr::StartDragging(
}
void CefBrowserPlatformDelegateOsr::UpdateDragCursor(
blink::WebDragOperation operation) {
blink::DragOperation operation) {
CefRefPtr<CefRenderHandler> handler =
browser_->GetClient()->GetRenderHandler();
if (handler.get()) {
@ -512,7 +512,7 @@ void CefBrowserPlatformDelegateOsr::DragSourceEndedAt(
content::RenderWidgetHostImpl* source_rwh = drag_start_rwh_.get();
const gfx::Point client_loc(gfx::Point(x, y));
const gfx::Point& screen_loc = GetScreenPoint(client_loc);
blink::WebDragOperation drag_op = static_cast<blink::WebDragOperation>(op);
blink::DragOperation drag_op = static_cast<blink::DragOperation>(op);
// |client_loc| and |screen_loc| are in the root coordinate space, for
// non-root RenderWidgetHosts they need to be transformed.

View File

@ -76,12 +76,12 @@ class CefBrowserPlatformDelegateOsr
void DragTargetDragLeave() override;
void DragTargetDrop(const CefMouseEvent& event) override;
void StartDragging(const content::DropData& drop_data,
blink::WebDragOperationsMask allowed_ops,
blink::DragOperationsMask allowed_ops,
const gfx::ImageSkia& image,
const gfx::Vector2d& image_offset,
const content::DragEventSourceInfo& event_info,
const blink::mojom::DragEventSourceInfo& event_info,
content::RenderWidgetHostImpl* source_rwh) override;
void UpdateDragCursor(blink::WebDragOperation operation) override;
void UpdateDragCursor(blink::DragOperation operation) override;
void DragSourceEndedAt(int x, int y, cef_drag_operations_mask_t op) override;
void DragSourceSystemDragEnded() override;
void AccessibilityEventReceived(

View File

@ -54,11 +54,6 @@
#include "ui/gfx/geometry/dip_util.h"
#include "ui/gfx/geometry/size_conversions.h"
#if defined(USE_X11)
#include "ui/base/x/x11_cursor_loader.h"
#include "ui/base/x/x11_util.h"
#endif
namespace {
// The maximum number of damage rects to cache for outstanding frame requests
@ -193,18 +188,6 @@ ui::ImeTextSpan::UnderlineStyle GetImeUnderlineStyle(
return ui::ImeTextSpan::UnderlineStyle::kSolid;
}
#if defined(USE_AURA)
CefCursorHandle ToCursorHandle(ui::PlatformCursor cursor) {
#if defined(USE_X11)
// See https://crbug.com/1029142 for background.
return static_cast<CefCursorHandle>(
static_cast<ui::X11Cursor*>(cursor)->xcursor());
#else
return cursor;
#endif
}
#endif // defined(USE_AURA)
} // namespace
CefRenderWidgetHostViewOSR::CefRenderWidgetHostViewOSR(
@ -378,25 +361,30 @@ void CefRenderWidgetHostViewOSR::Show() {
is_showing_ = true;
// If the viz::LocalSurfaceIdAllocation is invalid, we may have been evicted,
// If the viz::LocalSurfaceId is invalid, we may have been evicted,
// and no other visual properties have since been changed. Allocate a new id
// and start synchronizing.
if (!GetLocalSurfaceIdAllocation().IsValid()) {
if (!GetLocalSurfaceId().is_valid()) {
AllocateLocalSurfaceId();
SynchronizeVisualProperties(cc::DeadlinePolicy::UseDefaultDeadline(),
GetLocalSurfaceIdAllocation());
GetLocalSurfaceId());
}
if (render_widget_host_) {
render_widget_host_->WasShown(
base::nullopt /* record_tab_switch_time_request */);
/*record_tab_switch_time_request=*/{});
// Call OnRenderFrameMetadataChangedAfterActivation for every frame.
auto provider = content::RenderWidgetHostImpl::From(render_widget_host_)
->render_frame_metadata_provider();
provider->AddObserver(this);
provider->ReportAllFrameSubmissionsForTesting(true);
}
if (delegated_frame_host_) {
delegated_frame_host_->AttachToCompositor(compositor_.get());
delegated_frame_host_->WasShown(
GetLocalSurfaceIdAllocation().local_surface_id(),
GetViewBounds().size(), base::nullopt);
delegated_frame_host_->WasShown(GetLocalSurfaceId(), GetViewBounds().size(),
/*record_tab_switch_time_request=*/{});
}
if (!content::GpuDataManagerImpl::GetInstance()->IsGpuCompositingDisabled()) {
@ -408,14 +396,6 @@ void CefRenderWidgetHostViewOSR::Show() {
video_consumer_->SetActive(true);
}
}
if (render_widget_host_) {
// Call OnRenderFrameMetadataChangedAfterActivation for every frame.
content::RenderFrameMetadataProviderImpl* provider =
content::RenderWidgetHostImpl::From(render_widget_host_)
->render_frame_metadata_provider();
provider->ReportAllFrameSubmissionsForTesting(true);
}
}
void CefRenderWidgetHostViewOSR::Hide() {
@ -431,9 +411,14 @@ void CefRenderWidgetHostViewOSR::Hide() {
video_consumer_->SetActive(false);
}
if (render_widget_host_)
if (render_widget_host_) {
render_widget_host_->WasHidden();
auto provider = content::RenderWidgetHostImpl::From(render_widget_host_)
->render_frame_metadata_provider();
provider->RemoveObserver(this);
}
if (delegated_frame_host_) {
delegated_frame_host_->WasHidden(
content::DelegatedFrameHost::HiddenCause::kOther);
@ -509,11 +494,10 @@ void CefRenderWidgetHostViewOSR::OnDidUpdateVisualPropertiesComplete(
// viz::LocalSurfaceId. However we do not want to embed surfaces while
// hidden. Nor do we want to embed invalid ids when we are evicted. Becoming
// visible will generate a new id, if necessary, and begin embedding.
UpdateLocalSurfaceIdFromEmbeddedClient(
metadata.local_surface_id_allocation);
UpdateLocalSurfaceIdFromEmbeddedClient(metadata.local_surface_id);
} else {
SynchronizeVisualProperties(cc::DeadlinePolicy::UseDefaultDeadline(),
metadata.local_surface_id_allocation);
metadata.local_surface_id);
}
}
@ -525,28 +509,27 @@ void CefRenderWidgetHostViewOSR::AllocateLocalSurfaceId() {
parent_local_surface_id_allocator_->GenerateId();
}
const viz::LocalSurfaceIdAllocation&
CefRenderWidgetHostViewOSR::GetCurrentLocalSurfaceIdAllocation() const {
return parent_local_surface_id_allocator_
->GetCurrentLocalSurfaceIdAllocation();
const viz::LocalSurfaceId&
CefRenderWidgetHostViewOSR::GetCurrentLocalSurfaceId() const {
return parent_local_surface_id_allocator_->GetCurrentLocalSurfaceId();
}
void CefRenderWidgetHostViewOSR::UpdateLocalSurfaceIdFromEmbeddedClient(
const base::Optional<viz::LocalSurfaceIdAllocation>&
embedded_client_local_surface_id_allocation) {
if (embedded_client_local_surface_id_allocation) {
const base::Optional<viz::LocalSurfaceId>&
embedded_client_local_surface_id) {
if (embedded_client_local_surface_id) {
parent_local_surface_id_allocator_->UpdateFromChild(
*embedded_client_local_surface_id_allocation);
*embedded_client_local_surface_id);
} else {
AllocateLocalSurfaceId();
}
}
const viz::LocalSurfaceIdAllocation&
CefRenderWidgetHostViewOSR::GetOrCreateLocalSurfaceIdAllocation() {
const viz::LocalSurfaceId&
CefRenderWidgetHostViewOSR::GetOrCreateLocalSurfaceId() {
if (!parent_local_surface_id_allocator_)
AllocateLocalSurfaceId();
return GetCurrentLocalSurfaceIdAllocation();
return GetCurrentLocalSurfaceId();
}
void CefRenderWidgetHostViewOSR::InvalidateLocalSurfaceId() {
@ -909,10 +892,10 @@ void CefRenderWidgetHostViewOSR::SelectionChanged(const base::string16& text,
cef_range);
}
const viz::LocalSurfaceIdAllocation&
CefRenderWidgetHostViewOSR::GetLocalSurfaceIdAllocation() const {
const viz::LocalSurfaceId& CefRenderWidgetHostViewOSR::GetLocalSurfaceId()
const {
return const_cast<CefRenderWidgetHostViewOSR*>(this)
->GetOrCreateLocalSurfaceIdAllocation();
->GetOrCreateLocalSurfaceId();
}
const viz::FrameSinkId& CefRenderWidgetHostViewOSR::GetFrameSinkId() const {
@ -925,38 +908,6 @@ viz::FrameSinkId CefRenderWidgetHostViewOSR::GetRootFrameSinkId() {
return compositor_ ? compositor_->frame_sink_id() : viz::FrameSinkId();
}
void CefRenderWidgetHostViewOSR::OnRenderFrameMetadataChangedAfterActivation() {
auto metadata =
host_->render_frame_metadata_provider()->LastRenderFrameMetadata();
if (video_consumer_) {
// Need to wait for the first frame of the new size before calling
// SizeChanged. Otherwise, the video frame will be letterboxed.
video_consumer_->SizeChanged(metadata.viewport_size_in_pixels);
}
gfx::Vector2dF root_scroll_offset;
if (metadata.root_scroll_offset) {
root_scroll_offset = *metadata.root_scroll_offset;
}
if (root_scroll_offset != last_scroll_offset_) {
last_scroll_offset_ = root_scroll_offset;
if (!is_scroll_offset_changed_pending_) {
is_scroll_offset_changed_pending_ = true;
// Send the notification asynchronously.
CEF_POST_TASK(
CEF_UIT,
base::Bind(&CefRenderWidgetHostViewOSR::OnScrollOffsetChanged,
weak_ptr_factory_.GetWeakPtr()));
}
}
content::RenderWidgetHostViewBase::
OnRenderFrameMetadataChangedAfterActivation();
}
std::unique_ptr<content::SyntheticGestureTarget>
CefRenderWidgetHostViewOSR::CreateSyntheticGestureTarget() {
return std::make_unique<CefSyntheticGestureTargetOSR>(host());
@ -986,7 +937,7 @@ void CefRenderWidgetHostViewOSR::DidNavigate() {
// The first navigation does not need a new LocalSurfaceID. The renderer
// can use the ID that was already provided.
SynchronizeVisualProperties(cc::DeadlinePolicy::UseExistingDeadline(),
GetLocalSurfaceIdAllocation());
GetLocalSurfaceId());
} else {
SynchronizeVisualProperties(cc::DeadlinePolicy::UseExistingDeadline(),
base::nullopt);
@ -1002,6 +953,35 @@ void CefRenderWidgetHostViewOSR::OnFrameComplete(
// TODO(cef): is there something we need to track with this notification?
}
void CefRenderWidgetHostViewOSR::OnRenderFrameMetadataChangedAfterActivation() {
auto metadata =
host_->render_frame_metadata_provider()->LastRenderFrameMetadata();
if (video_consumer_) {
// Need to wait for the first frame of the new size before calling
// SizeChanged. Otherwise, the video frame will be letterboxed.
video_consumer_->SizeChanged(metadata.viewport_size_in_pixels);
}
gfx::Vector2dF root_scroll_offset;
if (metadata.root_scroll_offset) {
root_scroll_offset = *metadata.root_scroll_offset;
}
if (root_scroll_offset != last_scroll_offset_) {
last_scroll_offset_ = root_scroll_offset;
if (!is_scroll_offset_changed_pending_) {
is_scroll_offset_changed_pending_ = true;
// Send the notification asynchronously.
CEF_POST_TASK(
CEF_UIT,
base::Bind(&CefRenderWidgetHostViewOSR::OnScrollOffsetChanged,
weak_ptr_factory_.GetWeakPtr()));
}
}
}
std::unique_ptr<viz::HostDisplayClient>
CefRenderWidgetHostViewOSR::CreateHostDisplayClient() {
host_display_client_ =
@ -1035,31 +1015,29 @@ void CefRenderWidgetHostViewOSR::WasResized() {
void CefRenderWidgetHostViewOSR::SynchronizeVisualProperties(
const cc::DeadlinePolicy& deadline_policy,
const base::Optional<viz::LocalSurfaceIdAllocation>&
child_local_surface_id_allocation) {
const base::Optional<viz::LocalSurfaceId>& child_local_surface_id) {
SetFrameRate();
const bool resized = ResizeRootLayer();
bool surface_id_updated = false;
if (!resized && child_local_surface_id_allocation) {
if (!resized && child_local_surface_id) {
// Update the current surface ID.
parent_local_surface_id_allocator_->UpdateFromChild(
*child_local_surface_id_allocation);
*child_local_surface_id);
surface_id_updated = true;
}
// Allocate a new surface ID if the surface has been resized or if the current
// ID is invalid (meaning we may have been evicted).
if (resized || !GetCurrentLocalSurfaceIdAllocation().IsValid()) {
if (resized || !GetCurrentLocalSurfaceId().is_valid()) {
AllocateLocalSurfaceId();
surface_id_updated = true;
}
if (surface_id_updated) {
delegated_frame_host_->EmbedSurface(
GetCurrentLocalSurfaceIdAllocation().local_surface_id(),
GetViewBounds().size(), deadline_policy);
GetCurrentLocalSurfaceId(), GetViewBounds().size(), deadline_policy);
// |render_widget_host_| will retrieve resize parameters from the
// DelegatedFrameHost and this view, so SynchronizeVisualProperties must be
@ -1595,9 +1573,9 @@ bool CefRenderWidgetHostViewOSR::SetRootLayerSize(bool force) {
if (compositor_) {
compositor_local_surface_id_allocator_.GenerateId();
compositor_->SetScaleAndSize(current_device_scale_factor_, SizeInPixels(),
compositor_local_surface_id_allocator_
.GetCurrentLocalSurfaceIdAllocation());
compositor_->SetScaleAndSize(
current_device_scale_factor_, SizeInPixels(),
compositor_local_surface_id_allocator_.GetCurrentLocalSurfaceId());
}
return (scale_factor_changed || view_bounds_changed);

View File

@ -27,6 +27,7 @@
#include "content/browser/renderer_host/input/mouse_wheel_phase_handler.h"
#include "content/browser/renderer_host/render_widget_host_view_base.h"
#include "content/browser/renderer_host/text_input_manager.h"
#include "content/public/browser/render_frame_metadata_provider.h"
#include "content/public/common/widget_type.h"
#include "ui/base/cursor/mojom/cursor_type.mojom-shared.h"
#include "ui/compositor/compositor.h"
@ -64,10 +65,6 @@ class CefVideoConsumerOSR;
class CefWebContentsViewOSR;
#if defined(USE_X11)
namespace ui {
class X11Cursor;
class XCursorLoader;
} // namespace ui
class CefWindowX11;
#endif
@ -93,10 +90,12 @@ class CefWindowX11;
class MacHelper;
#endif
class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
public ui::CompositorDelegate,
public content::TextInputManager::Observer,
public ui::GestureProviderClient {
class CefRenderWidgetHostViewOSR
: public content::RenderWidgetHostViewBase,
public content::RenderFrameMetadataProvider::Observer,
public ui::CompositorDelegate,
public content::TextInputManager::Observer,
public ui::GestureProviderClient {
public:
CefRenderWidgetHostViewOSR(SkColor background_color,
bool use_shared_texture,
@ -180,14 +179,20 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
void SelectionChanged(const base::string16& text,
size_t offset,
const gfx::Range& range) override;
const viz::LocalSurfaceIdAllocation& GetLocalSurfaceIdAllocation()
const override;
const viz::LocalSurfaceId& GetLocalSurfaceId() const override;
const viz::FrameSinkId& GetFrameSinkId() const override;
viz::FrameSinkId GetRootFrameSinkId() override;
void OnRenderFrameMetadataChangedAfterActivation() override;
void OnFrameComplete(const viz::BeginFrameAck& ack);
// RenderFrameMetadataProvider::Observer implementation.
void OnRenderFrameMetadataChangedBeforeActivation(
const cc::RenderFrameMetadata& metadata) override {}
void OnRenderFrameMetadataChangedAfterActivation() override;
void OnRenderFrameSubmission() override {}
void OnLocalSurfaceIdChanged(
const cc::RenderFrameMetadata& metadata) override {}
// ui::CompositorDelegate implementation.
std::unique_ptr<viz::HostDisplayClient> CreateHostDisplayClient() override;
@ -208,8 +213,7 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
void WasResized();
void SynchronizeVisualProperties(
const cc::DeadlinePolicy& deadline_policy,
const base::Optional<viz::LocalSurfaceIdAllocation>&
child_local_surface_id_allocation);
const base::Optional<viz::LocalSurfaceId>& child_local_surface_id);
void OnScreenInfoChanged();
void Invalidate(CefBrowserHost::PaintElementType type);
void SendExternalBeginFrame();
@ -303,18 +307,16 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
// CompositorFrame submission in anticipation of a synchronization operation
// that does not involve a resize or a device scale factor change.
void AllocateLocalSurfaceId();
const viz::LocalSurfaceIdAllocation& GetCurrentLocalSurfaceIdAllocation()
const;
const viz::LocalSurfaceId& GetCurrentLocalSurfaceId() const;
// Sets the current viz::LocalSurfaceId, in cases where the embedded client
// has allocated one. Also sets child sequence number component of the
// viz::LocalSurfaceId allocator.
void UpdateLocalSurfaceIdFromEmbeddedClient(
const base::Optional<viz::LocalSurfaceIdAllocation>&
local_surface_id_allocation);
const base::Optional<viz::LocalSurfaceId>& local_surface_id);
// Returns the current viz::LocalSurfaceIdAllocation.
const viz::LocalSurfaceIdAllocation& GetOrCreateLocalSurfaceIdAllocation();
const viz::LocalSurfaceId& GetOrCreateLocalSurfaceId();
// Marks the current viz::LocalSurfaceId as invalid. AllocateLocalSurfaceId
// must be called before submitting new CompositorFrames.
@ -328,6 +330,7 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
#if defined(USE_AURA)
CefCursorHandle GetPlatformCursor(ui::mojom::CursorType type);
CefCursorHandle ToCursorHandle(ui::PlatformCursor cursor);
#endif
// The background color of the web content.
@ -346,11 +349,6 @@ class CefRenderWidgetHostViewOSR : public content::RenderWidgetHostViewBase,
parent_local_surface_id_allocator_;
viz::ParentLocalSurfaceIdAllocator compositor_local_surface_id_allocator_;
#if defined(USE_X11)
std::unique_ptr<ui::XCursorLoader> cursor_loader_;
scoped_refptr<ui::X11Cursor> invisible_cursor_;
#endif
std::unique_ptr<content::CursorManager> cursor_manager_;
// Provides |source_id| for BeginFrameArgs that we create.

View File

@ -5,202 +5,28 @@
#include "libcef/browser/osr/render_widget_host_view_osr.h"
#if defined(USE_X11)
#include <X11/Xlib.h>
#include <X11/cursorfont.h>
#include "libcef/browser/native/window_x11.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "ui/base/x/x11_cursor_loader.h"
#include "ui/base/x/x11_util.h"
#include "ui/gfx/x/x11_types.h"
#endif // defined(USE_X11)
#include "ui/base/cursor/cursor_factory.h"
#if defined(USE_X11)
namespace {
// Based on ui/base/cursor/cursor_loader_x11.cc.
int ToCursorID(ui::mojom::CursorType type) {
switch (type) {
case ui::mojom::CursorType::kPointer:
return XC_left_ptr;
case ui::mojom::CursorType::kCross:
return XC_crosshair;
case ui::mojom::CursorType::kHand:
return XC_hand2;
case ui::mojom::CursorType::kIBeam:
return XC_xterm;
case ui::mojom::CursorType::kWait:
return XC_watch;
case ui::mojom::CursorType::kHelp:
return XC_question_arrow;
case ui::mojom::CursorType::kEastResize:
return XC_right_side;
case ui::mojom::CursorType::kNorthResize:
return XC_top_side;
case ui::mojom::CursorType::kNorthEastResize:
return XC_top_right_corner;
case ui::mojom::CursorType::kNorthWestResize:
return XC_top_left_corner;
case ui::mojom::CursorType::kSouthResize:
return XC_bottom_side;
case ui::mojom::CursorType::kSouthEastResize:
return XC_bottom_right_corner;
case ui::mojom::CursorType::kSouthWestResize:
return XC_bottom_left_corner;
case ui::mojom::CursorType::kWestResize:
return XC_left_side;
case ui::mojom::CursorType::kNorthSouthResize:
return XC_sb_v_double_arrow;
case ui::mojom::CursorType::kEastWestResize:
return XC_sb_h_double_arrow;
case ui::mojom::CursorType::kNorthEastSouthWestResize:
return XC_left_ptr;
case ui::mojom::CursorType::kNorthWestSouthEastResize:
return XC_left_ptr;
case ui::mojom::CursorType::kColumnResize:
return XC_sb_h_double_arrow;
case ui::mojom::CursorType::kRowResize:
return XC_sb_v_double_arrow;
case ui::mojom::CursorType::kMiddlePanning:
return XC_fleur;
case ui::mojom::CursorType::kEastPanning:
return XC_sb_right_arrow;
case ui::mojom::CursorType::kNorthPanning:
return XC_sb_up_arrow;
case ui::mojom::CursorType::kNorthEastPanning:
return XC_top_right_corner;
case ui::mojom::CursorType::kNorthWestPanning:
return XC_top_left_corner;
case ui::mojom::CursorType::kSouthPanning:
return XC_sb_down_arrow;
case ui::mojom::CursorType::kSouthEastPanning:
return XC_bottom_right_corner;
case ui::mojom::CursorType::kSouthWestPanning:
return XC_bottom_left_corner;
case ui::mojom::CursorType::kWestPanning:
return XC_sb_left_arrow;
case ui::mojom::CursorType::kMove:
return XC_fleur;
case ui::mojom::CursorType::kVerticalText:
return XC_left_ptr;
case ui::mojom::CursorType::kCell:
return XC_left_ptr;
case ui::mojom::CursorType::kContextMenu:
return XC_left_ptr;
case ui::mojom::CursorType::kAlias:
return XC_left_ptr;
case ui::mojom::CursorType::kProgress:
return XC_left_ptr;
case ui::mojom::CursorType::kNoDrop:
return XC_left_ptr;
case ui::mojom::CursorType::kCopy:
return XC_left_ptr;
case ui::mojom::CursorType::kNotAllowed:
return XC_left_ptr;
case ui::mojom::CursorType::kZoomIn:
return XC_left_ptr;
case ui::mojom::CursorType::kZoomOut:
return XC_left_ptr;
case ui::mojom::CursorType::kGrab:
return XC_left_ptr;
case ui::mojom::CursorType::kGrabbing:
return XC_left_ptr;
case ui::mojom::CursorType::kMiddlePanningVertical:
return XC_left_ptr;
case ui::mojom::CursorType::kMiddlePanningHorizontal:
return XC_left_ptr;
case ui::mojom::CursorType::kDndNone:
return XC_left_ptr;
case ui::mojom::CursorType::kDndMove:
return XC_left_ptr;
case ui::mojom::CursorType::kDndCopy:
return XC_left_ptr;
case ui::mojom::CursorType::kDndLink:
return XC_left_ptr;
case ui::mojom::CursorType::kNull:
return XC_left_ptr;
case ui::mojom::CursorType::kCustom:
case ui::mojom::CursorType::kNone:
break;
}
NOTREACHED();
return 0;
}
// The following XCursorCache code was deleted from ui/base/x/x11_util.cc in
// https://crbug.com/665574#c2
// A process wide singleton that manages the usage of X cursors.
class XCursorCache {
public:
XCursorCache() {}
~XCursorCache() { Clear(); }
::Cursor GetCursor(int cursor_shape) {
// Lookup cursor by attempting to insert a null value, which avoids
// a second pass through the map after a cache miss.
std::pair<std::map<int, ::Cursor>::iterator, bool> it =
cache_.insert(std::make_pair(cursor_shape, 0));
if (it.second) {
XDisplay* display = gfx::GetXDisplay();
it.first->second = XCreateFontCursor(display, cursor_shape);
}
return it.first->second;
}
void Clear() {
XDisplay* display = gfx::GetXDisplay();
for (std::map<int, ::Cursor>::iterator it = cache_.begin();
it != cache_.end(); ++it) {
XFreeCursor(display, it->second);
}
cache_.clear();
}
private:
// Maps X11 font cursor shapes to Cursor IDs.
std::map<int, ::Cursor> cache_;
DISALLOW_COPY_AND_ASSIGN(XCursorCache);
};
XCursorCache* cursor_cache = nullptr;
// Returns an X11 Cursor, sharable across the process.
// |cursor_shape| is an X font cursor shape, see XCreateFontCursor().
::Cursor GetXCursor(int cursor_shape) {
if (!cursor_cache)
cursor_cache = new XCursorCache;
return cursor_cache->GetCursor(cursor_shape);
}
// Based on ui/base/x/x11_cursor_factory.cc.
scoped_refptr<ui::X11Cursor> CreateInvisibleCursor(
ui::XCursorLoader* cursor_loader) {
SkBitmap bitmap;
bitmap.allocN32Pixels(1, 1);
return cursor_loader->CreateCursor(bitmap, gfx::Point(0, 0));
}
} // namespace
#endif // defined(USE_X11)
#include "ui/base/x/x11_cursor.h"
#endif
CefCursorHandle CefRenderWidgetHostViewOSR::GetPlatformCursor(
ui::mojom::CursorType type) {
#if defined(USE_X11)
if (type == ui::mojom::CursorType::kNone) {
if (!invisible_cursor_) {
cursor_loader_ =
std::make_unique<ui::XCursorLoader>(x11::Connection::Get());
invisible_cursor_ = CreateInvisibleCursor(cursor_loader_.get());
}
return static_cast<::Cursor>(invisible_cursor_->xcursor());
} else {
return GetXCursor(ToCursorID(type));
auto cursor = ui::CursorFactory::GetInstance()->GetDefaultCursor(type);
if (cursor) {
return ToCursorHandle(*cursor);
}
#endif // defined(USE_X11)
return 0;
}
CefCursorHandle CefRenderWidgetHostViewOSR::ToCursorHandle(
ui::PlatformCursor cursor) {
#if defined(USE_X11)
// See https://crbug.com/1029142 for background.
return static_cast<CefCursorHandle>(
static_cast<ui::X11Cursor*>(cursor)->xcursor());
#else
return cursor;
#endif
}

View File

@ -172,3 +172,8 @@ CefCursorHandle CefRenderWidgetHostViewOSR::GetPlatformCursor(
return LoadCursor(module_handle, cursor_id);
}
CefCursorHandle CefRenderWidgetHostViewOSR::ToCursorHandle(
ui::PlatformCursor cursor) {
return cursor;
}

View File

@ -146,10 +146,10 @@ bool CefWebContentsViewOSR::CloseTabAfterEventTrackingIfNeeded() {
void CefWebContentsViewOSR::StartDragging(
const content::DropData& drop_data,
blink::WebDragOperationsMask allowed_ops,
blink::DragOperationsMask allowed_ops,
const gfx::ImageSkia& image,
const gfx::Vector2d& image_offset,
const content::DragEventSourceInfo& event_info,
const blink::mojom::DragEventSourceInfo& event_info,
content::RenderWidgetHostImpl* source_rwh) {
CefRefPtr<AlloyBrowserHostImpl> browser = GetBrowser();
if (browser.get()) {
@ -161,8 +161,7 @@ void CefWebContentsViewOSR::StartDragging(
}
}
void CefWebContentsViewOSR::UpdateDragCursor(
blink::WebDragOperation operation) {
void CefWebContentsViewOSR::UpdateDragCursor(blink::DragOperation operation) {
CefRefPtr<AlloyBrowserHostImpl> browser = GetBrowser();
if (browser.get())
browser->UpdateDragCursor(operation);

View File

@ -62,12 +62,12 @@ class CefWebContentsViewOSR : public content::WebContentsView,
// RenderViewHostDelegateView methods.
void StartDragging(const content::DropData& drop_data,
blink::WebDragOperationsMask allowed_ops,
blink::DragOperationsMask allowed_ops,
const gfx::ImageSkia& image,
const gfx::Vector2d& image_offset,
const content::DragEventSourceInfo& event_info,
const blink::mojom::DragEventSourceInfo& event_info,
content::RenderWidgetHostImpl* source_rwh) override;
void UpdateDragCursor(blink::WebDragOperation operation) override;
void UpdateDragCursor(blink::DragOperation operation) override;
virtual void GotFocus(
content::RenderWidgetHostImpl* render_widget_host) override;
virtual void LostFocus(

View File

@ -49,6 +49,7 @@
#include "components/prefs/pref_service.h"
#include "components/proxy_config/pref_proxy_config_tracker_impl.h"
#include "components/proxy_config/proxy_config_dictionary.h"
#include "components/safe_browsing/core/common/safe_browsing_prefs.h"
#include "components/spellcheck/browser/pref_names.h"
#include "components/sync_preferences/pref_service_syncable.h"
#include "components/sync_preferences/pref_service_syncable_factory.h"
@ -203,9 +204,10 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
// Based on chrome/browser/ui/browser_ui_prefs.cc RegisterBrowserPrefs.
registry->RegisterBooleanPref(prefs::kAllowFileSelectionDialogs, true);
// From Chrome::RegisterBrowserUserPrefs.
// Based on chrome/browser/ui/browser_ui_prefs.cc RegisterBrowserUserPrefs.
registry->RegisterBooleanPref(prefs::kPrintPreviewUseSystemDefaultPrinter,
false);
registry->RegisterBooleanPref(prefs::kWebRTCAllowLegacyTLSProtocols, false);
if (command_line->HasSwitch(switches::kEnablePreferenceTesting)) {
// Preferences used with unit tests.
@ -233,6 +235,7 @@ std::unique_ptr<PrefService> CreatePrefService(Profile* profile,
media_router::RegisterProfilePrefs(registry.get());
MediaDeviceIDSalt::RegisterProfilePrefs(registry.get());
ProfileNetworkContextService::RegisterProfilePrefs(registry.get());
safe_browsing::RegisterProfilePrefs(registry.get());
const std::string& locale =
command_line->GetSwitchValueASCII(switches::kLang);

View File

@ -35,12 +35,12 @@
#include "content/public/browser/site_instance.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/url_constants.h"
#include "content/public/common/web_preferences.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/browser/view_type_utils.h"
#include "extensions/common/constants.h"
#include "media/media_buildflags.h"
#include "third_party/blink/public/common/peerconnection/webrtc_ip_handling_policy.h"
#include "third_party/blink/public/common/web_preferences/web_preferences.h"
#include "ui/native_theme/native_theme.h"
namespace renderer_prefs {
@ -50,7 +50,7 @@ namespace {
// Set default values based on CEF command-line flags for preferences that are
// not available via the PrefService. Chromium command-line flags should not
// exist for these preferences.
void SetDefaultPrefs(content::WebPreferences& web) {
void SetDefaultPrefs(blink::web_pref::WebPreferences& web) {
const base::CommandLine* command_line =
base::CommandLine::ForCurrentProcess();
@ -70,7 +70,7 @@ void SetDefaultPrefs(content::WebPreferences& web) {
// Chrome preferences.
// Should match ChromeContentBrowserClient::OverrideWebkitPrefs.
void SetChromePrefs(Profile* profile, content::WebPreferences& web) {
void SetChromePrefs(Profile* profile, blink::web_pref::WebPreferences& web) {
PrefService* prefs = profile->GetPrefs();
// Fill per-script font preferences.
@ -134,11 +134,11 @@ void SetChromePrefs(Profile* profile, content::WebPreferences& web) {
std::string image_animation_policy =
prefs->GetString(prefs::kAnimationPolicy);
if (image_animation_policy == kAnimationPolicyOnce)
web.animation_policy = content::IMAGE_ANIMATION_POLICY_ANIMATION_ONCE;
web.animation_policy = blink::web_pref::kImageAnimationPolicyAnimateOnce;
else if (image_animation_policy == kAnimationPolicyNone)
web.animation_policy = content::IMAGE_ANIMATION_POLICY_NO_ANIMATION;
web.animation_policy = blink::web_pref::kImageAnimationPolicyNoAnimation;
else
web.animation_policy = content::IMAGE_ANIMATION_POLICY_ALLOWED;
web.animation_policy = blink::web_pref::kImageAnimationPolicyAllowed;
}
// Make sure we will set the default_encoding with canonical encoding name.
@ -161,7 +161,7 @@ void SetChromePrefs(Profile* profile, content::WebPreferences& web) {
// Extension preferences.
// Should match ChromeContentBrowserClientExtensionsPart::OverrideWebkitPrefs.
void SetExtensionPrefs(content::RenderViewHost* rvh,
content::WebPreferences& web) {
blink::web_pref::WebPreferences& web) {
if (!extensions::ExtensionsEnabled())
return;
@ -199,29 +199,30 @@ void SetExtensionPrefs(content::RenderViewHost* rvh,
web_var = false;
// Set preferences based on CefBrowserSettings.
void SetCefPrefs(const CefBrowserSettings& cef, content::WebPreferences& web) {
void SetCefPrefs(const CefBrowserSettings& cef,
blink::web_pref::WebPreferences& web) {
if (cef.standard_font_family.length > 0) {
web.standard_font_family_map[content::kCommonScript] =
web.standard_font_family_map[blink::web_pref::kCommonScript] =
CefString(&cef.standard_font_family);
}
if (cef.fixed_font_family.length > 0) {
web.fixed_font_family_map[content::kCommonScript] =
web.fixed_font_family_map[blink::web_pref::kCommonScript] =
CefString(&cef.fixed_font_family);
}
if (cef.serif_font_family.length > 0) {
web.serif_font_family_map[content::kCommonScript] =
web.serif_font_family_map[blink::web_pref::kCommonScript] =
CefString(&cef.serif_font_family);
}
if (cef.sans_serif_font_family.length > 0) {
web.sans_serif_font_family_map[content::kCommonScript] =
web.sans_serif_font_family_map[blink::web_pref::kCommonScript] =
CefString(&cef.sans_serif_font_family);
}
if (cef.cursive_font_family.length > 0) {
web.cursive_font_family_map[content::kCommonScript] =
web.cursive_font_family_map[blink::web_pref::kCommonScript] =
CefString(&cef.cursive_font_family);
}
if (cef.fantasy_font_family.length > 0) {
web.fantasy_font_family_map[content::kCommonScript] =
web.fantasy_font_family_map[blink::web_pref::kCommonScript] =
CefString(&cef.fantasy_font_family);
}
@ -280,7 +281,7 @@ void SetBool(CommandLinePrefStore* prefs, const std::string& key, bool value) {
// From chrome/browser/chrome_content_browser_client.cc
bool UpdatePreferredColorSchemesBasedOnURLIfNeeded(
content::WebPreferences* web_prefs,
blink::web_pref::WebPreferences* web_prefs,
const GURL& url) {
// Force a light preferred color scheme on certain URLs if kWebUIDarkMode is
// disabled; some of the UI is not yet correctly themed.
@ -352,7 +353,7 @@ void RegisterProfilePrefs(user_prefs::PrefRegistrySyncable* registry,
}
void PopulateWebPreferences(content::RenderViewHost* rvh,
content::WebPreferences& web) {
blink::web_pref::WebPreferences& web) {
REQUIRE_ALLOY_RUNTIME();
CefRefPtr<AlloyBrowserHostImpl> browser = static_cast<AlloyBrowserHostImpl*>(
extensions::GetOwnerBrowserForHost(rvh, nullptr).get());
@ -399,8 +400,9 @@ void PopulateWebPreferences(content::RenderViewHost* rvh,
}
}
bool PopulateWebPreferencesAfterNavigation(content::WebContents* web_contents,
content::WebPreferences& web) {
bool PopulateWebPreferencesAfterNavigation(
content::WebContents* web_contents,
blink::web_pref::WebPreferences& web) {
return UpdatePreferredColorSchemesBasedOnURLIfNeeded(
&web, web_contents->GetLastCommittedURL());
}

View File

@ -10,10 +10,15 @@
class CommandLinePrefStore;
namespace blink {
namespace web_pref {
struct WebPreferences;
}
} // namespace blink
namespace content {
class RenderViewHost;
class WebContents;
struct WebPreferences;
} // namespace content
namespace user_prefs {
@ -34,9 +39,10 @@ void SetCommandLinePrefDefaults(CommandLinePrefStore* prefs);
// Populate WebPreferences based on a combination of command-line values,
// PrefService and CefBrowserSettings.
void PopulateWebPreferences(content::RenderViewHost* rvh,
content::WebPreferences& web);
bool PopulateWebPreferencesAfterNavigation(content::WebContents* web_contents,
content::WebPreferences& web);
blink::web_pref::WebPreferences& web);
bool PopulateWebPreferencesAfterNavigation(
content::WebContents* web_contents,
blink::web_pref::WebPreferences& web);
} // namespace renderer_prefs

View File

@ -128,31 +128,16 @@ gfx::Size CefPrintDialogLinux::GetPdfPaperSize(
}
// static
void CefPrintDialogLinux::OnPrintStart(int render_process_id,
int render_routing_id) {
if (!CEF_CURRENTLY_ON(CEF_UIT)) {
CEF_POST_TASK(CEF_UIT, base::Bind(&CefPrintDialogLinux::OnPrintStart,
render_process_id, render_routing_id));
return;
void CefPrintDialogLinux::OnPrintStart(CefRefPtr<CefBrowserHostBase> browser) {
CEF_REQUIRE_UIT();
DCHECK(browser);
if (auto app = CefAppManager::Get()->GetApplication()) {
if (auto browser_handler = app->GetBrowserProcessHandler()) {
if (auto print_handler = browser_handler->GetPrintHandler()) {
print_handler->OnPrintStart(browser.get());
}
}
}
CefRefPtr<CefApp> app = CefAppManager::Get()->GetApplication();
if (!app.get())
return;
CefRefPtr<CefBrowserProcessHandler> browser_handler =
app->GetBrowserProcessHandler();
if (!browser_handler.get())
return;
CefRefPtr<CefPrintHandler> handler = browser_handler->GetPrintHandler();
if (!handler.get())
return;
auto browser = extensions::GetOwnerBrowserForFrameRoute(
render_process_id, render_routing_id, nullptr);
if (browser.get())
handler->OnPrintStart(browser.get());
}
CefPrintDialogLinux::CefPrintDialogLinux(PrintingContextLinux* context)

View File

@ -38,7 +38,7 @@ class CefPrintDialogLinux : public printing::PrintDialogGtkInterface,
static gfx::Size GetPdfPaperSize(printing::PrintingContextLinux* context);
// Notify the client when printing has started.
static void OnPrintStart(int render_process_id, int render_routing_id);
static void OnPrintStart(CefRefPtr<CefBrowserHostBase> browser);
// PrintDialogGtkInterface implementation.
void UseDefaultSettings() override;

View File

@ -9,6 +9,7 @@
#include "libcef/browser/browser_info_manager.h"
#include "libcef/browser/download_manager_delegate.h"
#include "libcef/browser/extensions/extension_web_contents_observer.h"
#include "libcef/browser/thread_util.h"
#include <map>
#include <utility>
@ -22,7 +23,6 @@
#include "chrome/browser/printing/print_job_manager.h"
#include "chrome/browser/printing/print_preview_dialog_controller.h"
#include "chrome/browser/printing/print_preview_message_handler.h"
#include "chrome/browser/printing/print_view_manager.h"
#include "chrome/browser/printing/printer_query.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/ui/webui/print_preview/print_preview_ui.h"
@ -42,7 +42,9 @@
#include "printing/metafile_skia.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
#include "libcef/browser/thread_util.h"
#if defined(OS_LINUX)
#include "libcef/browser/printing/print_dialog_linux.h"
#endif
using content::BrowserThread;
@ -176,8 +178,7 @@ struct CefPrintViewManager::PdfPrintState {
};
CefPrintViewManager::CefPrintViewManager(content::WebContents* web_contents)
: WebContentsObserver(web_contents) {
PrintViewManager::CreateForWebContents(web_contents);
: PrintViewManager(web_contents) {
PrintPreviewMessageHandler::CreateForWebContents(web_contents);
}
@ -218,10 +219,22 @@ bool CefPrintViewManager::PrintToPDF(content::RenderFrameHost* rfh,
return true;
}
bool CefPrintViewManager::PrintPreviewNow(content::RenderFrameHost* rfh,
bool has_selection) {
return PrintViewManager::FromWebContents(web_contents())
->PrintPreviewNow(rfh, has_selection);
void CefPrintViewManager::GetDefaultPrintSettings(
GetDefaultPrintSettingsCallback callback) {
#if defined(OS_LINUX)
// Send notification to the client.
auto browser = CefBrowserHostBase::GetBrowserForContents(web_contents());
if (browser) {
CefPrintDialogLinux::OnPrintStart(browser);
}
#endif
PrintViewManager::GetDefaultPrintSettings(std::move(callback));
}
void CefPrintViewManager::DidShowPrintDialog() {
if (pdf_print_state_)
return;
PrintViewManager::DidShowPrintDialog();
}
void CefPrintViewManager::RenderFrameDeleted(
@ -230,14 +243,17 @@ void CefPrintViewManager::RenderFrameDeleted(
render_frame_host == pdf_print_state_->printing_rfh_) {
TerminatePdfPrintJob();
}
PrintViewManager::RenderFrameDeleted(render_frame_host);
}
void CefPrintViewManager::NavigationStopped() {
TerminatePdfPrintJob();
PrintViewManager::NavigationStopped();
}
void CefPrintViewManager::RenderProcessGone(base::TerminationStatus status) {
TerminatePdfPrintJob();
PrintViewManager::RenderProcessGone(status);
}
bool CefPrintViewManager::OnMessageReceived(
@ -253,13 +269,12 @@ bool CefPrintViewManager::OnMessageReceived(
OnShowScriptedPrintPreview)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return false;
return PrintViewManager::OnMessageReceived(message, render_frame_host);
}
IPC_BEGIN_MESSAGE_MAP_WITH_PARAM(CefPrintViewManager, message,
render_frame_host)
IPC_MESSAGE_HANDLER(PrintHostMsg_DidShowPrintDialog,
OnDidShowPrintDialog_PrintToPdf)
IPC_MESSAGE_HANDLER(PrintHostMsg_RequestPrintPreview,
OnRequestPrintPreview_PrintToPdf)
IPC_MESSAGE_HANDLER(PrintHostMsg_MetafileReadyForPrinting,
@ -267,8 +282,35 @@ bool CefPrintViewManager::OnMessageReceived(
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
return handled;
return handled ||
PrintViewManager::OnMessageReceived(message, render_frame_host);
}
// static
void CefPrintViewManager::CreateForWebContents(content::WebContents* contents) {
DCHECK(contents);
if (!FromWebContents(contents)) {
contents->SetUserData(PrintViewManager::UserDataKey(),
base::WrapUnique(new CefPrintViewManager(contents)));
}
}
// static
CefPrintViewManager* CefPrintViewManager::FromWebContents(
content::WebContents* contents) {
DCHECK(contents);
return static_cast<CefPrintViewManager*>(
contents->GetUserData(PrintViewManager::UserDataKey()));
}
// static
const CefPrintViewManager* CefPrintViewManager::FromWebContents(
const content::WebContents* contents) {
DCHECK(contents);
return static_cast<const CefPrintViewManager*>(
contents->GetUserData(PrintViewManager::UserDataKey()));
}
void CefPrintViewManager::OnRequestPrintPreview(
content::RenderFrameHost* rfh,
const PrintHostMsg_RequestPrintPreview_Params&) {
@ -281,9 +323,6 @@ void CefPrintViewManager::OnShowScriptedPrintPreview(
InitializePrintPreview(rfh->GetFrameTreeNodeId());
}
void CefPrintViewManager::OnDidShowPrintDialog_PrintToPdf(
content::RenderFrameHost* rfh) {}
void CefPrintViewManager::OnRequestPrintPreview_PrintToPdf(
content::RenderFrameHost* rfh,
const PrintHostMsg_RequestPrintPreview_Params&) {
@ -303,7 +342,7 @@ void CefPrintViewManager::OnRequestPrintPreview_PrintToPdf(
void CefPrintViewManager::OnMetafileReadyForPrinting_PrintToPdf(
content::RenderFrameHost* rfh,
const mojom::DidPreviewDocumentParams& params,
const PrintHostMsg_PreviewIds& ids) {
const mojom::PreviewIds& ids) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
StopWorker(params.document_cookie);
@ -370,8 +409,6 @@ void CefPrintViewManager::InitializePrintPreview(int frame_tree_node_id) {
->Initialize(frame_tree_node_id);
}
WEB_CONTENTS_USER_DATA_KEY_IMPL(CefPrintViewManager)
// CefPrintViewManager::PrintPreviewHelper
CefPrintViewManager::PrintPreviewHelper::PrintPreviewHelper(

View File

@ -8,6 +8,7 @@
#include "include/internal/cef_types_wrappers.h"
#include "base/macros.h"
#include "chrome/browser/printing/print_view_manager.h"
#include "components/printing/common/print.mojom-forward.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/web_contents_user_data.h"
@ -20,15 +21,12 @@ class WebContentsObserver;
class CefBrowserInfo;
struct PrintHostMsg_PreviewIds;
struct PrintHostMsg_RequestPrintPreview_Params;
namespace printing {
// Manages the print commands for a WebContents.
class CefPrintViewManager
: public content::WebContentsObserver,
public content::WebContentsUserData<CefPrintViewManager> {
// CEF handler for print commands.
class CefPrintViewManager : public PrintViewManager {
public:
~CefPrintViewManager() override;
@ -41,16 +39,26 @@ class CefPrintViewManager
const CefPdfPrintSettings& settings,
const PdfPrintCallback& callback);
// Call to Chrome's PrintViewManager.
bool PrintPreviewNow(content::RenderFrameHost* rfh, bool has_selection);
// mojom::PrintManagerHost methods:
void GetDefaultPrintSettings(
GetDefaultPrintSettingsCallback callback) override;
void DidShowPrintDialog() override;
// content::WebContentsObserver implementation.
// content::WebContentsObserver methods:
void RenderFrameDeleted(content::RenderFrameHost* render_frame_host) override;
void NavigationStopped() override;
void RenderProcessGone(base::TerminationStatus status) override;
bool OnMessageReceived(const IPC::Message& message,
content::RenderFrameHost* render_frame_host) override;
// Inline versions of the content::WebContentsUserData methods to avoid
// ambiguous warnings due to the PrintViewManager base class also extending
// WebContentsUserData.
static void CreateForWebContents(content::WebContents* contents);
static CefPrintViewManager* FromWebContents(content::WebContents* contents);
static const CefPrintViewManager* FromWebContents(
const content::WebContents* contents);
// Used to track the lifespan of the print preview WebContents.
class PrintPreviewHelper
: public content::WebContentsObserver,
@ -72,7 +80,6 @@ class CefPrintViewManager
private:
explicit CefPrintViewManager(content::WebContents* web_contents);
friend class content::WebContentsUserData<CefPrintViewManager>;
// IPC Message handlers.
void OnRequestPrintPreview(content::RenderFrameHost* rfh,
@ -82,11 +89,10 @@ class CefPrintViewManager
void OnRequestPrintPreview_PrintToPdf(
content::RenderFrameHost* rfh,
const PrintHostMsg_RequestPrintPreview_Params&);
void OnDidShowPrintDialog_PrintToPdf(content::RenderFrameHost* rfh);
void OnMetafileReadyForPrinting_PrintToPdf(
content::RenderFrameHost* rfh,
const mojom::DidPreviewDocumentParams& params,
const PrintHostMsg_PreviewIds& ids);
const mojom::PreviewIds& ids);
void InitializePrintPreview(int frame_tree_node_id);
void TerminatePdfPrintJob();
@ -94,7 +100,7 @@ class CefPrintViewManager
int next_pdf_request_id_ = content::RenderFrameHost::kNoFrameTreeNodeId;
struct PdfPrintState;
std::unique_ptr<PdfPrintState> pdf_print_state_;
WEB_CONTENTS_USER_DATA_KEY_DECL();
DISALLOW_COPY_AND_ASSIGN(CefPrintViewManager);
};

View File

@ -4,6 +4,8 @@
#include "libcef/browser/printing/printing_message_filter.h"
#include "libcef/browser/printing/print_view_manager.h"
#include <memory>
#include <string>
#include <utility>
@ -19,6 +21,7 @@
#include "chrome/common/pref_names.h"
#include "components/keyed_service/content/browser_context_keyed_service_shutdown_notifier_factory.h"
#include "components/printing/browser/print_manager_utils.h"
#include "components/printing/common/print.mojom.h"
#include "components/printing/common/print_messages.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
@ -27,10 +30,6 @@
#include "content/public/common/child_process_host.h"
#include "printing/mojom/print.mojom.h"
#if defined(OS_LINUX)
#include "libcef/browser/printing/print_dialog_linux.h"
#endif
using content::BrowserThread;
namespace printing {
@ -65,6 +64,25 @@ CefPrintingMessageFilterShutdownNotifierFactory::GetInstance() {
return g_printing_message_filter_shutdown_notifier_factory.Pointer();
}
#if defined(OS_WIN)
content::WebContents* GetWebContentsForRenderFrame(int render_process_id,
int render_frame_id) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
content::RenderFrameHost* frame =
content::RenderFrameHost::FromID(render_process_id, render_frame_id);
return frame ? content::WebContents::FromRenderFrameHost(frame) : nullptr;
}
CefPrintViewManager* GetPrintViewManager(int render_process_id,
int render_frame_id) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
content::WebContents* web_contents =
GetWebContentsForRenderFrame(render_process_id, render_frame_id);
return web_contents ? CefPrintViewManager::FromWebContents(web_contents)
: nullptr;
}
#endif // defined(OS_WIN)
} // namespace
CefPrintingMessageFilter::CefPrintingMessageFilter(int render_process_id,
@ -104,8 +122,6 @@ void CefPrintingMessageFilter::OnDestruct() const {
bool CefPrintingMessageFilter::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(CefPrintingMessageFilter, message)
IPC_MESSAGE_HANDLER_DELAY_REPLY(PrintHostMsg_GetDefaultPrintSettings,
OnGetDefaultPrintSettings)
IPC_MESSAGE_HANDLER_DELAY_REPLY(PrintHostMsg_ScriptedPrint, OnScriptedPrint)
IPC_MESSAGE_HANDLER_DELAY_REPLY(PrintHostMsg_UpdatePrintSettings,
OnUpdatePrintSettings)
@ -115,60 +131,8 @@ bool CefPrintingMessageFilter::OnMessageReceived(const IPC::Message& message) {
return handled;
}
void CefPrintingMessageFilter::OnGetDefaultPrintSettings(
IPC::Message* reply_msg) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
#if defined(OS_LINUX)
// Send notification to the client.
CefPrintDialogLinux::OnPrintStart(render_process_id_,
reply_msg->routing_id());
#endif
std::unique_ptr<PrinterQuery> printer_query;
if (!is_printing_enabled_.GetValue()) {
// Reply with NULL query.
OnGetDefaultPrintSettingsReply(std::move(printer_query), reply_msg);
return;
}
printer_query = queue_->PopPrinterQuery(0);
if (!printer_query.get()) {
printer_query =
queue_->CreatePrinterQuery(render_process_id_, reply_msg->routing_id());
}
// Loads default settings. This is asynchronous, only the IPC message sender
// will hang until the settings are retrieved.
auto* printer_query_ptr = printer_query.get();
printer_query_ptr->GetSettings(
PrinterQuery::GetSettingsAskParam::DEFAULTS, 0, false,
printing::mojom::MarginType::kDefaultMargins, false, false,
base::BindOnce(&CefPrintingMessageFilter::OnGetDefaultPrintSettingsReply,
this, std::move(printer_query), reply_msg));
}
void CefPrintingMessageFilter::OnGetDefaultPrintSettingsReply(
std::unique_ptr<PrinterQuery> printer_query,
IPC::Message* reply_msg) {
mojom::PrintParams params;
if (printer_query && printer_query->last_status() == PrintingContext::OK) {
RenderParamsFromPrintSettings(printer_query->settings(), &params);
params.document_cookie = printer_query->cookie();
}
PrintHostMsg_GetDefaultPrintSettings::WriteReplyParams(reply_msg, params);
Send(reply_msg);
// If printing was enabled.
if (printer_query.get()) {
// If user hasn't cancelled.
if (printer_query->cookie() && printer_query->settings().dpi()) {
queue_->QueuePrinterQuery(std::move(printer_query));
} else {
printer_query->StopWorker();
}
}
}
void CefPrintingMessageFilter::OnScriptedPrint(
const PrintHostMsg_ScriptedPrint_Params& params,
const mojom::ScriptedPrintParams& params,
IPC::Message* reply_msg) {
std::unique_ptr<PrinterQuery> printer_query =
queue_->PopPrinterQuery(params.cookie);
@ -187,18 +151,18 @@ void CefPrintingMessageFilter::OnScriptedPrint(
void CefPrintingMessageFilter::OnScriptedPrintReply(
std::unique_ptr<PrinterQuery> printer_query,
IPC::Message* reply_msg) {
PrintMsg_PrintPages_Params params;
if (printer_query->last_status() != PrintingContext::OK ||
!printer_query->settings().dpi()) {
params.Reset();
} else {
RenderParamsFromPrintSettings(printer_query->settings(), &params.params);
params.params.document_cookie = printer_query->cookie();
mojom::PrintPagesParams params;
params.params = mojom::PrintParams::New();
if (printer_query->last_status() == PrintingContext::OK &&
printer_query->settings().dpi()) {
RenderParamsFromPrintSettings(printer_query->settings(),
params.params.get());
params.params->document_cookie = printer_query->cookie();
params.pages = PageRange::GetPages(printer_query->settings().ranges());
}
PrintHostMsg_ScriptedPrint::WriteReplyParams(reply_msg, params);
Send(reply_msg);
if (!params.params.dpi.IsEmpty() && params.params.document_cookie) {
if (!params.params->dpi.IsEmpty() && params.params->document_cookie) {
queue_->QueuePrinterQuery(std::move(printer_query));
} else {
printer_query->StopWorker();
@ -228,17 +192,26 @@ void CefPrintingMessageFilter::OnUpdatePrintSettings(int document_cookie,
void CefPrintingMessageFilter::OnUpdatePrintSettingsReply(
std::unique_ptr<PrinterQuery> printer_query,
IPC::Message* reply_msg) {
PrintMsg_PrintPages_Params params;
if (!printer_query.get() ||
printer_query->last_status() != PrintingContext::OK) {
params.Reset();
} else {
RenderParamsFromPrintSettings(printer_query->settings(), &params.params);
params.params.document_cookie = printer_query->cookie();
mojom::PrintPagesParams params;
params.params = mojom::PrintParams::New();
if (printer_query && printer_query->last_status() == PrintingContext::OK) {
RenderParamsFromPrintSettings(printer_query->settings(),
params.params.get());
params.params->document_cookie = printer_query->cookie();
params.pages = PageRange::GetPages(printer_query->settings().ranges());
}
bool canceled = printer_query.get() &&
(printer_query->last_status() == PrintingContext::CANCEL);
#if defined(OS_WIN)
if (canceled) {
int routing_id = reply_msg->routing_id();
content::GetUIThreadTaskRunner({})->PostTask(
FROM_HERE,
base::BindOnce(&CefPrintingMessageFilter::NotifySystemDialogCancelled,
this, routing_id));
}
#endif
PrintHostMsg_UpdatePrintSettings::WriteReplyParams(reply_msg, params,
canceled);
Send(reply_msg);
@ -252,10 +225,16 @@ void CefPrintingMessageFilter::OnUpdatePrintSettingsReply(
}
}
void CefPrintingMessageFilter::OnCheckForCancel(
const PrintHostMsg_PreviewIds& ids,
bool* cancel) {
void CefPrintingMessageFilter::OnCheckForCancel(const mojom::PreviewIds& ids,
bool* cancel) {
*cancel = false;
}
#if defined(OS_WIN)
void CefPrintingMessageFilter::NotifySystemDialogCancelled(int routing_id) {
auto manager = GetPrintViewManager(render_process_id_, routing_id);
manager->SystemDialogCancelled();
}
#endif
} // namespace printing

View File

@ -15,11 +15,10 @@
#include "build/build_config.h"
#include "components/keyed_service/core/keyed_service_shutdown_notifier.h"
#include "components/prefs/pref_member.h"
#include "components/printing/common/print.mojom-forward.h"
#include "content/public/browser/browser_message_filter.h"
#include "printing/buildflags/buildflags.h"
struct PrintHostMsg_PreviewIds;
struct PrintHostMsg_ScriptedPrint_Params;
class Profile;
namespace printing {
@ -47,16 +46,10 @@ class CefPrintingMessageFilter : public content::BrowserMessageFilter {
void ShutdownOnUIThread();
// Get the default print setting.
void OnGetDefaultPrintSettings(IPC::Message* reply_msg);
void OnGetDefaultPrintSettingsReply(
std::unique_ptr<PrinterQuery> printer_query,
IPC::Message* reply_msg);
// The renderer host have to show to the user the print dialog and returns
// the selected print settings. The task is handled by the print worker
// thread and the UI thread. The reply occurs on the IO thread.
void OnScriptedPrint(const PrintHostMsg_ScriptedPrint_Params& params,
void OnScriptedPrint(const mojom::ScriptedPrintParams& params,
IPC::Message* reply_msg);
void OnScriptedPrintReply(std::unique_ptr<PrinterQuery> printer_query,
IPC::Message* reply_msg);
@ -71,7 +64,10 @@ class CefPrintingMessageFilter : public content::BrowserMessageFilter {
IPC::Message* reply_msg);
// Check to see if print preview has been cancelled.
void OnCheckForCancel(const PrintHostMsg_PreviewIds& ids, bool* cancel);
void OnCheckForCancel(const mojom::PreviewIds& ids, bool* cancel);
#if defined(OS_WIN)
void NotifySystemDialogCancelled(int routing_id);
#endif
std::unique_ptr<KeyedServiceShutdownNotifier::Subscription>
printing_shutdown_notifier_;

View File

@ -729,7 +729,8 @@ void CefRequestContextImpl::ClearHttpAuthCredentialsInternal(
CEF_REQUIRE_UIT();
browser_context->GetNetworkContext()->ClearHttpAuthCache(
base::Time(), base::Bind(&CefCompletionCallback::OnComplete, callback));
/*start_time=*/base::Time(), /*end_time=*/base::Time::Max(),
base::Bind(&CefCompletionCallback::OnComplete, callback));
}
void CefRequestContextImpl::CloseAllConnectionsInternal(

View File

@ -81,7 +81,7 @@ CEF_BUTTON_IMPL_T void CEF_BUTTON_IMPL_D::SetInkDropEnabled(bool enabled) {
enabled ? views::InkDropHostView::InkDropMode::ON
: views::InkDropHostView::InkDropMode::OFF);
if (enabled) {
ParentClass::root_view()->set_ink_drop_base_color(
ParentClass::root_view()->SetInkDropBaseColor(
color_utils::BlendTowardMaxContrast(
ParentClass::root_view()->background()->get_color(), 0x61));
}
@ -101,7 +101,7 @@ CEF_BUTTON_IMPL_T void CEF_BUTTON_IMPL_D::SetAccessibleName(
CEF_BUTTON_IMPL_T void CEF_BUTTON_IMPL_D::SetFocusable(bool focusable) {
CEF_REQUIRE_VALID_RETURN_VOID();
ParentClass::root_view()->set_request_focus_on_press(focusable);
ParentClass::root_view()->SetRequestFocusOnPress(focusable);
ParentClass::SetFocusable(focusable);
}

View File

@ -18,11 +18,7 @@
// CefButtonView template.
class MenuButtonEx : public views::MenuButton, public views::ButtonListener {
public:
MenuButtonEx() : views::MenuButton(this, base::string16()) {
// TODO(cef): MenuButton should not use ButtonListener. See
// http://crbug.com/585252 for details.
Button::listener_ = this;
}
MenuButtonEx() : views::MenuButton(this) {}
};
class CefMenuButtonView

View File

@ -119,15 +119,6 @@ class UserData : public base::SupportsUserData::Data {
CefView* view_ref_;
};
inline CefWindowHandle ToWindowHandle(gfx::AcceleratedWidget widget) {
#if defined(USE_X11)
// See https://crbug.com/1066670#c57 for background.
return static_cast<uint32_t>(widget);
#else
return widget;
#endif
}
} // namespace
const SkColor kDefaultBackgroundColor = SkColorSetARGB(255, 255, 255, 255);
@ -313,7 +304,7 @@ CefWindowHandle GetWindowHandle(views::Widget* widget) {
if (widget) {
aura::Window* window = widget->GetNativeWindow();
if (window && window->GetRootWindow())
return ToWindowHandle(window->GetHost()->GetAcceleratedWidget());
return window->GetHost()->GetAcceleratedWidget();
}
return kNullWindowHandle;
}

View File

@ -14,7 +14,7 @@
#include "ui/views/window/native_frame_view.h"
#if defined(OS_LINUX) && defined(USE_X11)
#include <X11/Xlib.h>
#include "ui/base/x/x11_util.h"
#include "ui/gfx/x/x11_types.h"
#endif
@ -312,38 +312,9 @@ void CefWindowView::CreateWidget() {
#if defined(OS_LINUX) && defined(USE_X11)
if (is_frameless_) {
::Window window = view_util::GetWindowHandle(widget);
auto window = view_util::GetWindowHandle(widget);
DCHECK(window);
::Display* display = gfx::GetXDisplay();
DCHECK(display);
// Make the window borderless. From
// http://stackoverflow.com/questions/1904445/borderless-windows-on-linux
struct MwmHints {
unsigned long flags;
unsigned long functions;
unsigned long decorations;
long input_mode;
unsigned long status;
};
enum {
MWM_HINTS_FUNCTIONS = (1L << 0),
MWM_HINTS_DECORATIONS = (1L << 1),
MWM_FUNC_ALL = (1L << 0),
MWM_FUNC_RESIZE = (1L << 1),
MWM_FUNC_MOVE = (1L << 2),
MWM_FUNC_MINIMIZE = (1L << 3),
MWM_FUNC_MAXIMIZE = (1L << 4),
MWM_FUNC_CLOSE = (1L << 5)
};
Atom mwmHintsProperty = XInternAtom(display, "_MOTIF_WM_HINTS", 0);
struct MwmHints hints = {};
hints.flags = MWM_HINTS_DECORATIONS;
hints.decorations = 0;
XChangeProperty(display, window, mwmHintsProperty, mwmHintsProperty, 32,
PropModeReplace, (unsigned char*)&hints, 5);
ui::SetUseOSWindowFrame(static_cast<x11::Window>(window), false);
}
#endif // defined(OS_LINUX) && defined(USE_X11)
}

View File

@ -17,7 +17,6 @@
#include "base/lazy_instance.h"
#include "content/public/common/content_switches.h"
#include "sandbox/policy/switches.h"
#include "services/service_manager/embedder/switches.h"
#if defined(OS_MAC)
#include "libcef/common/util_mac.h"

View File

@ -20,7 +20,7 @@
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "components/crash/core/common/crash_key.h"
#include "services/service_manager/embedder/switches.h"
#include "content/public/common/content_switches.h"
#include "third_party/crashpad/crashpad/client/annotation.h"
#if defined(OS_MAC)
@ -627,7 +627,7 @@ bool CefCrashReporterClient::EnableBreakpadForProcess(
const std::string& process_type) {
return process_type == switches::kRendererProcess ||
process_type == switches::kPpapiPluginProcess ||
process_type == service_manager::switches::kZygoteProcess ||
process_type == switches::kZygoteProcess ||
process_type == switches::kGpuProcess;
}

View File

@ -19,7 +19,6 @@
#include "components/crash/core/common/crash_key.h"
#include "components/crash/core/common/crash_keys.h"
#include "content/public/common/content_switches.h"
#include "services/service_manager/embedder/switches.h"
#if defined(OS_MAC)
#include "base/mac/foundation_util.h"
@ -133,7 +132,7 @@ void InitCrashReporter(const base::CommandLine& command_line,
g_crash_reporting_enabled = true;
#else // !defined(OS_MAC)
if (process_type != service_manager::switches::kZygoteProcess) {
if (process_type != switches::kZygoteProcess) {
// Crash reporting for subprocesses created using the zygote will be
// initialized in ZygoteForked.
breakpad::InitCrashReporter(process_type);

View File

@ -56,7 +56,6 @@ CefRefPtr<CefValue> CefParseJSON(const void* json,
CefRefPtr<CefValue> CefParseJSONAndReturnError(
const CefString& json_string,
cef_json_parser_options_t options,
cef_json_parser_error_t& error_code_out,
CefString& error_msg_out) {
const std::string& json = json_string.ToString();
@ -70,8 +69,6 @@ CefRefPtr<CefValue> CefParseJSONAndReturnError(
.release());
}
error_code_out =
static_cast<cef_json_parser_error_t>(value_and_error.error_code);
error_msg_out = value_and_error.error_message;
return nullptr;
}

View File

@ -543,9 +543,8 @@ void CefRequestImpl::Get(network::ResourceRequest* request,
}
if (!(flags & UR_FLAG_ALLOW_STORED_CREDENTIALS)) {
net_flags |= net::LOAD_DO_NOT_SEND_AUTH_DATA |
net::LOAD_DO_NOT_SEND_COOKIES |
net::LOAD_DO_NOT_SAVE_COOKIES;
// This will disable all credentials including cookies, auth tokens, etc.
request->credentials_mode = network::mojom::CredentialsMode::kOmit;
}
request->load_flags = net_flags;

View File

@ -34,9 +34,10 @@ base::RefCountedStaticMemory* CefResourceBundleDelegate::LoadDataResourceBytes(
return nullptr;
}
bool CefResourceBundleDelegate::GetRawDataResource(int resource_id,
ui::ScaleFactor scale_factor,
base::StringPiece* value) {
bool CefResourceBundleDelegate::GetRawDataResource(
int resource_id,
ui::ScaleFactor scale_factor,
base::StringPiece* value) const {
auto application = CefAppManager::Get()->GetApplication();
if (application) {
CefRefPtr<CefResourceBundleHandler> handler =
@ -59,8 +60,9 @@ bool CefResourceBundleDelegate::GetRawDataResource(int resource_id,
return (pack_loading_disabled_ || !value->empty());
}
bool CefResourceBundleDelegate::GetLocalizedString(int message_id,
base::string16* value) {
bool CefResourceBundleDelegate::GetLocalizedString(
int message_id,
base::string16* value) const {
auto application = CefAppManager::Get()->GetApplication();
if (application) {
CefRefPtr<CefResourceBundleHandler> handler =

View File

@ -33,8 +33,8 @@ class CefResourceBundleDelegate : public ui::ResourceBundle::Delegate {
ui::ScaleFactor scale_factor) override;
bool GetRawDataResource(int resource_id,
ui::ScaleFactor scale_factor,
base::StringPiece* value) override;
bool GetLocalizedString(int message_id, base::string16* value) override;
base::StringPiece* value) const override;
bool GetLocalizedString(int message_id, base::string16* value) const override;
private:
bool pack_loading_disabled_ = false;

View File

@ -26,7 +26,6 @@
#include "media/cdm/cdm_host_file.h"
#include "media/cdm/supported_cdm_versions.h"
#include "sandbox/policy/switches.h"
#include "services/service_manager/embedder/switches.h"
#include "third_party/widevine/cdm/widevine_cdm_common.h" // nogncheck
namespace {
@ -472,7 +471,7 @@ void CefWidevineLoader::AddContentDecryptionModules(
// errors during plugin loading. This is because the Zygote process must pre-
// load all plugins before initializing the sandbox.
if (command_line.GetSwitchValueASCII(switches::kProcessType) !=
service_manager::switches::kZygoteProcess ||
switches::kZygoteProcess ||
command_line.HasSwitch(sandbox::policy::switches::kNoSandbox)) {
return;
}

View File

@ -444,17 +444,6 @@ bool AlloyContentRendererClient::IsOriginIsolatedPepperPlugin(
base::FilePath::FromUTF8Unsafe(AlloyContentClient::kPDFPluginPath);
}
content::BrowserPluginDelegate*
AlloyContentRendererClient::CreateBrowserPluginDelegate(
content::RenderFrame* render_frame,
const content::WebPluginInfo& info,
const std::string& mime_type,
const GURL& original_url) {
DCHECK(extensions::ExtensionsEnabled());
return extensions::CefExtensionsRendererClient::CreateBrowserPluginDelegate(
render_frame, info, mime_type, original_url);
}
void AlloyContentRendererClient::AddSupportedKeySystems(
std::vector<std::unique_ptr<::media::KeySystemProperties>>* key_systems) {
AddChromeKeySystems(key_systems);

View File

@ -97,11 +97,6 @@ class AlloyContentRendererClient
uint64_t VisitedLinkHash(const char* canonical_url, size_t length) override;
bool IsLinkVisited(uint64_t link_hash) override;
bool IsOriginIsolatedPepperPlugin(const base::FilePath& plugin_path) override;
content::BrowserPluginDelegate* CreateBrowserPluginDelegate(
content::RenderFrame* render_frame,
const content::WebPluginInfo& info,
const std::string& mime_type,
const GURL& original_url) override;
void AddSupportedKeySystems(
std::vector<std::unique_ptr<::media::KeySystemProperties>>* key_systems)
override;

View File

@ -5,6 +5,7 @@
#include "libcef/renderer/blink_glue.h"
#include "third_party/blink/public/mojom/v8_cache_options.mojom-blink.h"
#include "third_party/blink/public/platform/web_string.h"
#include "third_party/blink/public/platform/web_url_response.h"
#include "third_party/blink/public/web/web_document.h"
@ -13,6 +14,8 @@
#include "third_party/blink/public/web/web_node.h"
#include "third_party/blink/public/web/web_view_client.h"
#include "third_party/blink/renderer/bindings/core/v8/sanitize_script_errors.h"
#include "third_party/blink/renderer/bindings/core/v8/script_evaluation_result.h"
#include "third_party/blink/renderer/bindings/core/v8/script_source_code.h"
#include "third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h"
#include "third_party/blink/renderer/core/dom/document.h"
@ -163,27 +166,25 @@ bool IsTextControlElement(const blink::WebElement& element) {
return web_element->IsTextControl();
}
v8::MaybeLocal<v8::Value> ExecuteV8ScriptAndReturnValue(
v8::Local<v8::Value> ExecuteV8ScriptAndReturnValue(
const blink::WebString& source,
const blink::WebString& source_url,
int start_line,
v8::Local<v8::Context> context,
v8::Isolate* isolate,
v8::TryCatch& tryCatch,
blink::SanitizeScriptErrors sanitizeScriptErrors) {
v8::TryCatch& tryCatch) {
// Based on ScriptController::executeScriptAndReturnValue
DCHECK(isolate);
if (start_line < 1)
start_line = 1;
v8::MaybeLocal<v8::Value> result;
blink::LocalFrame* frame = blink::ToLocalFrameIfNotDetached(context);
if (!frame)
return result;
return v8::Local<v8::Value>();
blink::V8CacheOptions v8CacheOptions(blink::kV8CacheOptionsDefault);
blink::mojom::V8CacheOptions v8CacheOptions(
blink::mojom::V8CacheOptions::kDefault);
if (const blink::Settings* settings = frame->GetSettings())
v8CacheOptions = settings->GetV8CacheOptions();
@ -194,15 +195,21 @@ v8::MaybeLocal<v8::Value> ExecuteV8ScriptAndReturnValue(
WTF::TextPosition(WTF::OrdinalNumber::FromOneBasedInt(start_line),
WTF::OrdinalNumber::FromZeroBasedInt(0)));
result = blink::V8ScriptRunner::CompileAndRunScript(
// The Rethrow() message is unused due to kDoNotSanitize but it still needs
// to be non-nullopt for exceptions to be re-thrown as expected.
auto result = blink::V8ScriptRunner::CompileAndRunScript(
isolate, blink::ScriptState::From(context), frame->DomWindow(), ssc,
ssc.Url(), sanitizeScriptErrors, blink::ScriptFetchOptions(),
v8CacheOptions);
if (result.IsEmpty()) {
DCHECK(tryCatch.HasCaught());
ssc.Url(), blink::SanitizeScriptErrors::kDoNotSanitize,
blink::ScriptFetchOptions(), std::move(v8CacheOptions),
blink::V8ScriptRunner::RethrowErrorsOption::Rethrow(""));
if (result.GetResultType() ==
blink::ScriptEvaluationResult::ResultType::kSuccess) {
return result.GetSuccessValue();
}
return result;
DCHECK(tryCatch.HasCaught());
return v8::Local<v8::Value>();
}
bool IsScriptForbidden() {

View File

@ -15,7 +15,6 @@
#include "base/macros.h"
#include "third_party/blink/public/platform/web_common.h"
#include "third_party/blink/renderer/bindings/core/v8/sanitize_script_errors.h"
#include "v8/include/v8.h"
namespace blink {
@ -56,14 +55,13 @@ BLINK_EXPORT v8::MaybeLocal<v8::Value> CallV8Function(
v8::Local<v8::Value> args[],
v8::Isolate* isolate);
BLINK_EXPORT v8::MaybeLocal<v8::Value> ExecuteV8ScriptAndReturnValue(
BLINK_EXPORT v8::Local<v8::Value> ExecuteV8ScriptAndReturnValue(
const blink::WebString& source,
const blink::WebString& source_url,
int start_line,
v8::Local<v8::Context> context,
v8::Isolate* isolate,
v8::TryCatch& tryCatch,
blink::SanitizeScriptErrors sanitizeScriptErrors);
v8::TryCatch& tryCatch);
BLINK_EXPORT bool IsScriptForbidden();

View File

@ -120,7 +120,7 @@ void CefBrowserImpl::StopLoad() {
if (render_view()->GetWebView()) {
blink::WebFrame* main_frame = render_view()->GetWebView()->MainFrame();
if (main_frame && main_frame->IsWebLocalFrame()) {
main_frame->ToWebLocalFrame()->StopLoading();
main_frame->ToWebLocalFrame()->DeprecatedStopLoading();
}
}
}

View File

@ -21,9 +21,7 @@
#include "extensions/renderer/dispatcher.h"
#include "extensions/renderer/extension_frame_helper.h"
#include "extensions/renderer/extensions_render_frame_observer.h"
#include "extensions/renderer/guest_view/extensions_guest_view_container.h"
#include "extensions/renderer/guest_view/extensions_guest_view_container_dispatcher.h"
#include "extensions/renderer/guest_view/mime_handler_view/mime_handler_view_container.h"
#include "extensions/renderer/renderer_extension_registry.h"
#include "extensions/renderer/script_context.h"
#include "third_party/blink/public/web/web_document.h"
@ -177,17 +175,4 @@ bool CefExtensionsRendererClient::IsStandaloneExtensionProcess() {
extensions::switches::kExtensionProcess);
}
// static
content::BrowserPluginDelegate*
CefExtensionsRendererClient::CreateBrowserPluginDelegate(
content::RenderFrame* render_frame,
const content::WebPluginInfo& info,
const std::string& mime_type,
const GURL& original_url) {
if (mime_type == content::kBrowserPluginMimeType)
return new extensions::ExtensionsGuestViewContainer(render_frame);
return new extensions::MimeHandlerViewContainer(render_frame, info, mime_type,
original_url);
}
} // namespace extensions

View File

@ -77,11 +77,6 @@ class CefExtensionsRendererClient : public ExtensionsRendererClient {
void RunScriptsAtDocumentIdle(content::RenderFrame* render_frame);
static bool IsStandaloneExtensionProcess();
static content::BrowserPluginDelegate* CreateBrowserPluginDelegate(
content::RenderFrame* render_frame,
const content::WebPluginInfo& info,
const std::string& mime_type,
const GURL& original_url);
private:
std::unique_ptr<extensions::Dispatcher> extension_dispatcher_;

View File

@ -1098,15 +1098,14 @@ bool CefV8ContextImpl::Eval(const CefString& code,
v8::TryCatch try_catch(isolate);
try_catch.SetVerbose(true);
v8::MaybeLocal<v8::Value> func_rv = blink_glue::ExecuteV8ScriptAndReturnValue(
source, source_url, start_line, context, isolate, try_catch,
blink::SanitizeScriptErrors::kSanitize);
v8::Local<v8::Value> func_rv = blink_glue::ExecuteV8ScriptAndReturnValue(
source, source_url, start_line, context, isolate, try_catch);
if (try_catch.HasCaught()) {
exception = new CefV8ExceptionImpl(context, try_catch.Message());
return false;
} else if (!func_rv.IsEmpty()) {
retval = new CefV8ValueImpl(isolate, context, func_rv.ToLocalChecked());
retval = new CefV8ValueImpl(isolate, context, func_rv);
return true;
}

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=c42cd0225d8e4286df471fcc622f9bbf9ed977d3$
// $hash=b2bc3d843217869087e7b1a381d70d687b71a8ff$
//
#include "include/capi/cef_app_capi.h"
@ -610,7 +610,6 @@ CEF_EXPORT struct _cef_value_t* cef_parse_json_buffer(
CEF_EXPORT struct _cef_value_t* cef_parse_jsonand_return_error(
const cef_string_t* json_string,
cef_json_parser_options_t options,
cef_json_parser_error_t* error_code_out,
cef_string_t* error_msg_out) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
@ -618,28 +617,17 @@ CEF_EXPORT struct _cef_value_t* cef_parse_jsonand_return_error(
DCHECK(json_string);
if (!json_string)
return NULL;
// Verify param: error_code_out; type: simple_byref
DCHECK(error_code_out);
if (!error_code_out)
return NULL;
// Verify param: error_msg_out; type: string_byref
DCHECK(error_msg_out);
if (!error_msg_out)
return NULL;
// Translate param: error_code_out; type: simple_byref
cef_json_parser_error_t error_code_outVal =
error_code_out ? *error_code_out : JSON_NO_ERROR;
// Translate param: error_msg_out; type: string_byref
CefString error_msg_outStr(error_msg_out);
// Execute
CefRefPtr<CefValue> _retval = CefParseJSONAndReturnError(
CefString(json_string), options, error_code_outVal, error_msg_outStr);
// Restore param: error_code_out; type: simple_byref
if (error_code_out)
*error_code_out = error_code_outVal;
CefString(json_string), options, error_msg_outStr);
// Return type: refptr_same
return CefValueCppToC::Wrap(_retval);

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=66b734973339eb27399083e978844f7d5a6a6c44$
// $hash=1a80e75d625c78a0ed31b6562f597cbf4d30dfb1$
//
#include <dlfcn.h>
@ -144,7 +144,6 @@ typedef struct _cef_value_t* (
typedef struct _cef_value_t* (*cef_parse_jsonand_return_error_ptr)(
const cef_string_t*,
cef_json_parser_options_t,
cef_json_parser_error_t*,
cef_string_t*);
typedef cef_string_userfree_t (*cef_write_json_ptr)(struct _cef_value_t*,
cef_json_writer_options_t);
@ -1149,10 +1148,9 @@ NO_SANITIZE("cfi-icall")
struct _cef_value_t* cef_parse_jsonand_return_error(
const cef_string_t* json_string,
cef_json_parser_options_t options,
cef_json_parser_error_t* error_code_out,
cef_string_t* error_msg_out) {
return g_libcef_pointers.cef_parse_jsonand_return_error(
json_string, options, error_code_out, error_msg_out);
return g_libcef_pointers.cef_parse_jsonand_return_error(json_string, options,
error_msg_out);
}
NO_SANITIZE("cfi-icall")

View File

@ -9,7 +9,7 @@
// implementations. See the translator.README.txt file in the tools directory
// for more information.
//
// $hash=7db8dbe24a2510d9ae0649f1569909711017c064$
// $hash=a62513bd0425ca940f4a91a836b97674351c8123$
//
#include "include/capi/cef_app_capi.h"
@ -579,7 +579,6 @@ NO_SANITIZE("cfi-icall")
CEF_GLOBAL CefRefPtr<CefValue> CefParseJSONAndReturnError(
const CefString& json_string,
cef_json_parser_options_t options,
cef_json_parser_error_t& error_code_out,
CefString& error_msg_out) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
@ -590,8 +589,7 @@ CEF_GLOBAL CefRefPtr<CefValue> CefParseJSONAndReturnError(
// Execute
cef_value_t* _retval = cef_parse_jsonand_return_error(
json_string.GetStruct(), options, &error_code_out,
error_msg_out.GetWritableStruct());
json_string.GetStruct(), options, error_msg_out.GetWritableStruct());
// Return type: refptr_same
return CefValueCToCpp::Wrap(_retval);

View File

@ -44,10 +44,6 @@ patches = [
{
# Support component builds (GN is_component_build=true).
# https://bitbucket.org/chromiumembedded/cef/issues/1617
#
# Export GetUnicodeCharacterFromXKeySym and XKeySymToDomKey
# to fix component builds.
# https://bitbucket.org/chromiumembedded/cef/issues/2587
'name': 'component_build',
},
{
@ -72,7 +68,7 @@ patches = [
#
# Allow customization of the WebView background color.
# https://bitbucket.org/chromiumembedded/cef/issues/2345
'name': 'webkit_popups',
'name': 'webkit_popups_and_background',
},
{
# Fix export of UnderlayOpenGLHostingWindow for 64-bit OS X builds.
@ -126,12 +122,6 @@ patches = [
# https://bitbucket.org/chromiumembedded/cef/issues/2727
'name': 'mime_handler_view_guest_1565_2727',
},
{
# Allow customization of the WebView background color.
# https://bitbucket.org/chromiumembedded/cef/issues/1161
# https://codereview.chromium.org/228603007/
'name': 'prefs_content_1161',
},
{
# Fix drag&drop of combined text and URL data on Linux/Aura.
# https://codereview.chromium.org/208313009
@ -148,12 +138,16 @@ patches = [
'name': 'ime_1610',
},
{
# Split service_manager::Main into the separate steps required by CEF.
# Split content::ContentMain into the separate steps required by CEF.
# https://bugs.chromium.org/p/chromium/issues/detail?id=654986#c17
#
# Remove DCHECK on Linux when initialized CEF from a non-main thread.
# https://bitbucket.org/chromiumembedded/cef/issue/1639
'name': 'service_manager_654986',
#
# Fix DiscardableSharedMemoryManager crash on shutdown with multi-threaded
# message loop.
# https://bitbucket.org/chromiumembedded/cef/issues/2798
'name': 'content_main_654986',
},
{
# Fix missing check for defined(ENABLE_THEMES) in
@ -201,11 +195,8 @@ patches = [
{
# Support CEF changes in chrome/browser.
#
# Linux: Fix sharesheet-related linker errors.
# https://bugs.chromium.org/p/chromium/issues/detail?id=1123388
#
# Linux: Fix ShareTarget duplicate symbols errors.
# https://bugs.chromium.org/p/chromium/issues/detail?id=1123395
# Linux: Fix duplicate symbol errors with Ozone and X11 enabled.
# https://bugs.chromium.org/p/chromium/issues/detail?id=1085700#c92
'name': 'chrome_browser',
},
{
@ -250,8 +241,8 @@ patches = [
# From chrome/browser/ui/browser_commands.cc via
# chrome/browser/printing/print_view_manager_common.h
#
# Linux: Fix sharesheet-related linker errors.
# https://bugs.chromium.org/p/chromium/issues/detail?id=1123388
# Linux: Fix duplicate symbol errors with Ozone and X11 enabled.
# https://bugs.chromium.org/p/chromium/issues/detail?id=1085700#c93
'name': 'chrome_browser_net_export',
},
{
@ -267,8 +258,7 @@ patches = [
{
# Allow CEF to share Chrome plugin loading code.
#
# Restore the BrowserPluginGuest::GetEmbedderFrame() method removed in
# https://crbug.com/533069#c43.
# Add BrowserPluginGuest::owner_web_contents() method.
'name': 'chrome_plugins',
},
{
@ -362,11 +352,6 @@ patches = [
# https://bitbucket.org/chromiumembedded/cef/issues/2274
'name': 'win_rt_2274',
},
{
# Fix DCHECK running OSRTest.DragDropUpdateCursor.
# https://bugs.chromium.org/p/chromium/issues/detail?id=781966
'name': 'webkit_pointer_event_781966',
},
{
# macOS: Fix undesirable switch to discrete GPU during startup.
# https://bitbucket.org/chromiumembedded/cef/issues/2398
@ -426,6 +411,13 @@ patches = [
# Compute correct default quota when cache_path is unspecified.
'name': 'services_network_2718',
},
{
# Restore the net::LOAD_DO_NOT_SEND_COOKIES flag to support disabling of
# cookie load/save on a per-request basis.
# Partially reverts the changes from
# https://chromium.googlesource.com/chromium/src/+/25eaa43022
'name': 'net_cookie_flags',
},
{
# Restore WebView::SetResizeBackgroundColor() that was removed.
# http://crrev.com/3955c9f9eb
@ -470,16 +462,10 @@ patches = [
{
# Remove cef_sandbox dependency on boringssl MD5/SHA1 functions.
# https://bitbucket.org/chromiumembedded/cef/issues/2743
'name': 'base_sandbox_2743',
},
{
# Fix component build error due to ContentServiceManagerMainDelegate not
# being exported.
#
# Fix DiscardableSharedMemoryManager crash on shutdown with multi-threaded
# message loop.
# https://bitbucket.org/chromiumembedded/cef/issues/2798
'name': 'content_app_shutdown_2798',
# Enable the VS 2015 Update 2 fix when building with the MSVC standard
# library.
'name': 'base_sandbox_2743',
},
{
# Add RenderWidgetHostImpl::SetCompositorForFlingScheduler to fix fling
@ -520,15 +506,15 @@ patches = [
# https://bugs.chromium.org/p/chromium/issues/detail?id=1100085
'name': 'chrome_browser_background_mode_1100085',
},
{
# Windows: Fix flickering issue with GPU rendering.
# https://bugs.chromium.org/p/chromium/issues/detail?id=1123950
'name': 'ui_gl_utils_1123950',
},
{
# Windows: Fix cef_sandbox compile error due to missing include.
# Fixed by the below change in more recent Chromium versions.
# https://bugs.chromium.org/p/chromium/issues/detail?id=1049498#c14
'name': 'base_string_piece_1049498',
},
{
# Linux: Fix Sharesheet undefined symbol error.
# https://bugs.chromium.org/p/chromium/issues/detail?id=1123388
'name': 'chrome_browser_sharesheet_1123388',
}
]

View File

@ -1,5 +1,5 @@
diff --git base/BUILD.gn base/BUILD.gn
index b2a25c8c376c..c21bc286abf7 100644
index 1d449b35bf40..0b859084ba1c 100644
--- base/BUILD.gn
+++ base/BUILD.gn
@@ -33,6 +33,7 @@ import("//build/config/ui.gni")
@ -10,7 +10,7 @@ index b2a25c8c376c..c21bc286abf7 100644
import("//testing/libfuzzer/fuzzer_test.gni")
import("//testing/test.gni")
import("//third_party/icu/config.gni")
@@ -1641,7 +1642,11 @@ component("base") {
@@ -1646,7 +1647,11 @@ component("base") {
"hash/md5_constexpr_internal.h",
"hash/sha1.h",
]
@ -23,6 +23,19 @@ index b2a25c8c376c..c21bc286abf7 100644
sources += [
"hash/md5_nacl.cc",
"hash/md5_nacl.h",
@@ -1841,6 +1846,12 @@ component("base") {
defines += [ "COM_INIT_CHECK_HOOK_DISABLED" ]
}
+ if (!use_custom_libcxx) {
+ # Enable the VS 2015 Update 2 fix when building with the MSVC standard
+ # library.
+ defines += [ "_ENABLE_ATOMIC_ALIGNMENT_FIX" ]
+ }
+
# TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
diff --git base/hash/md5.h base/hash/md5.h
index 8a49f08dcb04..2f03d7a6d1b3 100644
--- base/hash/md5.h

View File

@ -1,5 +1,5 @@
diff --git base/strings/string_piece.h base/strings/string_piece.h
index c650cfa84d59..0d6ff1ab5684 100644
index b10707d94ef9..1bfa980cbbe6 100644
--- base/strings/string_piece.h
+++ base/strings/string_piece.h
@@ -24,6 +24,7 @@

View File

@ -1,5 +1,5 @@
diff --git content/browser/renderer_host/browser_compositor_view_mac.h content/browser/renderer_host/browser_compositor_view_mac.h
index 5d8eae87ed64..427c11ceb549 100644
index 202bd7aa0d57..20067b203d96 100644
--- content/browser/renderer_host/browser_compositor_view_mac.h
+++ content/browser/renderer_host/browser_compositor_view_mac.h
@@ -58,6 +58,8 @@ class CONTENT_EXPORT BrowserCompositorMac : public DelegatedFrameHostClient,
@ -12,10 +12,10 @@ index 5d8eae87ed64..427c11ceb549 100644
// Force a new surface id to be allocated. Returns true if the
// RenderWidgetHostImpl sent the resulting surface id to the renderer.
diff --git content/browser/renderer_host/browser_compositor_view_mac.mm content/browser/renderer_host/browser_compositor_view_mac.mm
index 07e91e20d4c1..565e98f015eb 100644
index c9885b773743..dbd06e177d96 100644
--- content/browser/renderer_host/browser_compositor_view_mac.mm
+++ content/browser/renderer_host/browser_compositor_view_mac.mm
@@ -85,6 +85,12 @@ DelegatedFrameHost* BrowserCompositorMac::GetDelegatedFrameHost() {
@@ -86,6 +86,12 @@ DelegatedFrameHost* BrowserCompositorMac::GetDelegatedFrameHost() {
return delegated_frame_host_.get();
}

View File

@ -1,5 +1,5 @@
diff --git content/browser/scheduler/browser_task_executor.cc content/browser/scheduler/browser_task_executor.cc
index df3ab602e8b8..fa864443fe35 100644
index 82801d316d76..4616c1caf493 100644
--- content/browser/scheduler/browser_task_executor.cc
+++ content/browser/scheduler/browser_task_executor.cc
@@ -240,7 +240,7 @@ void BrowserTaskExecutor::PostFeatureListSetup() {
@ -10,4 +10,4 @@ index df3ab602e8b8..fa864443fe35 100644
+ if (!g_browser_task_executor || !g_browser_task_executor->ui_thread_executor_)
return;
DCHECK(g_browser_task_executor->ui_thread_executor_);
DCHECK(Get()->ui_thread_executor_);

View File

@ -1,21 +1,21 @@
diff --git content/browser/child_process_security_policy_impl.cc content/browser/child_process_security_policy_impl.cc
index 9cd1ff2b9222..2f5264de68c4 100644
index dfa87d00c03b..d04b6dd692dd 100644
--- content/browser/child_process_security_policy_impl.cc
+++ content/browser/child_process_security_policy_impl.cc
@@ -1548,6 +1548,16 @@ bool ChildProcessSecurityPolicyImpl::CanAccessDataForOrigin(
// DeclarativeApiTest.PersistRules.
if (actual_process_lock.matches_scheme(url::kDataScheme))
return true;
@@ -1680,6 +1680,16 @@ bool ChildProcessSecurityPolicyImpl::CanAccessDataForOrigin(
// DeclarativeApiTest.PersistRules.
if (actual_process_lock.matches_scheme(url::kDataScheme))
return true;
+
+ // Allow other schemes that are non-standard, non-local and WebSafe.
+ if (lock_url.is_valid() &&
+ !lock_url.IsStandard() &&
+ !base::Contains(url::GetLocalSchemes(),
+ lock_url.scheme_piece()) &&
+ base::Contains(schemes_okay_to_request_in_any_process_,
+ lock_url.scheme_piece())) {
+ return true;
+ }
}
+ // Allow other schemes that are non-standard, non-local and WebSafe.
+ if (lock_url.is_valid() &&
+ !lock_url.IsStandard() &&
+ !base::Contains(url::GetLocalSchemes(),
+ lock_url.scheme_piece()) &&
+ base::Contains(schemes_okay_to_request_in_any_process_,
+ lock_url.scheme_piece())) {
+ return true;
+ }
}
// TODO(wjmaclean): We should update the ProcessLock comparison API to
// TODO(wjmaclean): We should update the ProcessLock comparison API to

View File

@ -1,10 +1,10 @@
diff --git build/config/compiler/BUILD.gn build/config/compiler/BUILD.gn
index 8166e38ceda5..178099b1ac62 100644
index 4f6461b6b5f5..58bb48800898 100644
--- build/config/compiler/BUILD.gn
+++ build/config/compiler/BUILD.gn
@@ -1767,8 +1767,6 @@ config("thin_archive") {
@@ -1766,8 +1766,6 @@ config("thin_archive") {
# archive names to 16 characters, which is not what we want).
if ((is_posix && !is_nacl && !is_mac && !is_ios) || is_fuchsia) {
if ((is_posix && !is_nacl && !is_apple) || is_fuchsia) {
arflags = [ "-T" ]
- } else if (is_win && use_lld) {
- arflags = [ "/llvmlibthin" ]

View File

@ -1,5 +1,5 @@
diff --git chrome/browser/BUILD.gn chrome/browser/BUILD.gn
index 6cb9ee1f0764..8109a134907e 100644
index e462f7d8bef1..6c1c686f161c 100644
--- chrome/browser/BUILD.gn
+++ chrome/browser/BUILD.gn
@@ -12,6 +12,7 @@ import("//build/config/crypto.gni")
@ -10,15 +10,15 @@ index 6cb9ee1f0764..8109a134907e 100644
import("//chrome/browser/buildflags.gni")
import("//chrome/browser/downgrade/buildflags.gni")
import("//chrome/common/features.gni")
@@ -1870,6 +1871,7 @@ static_library("browser") {
@@ -1876,6 +1877,7 @@ static_library("browser") {
"//build:branding_buildflags",
"//build:lacros_buildflags",
"//build:chromeos_buildflags",
"//cc",
+ "//cef/libcef/features",
"//chrome:extra_resources",
"//chrome:resources",
"//chrome:strings",
@@ -2221,6 +2223,10 @@ static_library("browser") {
@@ -2354,6 +2356,10 @@ static_library("browser") {
]
}
@ -29,75 +29,12 @@ index 6cb9ee1f0764..8109a134907e 100644
if (is_android) {
sources += [
"after_startup_task_utils_android.cc",
@@ -3422,8 +3428,6 @@ static_library("browser") {
"nearby_sharing/outgoing_share_target_info.h",
"nearby_sharing/paired_key_verification_runner.cc",
"nearby_sharing/paired_key_verification_runner.h",
- "nearby_sharing/share_target.cc",
- "nearby_sharing/share_target.h",
"nearby_sharing/share_target_discovered_callback.h",
"nearby_sharing/share_target_info.cc",
"nearby_sharing/share_target_info.h",
@@ -3617,13 +3621,6 @@ static_library("browser") {
"serial/serial_chooser_context_factory.cc",
"serial/serial_chooser_context_factory.h",
"serial/serial_chooser_histograms.h",
- "sharesheet/sharesheet_controller.h",
- "sharesheet/sharesheet_service.cc",
- "sharesheet/sharesheet_service.h",
- "sharesheet/sharesheet_service_delegate.cc",
- "sharesheet/sharesheet_service_delegate.h",
- "sharesheet/sharesheet_service_factory.cc",
- "sharesheet/sharesheet_service_factory.h",
"sharing/click_to_call/click_to_call_context_menu_observer.cc",
"sharing/click_to_call/click_to_call_context_menu_observer.h",
"sharing/click_to_call/click_to_call_metrics.cc",
diff --git chrome/browser/ui/views/toolbar/toolbar_view.cc chrome/browser/ui/views/toolbar/toolbar_view.cc
index 7ccd06a9b0fe..183da2c7238d 100644
--- chrome/browser/ui/views/toolbar/toolbar_view.cc
+++ chrome/browser/ui/views/toolbar/toolbar_view.cc
@@ -232,8 +232,8 @@ void ToolbarView::Init() {
media_button = std::make_unique<MediaToolbarButtonView>(browser_);
}
@@ -4821,7 +4827,7 @@ static_library("browser") {
]
}
- std::unique_ptr<SharesheetButton> sharesheet_button;
#if defined(OS_CHROMEOS)
+ std::unique_ptr<SharesheetButton> sharesheet_button;
if (base::FeatureList::IsEnabled(features::kSharesheet)) {
sharesheet_button = std::make_unique<SharesheetButton>(browser_);
}
@@ -276,8 +276,10 @@ void ToolbarView::Init() {
if (media_button)
media_button_ = AddChildView(std::move(media_button));
+#if defined(OS_CHROMEOS)
if (sharesheet_button)
sharesheet_button_ = AddChildView(std::move(sharesheet_button));
+#endif
if (toolbar_account_icon_container) {
toolbar_account_icon_container_ =
@@ -966,3 +968,4 @@ void ToolbarView::OnTouchUiChanged() {
PreferredSizeChanged();
}
}
+
diff --git chrome/browser/ui/views/toolbar/toolbar_view.h chrome/browser/ui/views/toolbar/toolbar_view.h
index f4af66fa98b3..3c4d171c091e 100644
--- chrome/browser/ui/views/toolbar/toolbar_view.h
+++ chrome/browser/ui/views/toolbar/toolbar_view.h
@@ -273,7 +273,9 @@ class ToolbarView : public views::AccessiblePaneView,
media_router::CastToolbarButton* cast_ = nullptr;
ToolbarAccountIconContainerView* toolbar_account_icon_container_ = nullptr;
AvatarToolbarButton* avatar_ = nullptr;
+#if defined(OS_CHROMEOS)
SharesheetButton* sharesheet_button_ = nullptr;
+#endif
MediaToolbarButtonView* media_button_ = nullptr;
BrowserAppMenuButton* app_menu_button_ = nullptr;
@@ -302,3 +304,4 @@ class ToolbarView : public views::AccessiblePaneView,
};
#endif // CHROME_BROWSER_UI_VIEWS_TOOLBAR_TOOLBAR_VIEW_H_
+
- if (use_ozone) {
+ if (use_ozone && !use_x11) {
sources += [
"fullscreen_ozone.cc",
"media/webrtc/window_icon_util_ozone.cc",

View File

@ -1,5 +1,5 @@
diff --git chrome/browser/app_controller_mac.mm chrome/browser/app_controller_mac.mm
index 8493d1b2233b..69efa5114c6f 100644
index ce66d73e0fa4..cc62e05ba3ba 100644
--- chrome/browser/app_controller_mac.mm
+++ chrome/browser/app_controller_mac.mm
@@ -1141,6 +1141,7 @@ static base::mac::ScopedObjCClassSwizzler* g_swizzle_imk_input_session;
@ -35,10 +35,10 @@ index 8493d1b2233b..69efa5114c6f 100644
return dockMenu;
}
diff --git chrome/browser/browser_process.h chrome/browser/browser_process.h
index 132f2a8d15fd..1262f31d39db 100644
index b6fe1fee2cbb..84a75c6070d6 100644
--- chrome/browser/browser_process.h
+++ chrome/browser/browser_process.h
@@ -201,10 +201,12 @@ class BrowserProcess {
@@ -202,10 +202,12 @@ class BrowserProcess {
virtual DownloadStatusUpdater* download_status_updater() = 0;
virtual DownloadRequestLimiter* download_request_limiter() = 0;
@ -52,10 +52,10 @@ index 132f2a8d15fd..1262f31d39db 100644
// Returns the StatusTray, which provides an API for displaying status icons
// in the system status tray. Returns NULL if status icons are not supported
diff --git chrome/browser/browser_process_impl.cc chrome/browser/browser_process_impl.cc
index 254173b22652..93f0eb216cc7 100644
index 443348c2de00..7486628a9912 100644
--- chrome/browser/browser_process_impl.cc
+++ chrome/browser/browser_process_impl.cc
@@ -955,24 +955,19 @@ DownloadRequestLimiter* BrowserProcessImpl::download_request_limiter() {
@@ -951,24 +951,19 @@ DownloadRequestLimiter* BrowserProcessImpl::download_request_limiter() {
return download_request_limiter_.get();
}
@ -83,7 +83,7 @@ index 254173b22652..93f0eb216cc7 100644
StatusTray* BrowserProcessImpl::status_tray() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
diff --git chrome/browser/browser_process_impl.h chrome/browser/browser_process_impl.h
index 124ebbf06ea2..c47e6b6cf24c 100644
index 8a8d8a820690..c06d97c65ec2 100644
--- chrome/browser/browser_process_impl.h
+++ chrome/browser/browser_process_impl.h
@@ -163,9 +163,11 @@ class BrowserProcessImpl : public BrowserProcess,
@ -99,10 +99,10 @@ index 124ebbf06ea2..c47e6b6cf24c 100644
safe_browsing::SafeBrowsingService* safe_browsing_service() override;
subresource_filter::RulesetService* subresource_filter_ruleset_service()
diff --git chrome/browser/lifetime/browser_close_manager.cc chrome/browser/lifetime/browser_close_manager.cc
index d20c93b35f39..badf57a88d90 100644
index 845abd9ea9ab..29a5cfb36448 100644
--- chrome/browser/lifetime/browser_close_manager.cc
+++ chrome/browser/lifetime/browser_close_manager.cc
@@ -148,12 +148,14 @@ void BrowserCloseManager::CloseBrowsers() {
@@ -147,12 +147,14 @@ void BrowserCloseManager::CloseBrowsers() {
// exit can restore all browsers open before exiting.
ProfileManager::ShutdownSessionServices();
#endif
@ -118,10 +118,10 @@ index d20c93b35f39..badf57a88d90 100644
// Make a copy of the BrowserList to simplify the case where we need to
// destroy a Browser during the loop.
diff --git chrome/browser/sessions/session_service.cc chrome/browser/sessions/session_service.cc
index 73d97b1da62a..eec9c645366f 100644
index 1ed498e97be4..56e56b4d765a 100644
--- chrome/browser/sessions/session_service.cc
+++ chrome/browser/sessions/session_service.cc
@@ -939,12 +939,19 @@ void SessionService::MaybeDeleteSessionOnlyData() {
@@ -954,12 +954,19 @@ void SessionService::MaybeDeleteSessionOnlyData() {
if (!profile() || profile()->AsTestingProfile())
return;

View File

@ -13,7 +13,7 @@ index af2282034336..c49d920f73b5 100644
return false;
}
diff --git chrome/browser/ui/browser.cc chrome/browser/ui/browser.cc
index 71ec3bbbf1b6..10d47a4f021e 100644
index 24954ee7e0e8..2b883c5316c6 100644
--- chrome/browser/ui/browser.cc
+++ chrome/browser/ui/browser.cc
@@ -257,6 +257,20 @@
@ -37,7 +37,7 @@ index 71ec3bbbf1b6..10d47a4f021e 100644
#if BUILDFLAG(ENABLE_EXTENSIONS)
#include "chrome/browser/extensions/extension_browser_window_helper.h"
#endif
@@ -470,6 +484,13 @@ Browser::Browser(const CreateParams& params)
@@ -474,6 +488,13 @@ Browser::Browser(const CreateParams& params)
CHECK(CanCreateBrowserForProfile(profile_));
@ -51,7 +51,7 @@ index 71ec3bbbf1b6..10d47a4f021e 100644
tab_strip_model_->AddObserver(this);
location_bar_model_ = std::make_unique<LocationBarModelImpl>(
@@ -1318,6 +1339,14 @@ content::KeyboardEventProcessingResult Browser::PreHandleKeyboardEvent(
@@ -1346,6 +1367,14 @@ content::KeyboardEventProcessingResult Browser::PreHandleKeyboardEvent(
if (exclusive_access_manager_->HandleUserKeyEvent(event))
return content::KeyboardEventProcessingResult::HANDLED;
@ -66,7 +66,7 @@ index 71ec3bbbf1b6..10d47a4f021e 100644
return window()->PreHandleKeyboardEvent(event);
}
@@ -1325,8 +1354,18 @@ bool Browser::HandleKeyboardEvent(content::WebContents* source,
@@ -1353,8 +1382,18 @@ bool Browser::HandleKeyboardEvent(content::WebContents* source,
const NativeWebKeyboardEvent& event) {
DevToolsWindow* devtools_window =
DevToolsWindow::GetInstanceForInspectedWebContents(source);
@ -87,7 +87,7 @@ index 71ec3bbbf1b6..10d47a4f021e 100644
}
bool Browser::TabsNeedBeforeUnloadFired() {
@@ -1601,6 +1640,14 @@ WebContents* Browser::OpenURLFromTab(WebContents* source,
@@ -1609,6 +1648,14 @@ WebContents* Browser::OpenURLFromTab(WebContents* source,
return window->OpenURLFromTab(source, params);
}
@ -102,7 +102,7 @@ index 71ec3bbbf1b6..10d47a4f021e 100644
NavigateParams nav_params(this, params.url, params.transition);
nav_params.FillNavigateParamsFromOpenURLParams(params);
nav_params.source_contents = source;
@@ -1713,6 +1760,8 @@ void Browser::LoadingStateChanged(WebContents* source,
@@ -1721,6 +1768,8 @@ void Browser::LoadingStateChanged(WebContents* source,
bool to_different_document) {
ScheduleUIUpdate(source, content::INVALIDATE_TYPE_LOAD);
UpdateWindowForLoadingStateChanged(source, to_different_document);
@ -111,7 +111,7 @@ index 71ec3bbbf1b6..10d47a4f021e 100644
}
void Browser::CloseContents(WebContents* source) {
@@ -1740,6 +1789,8 @@ void Browser::SetContentsBounds(WebContents* source, const gfx::Rect& bounds) {
@@ -1748,6 +1797,8 @@ void Browser::SetContentsBounds(WebContents* source, const gfx::Rect& bounds) {
}
void Browser::UpdateTargetURL(WebContents* source, const GURL& url) {
@ -120,7 +120,7 @@ index 71ec3bbbf1b6..10d47a4f021e 100644
if (!GetStatusBubble())
return;
@@ -1747,6 +1798,17 @@ void Browser::UpdateTargetURL(WebContents* source, const GURL& url) {
@@ -1755,6 +1806,17 @@ void Browser::UpdateTargetURL(WebContents* source, const GURL& url) {
GetStatusBubble()->SetURL(url);
}
@ -138,7 +138,7 @@ index 71ec3bbbf1b6..10d47a4f021e 100644
void Browser::ContentsMouseEvent(WebContents* source,
bool motion,
bool exited) {
@@ -1863,6 +1925,10 @@ void Browser::WebContentsCreated(WebContents* source_contents,
@@ -1871,6 +1933,10 @@ void Browser::WebContentsCreated(WebContents* source_contents,
// Make the tab show up in the task manager.
task_manager::WebContentsTags::CreateForTabContents(new_contents);
@ -149,7 +149,7 @@ index 71ec3bbbf1b6..10d47a4f021e 100644
}
void Browser::PortalWebContentsCreated(WebContents* portal_web_contents) {
@@ -1899,6 +1965,8 @@ void Browser::RendererResponsive(
@@ -1907,6 +1973,8 @@ void Browser::RendererResponsive(
void Browser::DidNavigateMainFramePostCommit(WebContents* web_contents) {
if (web_contents == tab_strip_model_->GetActiveWebContents())
UpdateBookmarkBarState(BOOKMARK_BAR_STATE_CHANGE_TAB_STATE);
@ -158,7 +158,7 @@ index 71ec3bbbf1b6..10d47a4f021e 100644
}
content::JavaScriptDialogManager* Browser::GetJavaScriptDialogManager(
@@ -1949,11 +2017,15 @@ void Browser::EnterFullscreenModeForTab(
@@ -1957,11 +2025,15 @@ void Browser::EnterFullscreenModeForTab(
const blink::mojom::FullscreenOptions& options) {
exclusive_access_manager_->fullscreen_controller()->EnterFullscreenModeForTab(
requesting_frame, options.display_id);
@ -174,7 +174,7 @@ index 71ec3bbbf1b6..10d47a4f021e 100644
}
bool Browser::IsFullscreenForTabOrPending(const WebContents* web_contents) {
@@ -2814,6 +2886,8 @@ void Browser::SetAsDelegate(WebContents* web_contents, bool set_delegate) {
@@ -2822,6 +2894,8 @@ void Browser::SetAsDelegate(WebContents* web_contents, bool set_delegate) {
content_translate_driver->RemoveObserver(this);
BookmarkTabHelper::FromWebContents(web_contents)->RemoveObserver(this);
}
@ -184,7 +184,7 @@ index 71ec3bbbf1b6..10d47a4f021e 100644
void Browser::CloseFrame() {
diff --git chrome/browser/ui/browser.h chrome/browser/ui/browser.h
index ab2a03e6e878..aef94abf4fd8 100644
index c67b79ec647a..532bb064b080 100644
--- chrome/browser/ui/browser.h
+++ chrome/browser/ui/browser.h
@@ -21,6 +21,7 @@
@ -206,9 +206,9 @@ index ab2a03e6e878..aef94abf4fd8 100644
#if defined(OS_ANDROID)
#error This file should only be included on desktop.
#endif
@@ -241,6 +246,11 @@ class Browser : public TabStripModelObserver,
// default. Intended for testing.
BrowserWindow* window = nullptr;
@@ -247,6 +252,11 @@ class Browser : public TabStripModelObserver,
// User-set title of this browser window, if there is one.
std::string user_title;
+#if BUILDFLAG(ENABLE_CEF)
+ // Opaque CEF-specific configuration. Will be propagated to new Browsers.
@ -218,7 +218,7 @@ index ab2a03e6e878..aef94abf4fd8 100644
private:
friend class Browser;
friend class WindowSizerChromeOSTest;
@@ -358,6 +368,12 @@ class Browser : public TabStripModelObserver,
@@ -365,6 +375,12 @@ class Browser : public TabStripModelObserver,
return &signin_view_controller_;
}
@ -231,7 +231,7 @@ index ab2a03e6e878..aef94abf4fd8 100644
// Get the FindBarController for this browser, creating it if it does not
// yet exist.
FindBarController* GetFindBarController();
@@ -742,6 +758,11 @@ class Browser : public TabStripModelObserver,
@@ -755,6 +771,11 @@ class Browser : public TabStripModelObserver,
void SetContentsBounds(content::WebContents* source,
const gfx::Rect& bounds) override;
void UpdateTargetURL(content::WebContents* source, const GURL& url) override;
@ -243,7 +243,7 @@ index ab2a03e6e878..aef94abf4fd8 100644
void ContentsMouseEvent(content::WebContents* source,
bool motion,
bool exited) override;
@@ -1206,6 +1227,10 @@ class Browser : public TabStripModelObserver,
@@ -1221,6 +1242,10 @@ class Browser : public TabStripModelObserver,
extension_browser_window_helper_;
#endif
@ -255,7 +255,7 @@ index ab2a03e6e878..aef94abf4fd8 100644
// Stores the list of browser windows showing via a menu.
diff --git chrome/browser/ui/browser_navigator.cc chrome/browser/ui/browser_navigator.cc
index 6d6a3b90dcad..fbfe4a0c959c 100644
index 675dae9023fe..770a85a45f8f 100644
--- chrome/browser/ui/browser_navigator.cc
+++ chrome/browser/ui/browser_navigator.cc
@@ -435,6 +435,13 @@ std::unique_ptr<content::WebContents> CreateTargetContents(
@ -273,10 +273,10 @@ index 6d6a3b90dcad..fbfe4a0c959c 100644
// tab helpers, so the entire set of tab helpers needs to be set up
// immediately.
diff --git chrome/browser/ui/browser_tabstrip.cc chrome/browser/ui/browser_tabstrip.cc
index c8df2ade2443..0e350adda289 100644
index f5134591c3dd..8d0211b43791 100644
--- chrome/browser/ui/browser_tabstrip.cc
+++ chrome/browser/ui/browser_tabstrip.cc
@@ -28,9 +28,13 @@ void AddTabAt(Browser* browser,
@@ -30,9 +30,13 @@ void AddTabAt(Browser* browser,
// Time new tab page creation time. We keep track of the timing data in
// WebContents, but we want to include the time it takes to create the
// WebContents object too.

View File

@ -1,5 +1,5 @@
diff --git chrome/browser/content_settings/host_content_settings_map_factory.cc chrome/browser/content_settings/host_content_settings_map_factory.cc
index 3e2d1221d91e..4fbf30796bdb 100644
index f3b51e20cb9c..b479022f1d3b 100644
--- chrome/browser/content_settings/host_content_settings_map_factory.cc
+++ chrome/browser/content_settings/host_content_settings_map_factory.cc
@@ -8,6 +8,7 @@
@ -36,7 +36,7 @@ index 3e2d1221d91e..4fbf30796bdb 100644
#endif
}
@@ -98,10 +109,16 @@ scoped_refptr<RefcountedKeyedService>
@@ -97,10 +108,16 @@ scoped_refptr<RefcountedKeyedService>
std::move(allowlist_provider));
#if BUILDFLAG(ENABLE_EXTENSIONS)
@ -54,10 +54,10 @@ index 3e2d1221d91e..4fbf30796bdb 100644
#if BUILDFLAG(ENABLE_SUPERVISED_USERS)
SupervisedUserSettingsService* supervised_service =
diff --git components/content_settings/renderer/content_settings_agent_impl.cc components/content_settings/renderer/content_settings_agent_impl.cc
index 450005f9fc0b..13fca8b3e2d2 100644
index 20ae512af806..e03946e7ce80 100644
--- components/content_settings/renderer/content_settings_agent_impl.cc
+++ components/content_settings/renderer/content_settings_agent_impl.cc
@@ -183,7 +183,7 @@ ContentSetting GetContentSettingFromRulesImpl(
@@ -176,7 +176,7 @@ ContentSetting GetContentSettingFromRulesImpl(
return rule.GetContentSetting();
}
}

View File

@ -1,5 +1,5 @@
diff --git chrome/browser/ui/BUILD.gn chrome/browser/ui/BUILD.gn
index c7bd97a32af1..311f2c52af8d 100644
index bf4ca6cdccc4..1b9607765313 100644
--- chrome/browser/ui/BUILD.gn
+++ chrome/browser/ui/BUILD.gn
@@ -10,6 +10,7 @@ import("//build/config/crypto.gni")
@ -10,7 +10,7 @@ index c7bd97a32af1..311f2c52af8d 100644
import("//chrome/browser/buildflags.gni")
import("//chrome/common/features.gni")
import("//chromeos/assistant/assistant.gni")
@@ -334,6 +335,10 @@ static_library("ui") {
@@ -330,6 +331,10 @@ static_library("ui") {
"//build/config/compiler:wexit_time_destructors",
]
@ -21,7 +21,7 @@ index c7bd97a32af1..311f2c52af8d 100644
# Since browser and browser_ui actually depend on each other,
# we must omit the dependency from browser_ui to browser.
# However, this means browser_ui and browser should more or less
@@ -355,6 +360,7 @@ static_library("ui") {
@@ -351,6 +356,7 @@ static_library("ui") {
"//base/allocator:buildflags",
"//build:branding_buildflags",
"//cc/paint",
@ -29,23 +29,25 @@ index c7bd97a32af1..311f2c52af8d 100644
"//chrome:extra_resources",
"//chrome:resources",
"//chrome:strings",
@@ -1532,6 +1538,7 @@ static_library("ui") {
"//components/network_session_configurator/common",
@@ -1525,6 +1531,7 @@ static_library("ui") {
"//components/page_load_metrics/browser",
"//components/performance_manager:site_data_proto",
"//components/printing/browser",
+ "//components/printing/common:mojo_interfaces",
"//components/profile_metrics",
"//components/safety_check",
"//components/search_provider_logos",
@@ -3905,8 +3912,6 @@ static_library("ui") {
"views/toolbar/home_button.h",
"views/toolbar/reload_button.cc",
"views/toolbar/reload_button.h",
- "views/toolbar/sharesheet_button.cc",
- "views/toolbar/sharesheet_button.h",
"views/toolbar/toolbar_account_icon_container_view.cc",
"views/toolbar/toolbar_account_icon_container_view.h",
"views/toolbar/toolbar_action_view.cc",
@@ -3243,7 +3250,9 @@ static_library("ui") {
"views/frame/browser_desktop_window_tree_host_platform.h",
]
}
- sources += [ "views/frame/native_browser_frame_factory_ozone.cc" ]
+ if (!use_x11) {
+ sources += [ "views/frame/native_browser_frame_factory_ozone.cc" ]
+ }
}
if (is_desktop_linux) {
sources += [
diff --git chrome/browser/ui/webui/net_export_ui.cc chrome/browser/ui/webui/net_export_ui.cc
index f27414c41891..5ff3bfa8f724 100644
--- chrome/browser/ui/webui/net_export_ui.cc

View File

@ -1,8 +1,8 @@
diff --git chrome/browser/chrome_content_browser_client.cc chrome/browser/chrome_content_browser_client.cc
index e520e957ddea..34c402af6d35 100644
index c5c7a662232d..c1d9e8c5434d 100644
--- chrome/browser/chrome_content_browser_client.cc
+++ chrome/browser/chrome_content_browser_client.cc
@@ -1022,10 +1022,6 @@ void LaunchURL(const GURL& url,
@@ -1035,10 +1035,6 @@ void LaunchURL(const GURL& url,
}
}
@ -13,7 +13,7 @@ index e520e957ddea..34c402af6d35 100644
void MaybeAppendSecureOriginsAllowlistSwitch(base::CommandLine* cmdline) {
// |allowlist| combines pref/policy + cmdline switch in the browser process.
// For renderer and utility (e.g. NetworkService) processes the switch is the
@@ -1204,6 +1200,14 @@ const blink::UserAgentBrandList& GetBrandVersionList() {
@@ -1217,6 +1213,14 @@ const blink::UserAgentBrandList& GetBrandVersionList() {
return *greased_brand_version_list;
}
@ -29,10 +29,10 @@ index e520e957ddea..34c402af6d35 100644
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
if (command_line->HasSwitch(switches::kUserAgent)) {
diff --git chrome/browser/chrome_content_browser_client.h chrome/browser/chrome_content_browser_client.h
index a47818dc2f0f..08148534aeea 100644
index ef7da4343581..93ad5e8b1d9b 100644
--- chrome/browser/chrome_content_browser_client.h
+++ chrome/browser/chrome_content_browser_client.h
@@ -91,7 +91,8 @@ class ChromeXrIntegrationClient;
@@ -98,7 +98,8 @@ class ChromeXrIntegrationClient;
}
#endif

View File

@ -1,8 +1,8 @@
diff --git chrome/browser/profiles/profile_manager.cc chrome/browser/profiles/profile_manager.cc
index 9b9335369a4f..fea76956bd41 100644
index 670a33244287..9c13775f385d 100644
--- chrome/browser/profiles/profile_manager.cc
+++ chrome/browser/profiles/profile_manager.cc
@@ -374,7 +374,7 @@ ProfileManager::ProfileManager(const base::FilePath& user_data_dir)
@@ -373,7 +373,7 @@ ProfileManager::ProfileManager(const base::FilePath& user_data_dir)
registrar_.Add(this, chrome::NOTIFICATION_BROWSER_CLOSE_CANCELLED,
content::NotificationService::AllSources());
@ -12,10 +12,10 @@ index 9b9335369a4f..fea76956bd41 100644
}
diff --git chrome/browser/profiles/profile_manager.h chrome/browser/profiles/profile_manager.h
index 93571e419253..bc77bebce943 100644
index 8d0793739a72..8f5097889fcb 100644
--- chrome/browser/profiles/profile_manager.h
+++ chrome/browser/profiles/profile_manager.h
@@ -101,7 +101,7 @@ class ProfileManager : public content::NotificationObserver,
@@ -99,7 +99,7 @@ class ProfileManager : public content::NotificationObserver,
// acceptable. Returns null if creation of the new profile fails.
// TODO(bauerb): Migrate calls from other code to GetProfileByPath(), then
// make this method private.
@ -24,7 +24,7 @@ index 93571e419253..bc77bebce943 100644
// Returns regular or off-the-record profile given its profile key.
static Profile* GetProfileFromProfileKey(ProfileKey* profile_key);
@@ -134,7 +134,7 @@ class ProfileManager : public content::NotificationObserver,
@@ -132,7 +132,7 @@ class ProfileManager : public content::NotificationObserver,
// Returns true if the profile pointer is known to point to an existing
// profile.
@ -33,7 +33,7 @@ index 93571e419253..bc77bebce943 100644
// Returns the directory where the first created profile is stored,
// relative to the user data directory currently in use.
@@ -143,7 +143,7 @@ class ProfileManager : public content::NotificationObserver,
@@ -141,7 +141,7 @@ class ProfileManager : public content::NotificationObserver,
// Get the Profile last used (the Profile to which owns the most recently
// focused window) with this Chrome build. If no signed profile has been
// stored in Local State, hand back the Default profile.

Some files were not shown because too many files have changed in this diff Show More