Commit 2d6e80e8 authored by Santosh Mahto's avatar Santosh Mahto
Browse files

Enable ozone build

parent 2e39487a
...@@ -46,5 +46,6 @@ Thumbs.db ...@@ -46,5 +46,6 @@ Thumbs.db
/binary_distrib /binary_distrib
/docs /docs
# CEF generated files # CEF generated files
/include/cef_config.h
/include/cef_version.h /include/cef_version.h
.ccls-cache/ .ccls-cache/
\ No newline at end of file
...@@ -196,10 +196,13 @@ gypi_paths2 = exec_script("//cef/tools/gypi_to_gn.py", ...@@ -196,10 +196,13 @@ gypi_paths2 = exec_script("//cef/tools/gypi_to_gn.py",
group("cef") { group("cef") {
testonly = true testonly = true
deps = [ deps = [
":cefclient",
":cefsimple", ":cefsimple",
":ceftests", ":ceftests",
] ]
if (!is_linux || use_x11) {
deps += [ ":cefclient" ]
}
} }
...@@ -781,10 +784,15 @@ static_library("libcef_static") { ...@@ -781,10 +784,15 @@ static_library("libcef_static") {
"libcef/browser/osr/render_widget_host_view_osr_linux.cc", "libcef/browser/osr/render_widget_host_view_osr_linux.cc",
"libcef/browser/printing/print_dialog_linux.cc", "libcef/browser/printing/print_dialog_linux.cc",
"libcef/browser/printing/print_dialog_linux.h", "libcef/browser/printing/print_dialog_linux.h",
"libcef/browser/native/window_x11.cc",
"libcef/browser/native/window_x11.h",
] ]
if (use_x11) {
sources += [
"libcef/browser/native/window_x11.cc",
"libcef/browser/native/window_x11.h",
]
}
deps += [ deps += [
"//build/config/freetype", "//build/config/freetype",
"//third_party/fontconfig", "//third_party/fontconfig",
...@@ -906,6 +914,15 @@ static_library("libcef_static") { ...@@ -906,6 +914,15 @@ static_library("libcef_static") {
"//ui/aura/test/ui_controls_factory_aura.h", "//ui/aura/test/ui_controls_factory_aura.h",
] ]
if (is_linux && !use_x11) {
sources += [
"//ui/aura/test/mus/window_tree_client_test_api.h",
"//ui/aura/test/mus/window_tree_client_test_api.cc",
"//ui/aura/test/ui_controls_factory_ozone.cc",
"//ui/events/test/events_test_utils.cc"
]
}
deps += [ deps += [
"//ui/aura", "//ui/aura",
"//ui/events", "//ui/events",
...@@ -943,16 +960,23 @@ static_library("libcef_static") { ...@@ -943,16 +960,23 @@ static_library("libcef_static") {
# Part of //ui/aura:test_support which is testingonly. # Part of //ui/aura:test_support which is testingonly.
"//ui/aura/test/aura_test_utils.cc", "//ui/aura/test/aura_test_utils.cc",
"//ui/aura/test/aura_test_utils.h", "//ui/aura/test/aura_test_utils.h",
"//ui/aura/test/ui_controls_factory_aurax11.cc",
"//ui/aura/test/x11_event_sender.cc",
"//ui/aura/test/x11_event_sender.h",
# Part of //ui/events:test_support which is testingonly. # Part of //ui/events:test_support which is testingonly.
"//ui/events/test/platform_event_waiter.cc", "//ui/events/test/platform_event_waiter.cc",
"//ui/events/test/platform_event_waiter.h", "//ui/events/test/platform_event_waiter.h",
# Part of //ui/views:test_support which is testingonly.
"//ui/views/test/ui_controls_factory_desktop_aurax11.cc",
"//ui/views/test/ui_controls_factory_desktop_aurax11.h",
] ]
if (use_x11) {
sources += [
# Support for UI input events.
# Part of //ui/aura:test_support which is testingonly.
"//ui/aura/test/ui_controls_factory_aurax11.cc",
"//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",
"//ui/views/test/ui_controls_factory_desktop_aurax11.h",
]
}
} }
} else { } else {
sources += [ sources += [
...@@ -1964,6 +1988,12 @@ if (is_mac) { ...@@ -1964,6 +1988,12 @@ if (is_mac) {
# The cefclient target depends on packages that are not available in the # The cefclient target depends on packages that are not available in the
# default sysroot environment. # default sysroot environment.
if (is_linux && !use_sysroot) { if (is_linux && !use_sysroot) {
pkg_config("glib") {
packages = [
"glib-2.0",
]
}
pkg_config("gtk") { pkg_config("gtk") {
packages = [ packages = [
"gmodule-2.0", "gmodule-2.0",
...@@ -2123,9 +2153,11 @@ if (is_mac) { ...@@ -2123,9 +2153,11 @@ if (is_mac) {
sources += gypi_paths2.includes_linux + sources += gypi_paths2.includes_linux +
gypi_paths2.cefsimple_sources_linux gypi_paths2.cefsimple_sources_linux
libs = [ if (use_x11) {
"X11", libs = [
] "X11",
]
}
if (!is_component_build) { if (!is_component_build) {
# Set rpath to find our own libfreetype even in a non-component build. # Set rpath to find our own libfreetype even in a non-component build.
...@@ -2182,9 +2214,15 @@ if (is_mac) { ...@@ -2182,9 +2214,15 @@ if (is_mac) {
sources += gypi_paths2.shared_sources_linux + sources += gypi_paths2.shared_sources_linux +
gypi_paths2.ceftests_sources_linux gypi_paths2.ceftests_sources_linux
libs = [ if (use_x11) {
"X11", libs = [
] "X11",
]
} else {
if (!use_sysroot) {
configs += [ ":glib" ]
}
}
deps += [ deps += [
":copy_ceftests_files", ":copy_ceftests_files",
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
'include/base/internal/cef_thread_checker_impl.h', 'include/base/internal/cef_thread_checker_impl.h',
'include/cef_api_hash.h', 'include/cef_api_hash.h',
'include/cef_base.h', 'include/cef_base.h',
'include/cef_config.h',
'include/cef_version.h', 'include/cef_version.h',
'include/internal/cef_export.h', 'include/internal/cef_export.h',
'include/internal/cef_logging_internal.h', 'include/internal/cef_logging_internal.h',
......
...@@ -32,18 +32,27 @@ ...@@ -32,18 +32,27 @@
#pragma once #pragma once
#include "include/base/cef_build.h" #include "include/base/cef_build.h"
#include "include/cef_config.h"
#if defined(OS_LINUX) #if defined(OS_LINUX)
#if defined(CEF_X11)
typedef union _XEvent XEvent; typedef union _XEvent XEvent;
typedef struct _XDisplay XDisplay; typedef struct _XDisplay XDisplay;
#endif
#include "include/internal/cef_export.h" #include "include/internal/cef_export.h"
#include "include/internal/cef_string.h" #include "include/internal/cef_string.h"
// Handle types. // Handle types.
#if defined(CEF_X11)
#define cef_cursor_handle_t unsigned long #define cef_cursor_handle_t unsigned long
#define cef_event_handle_t XEvent* #define cef_event_handle_t XEvent*
#else
#define cef_cursor_handle_t void*
#define cef_event_handle_t void*
#endif
#define cef_window_handle_t unsigned long #define cef_window_handle_t unsigned long
#define kNullCursorHandle 0 #define kNullCursorHandle 0
...@@ -58,7 +67,9 @@ extern "C" { ...@@ -58,7 +67,9 @@ extern "C" {
// Return the singleton X11 display shared with Chromium. The display is not // Return the singleton X11 display shared with Chromium. The display is not
// thread-safe and must only be accessed on the browser process UI thread. // thread-safe and must only be accessed on the browser process UI thread.
/// ///
#if defined(CEF_X11)
CEF_EXPORT XDisplay* cef_get_xdisplay(); CEF_EXPORT XDisplay* cef_get_xdisplay();
#endif
/// ///
// Structure representing CefExecuteProcess arguments. // Structure representing CefExecuteProcess arguments.
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include "libcef/browser/context.h" #include "libcef/browser/context.h"
#include "libcef/browser/native/menu_runner_linux.h" #include "libcef/browser/native/menu_runner_linux.h"
#include "libcef/browser/native/window_delegate_view.h" #include "libcef/browser/native/window_delegate_view.h"
#include "libcef/browser/native/window_x11.h"
#include "libcef/browser/thread_util.h" #include "libcef/browser/thread_util.h"
#include "base/no_destructor.h" #include "base/no_destructor.h"
...@@ -23,10 +22,14 @@ ...@@ -23,10 +22,14 @@
#include "ui/events/keycodes/keyboard_code_conversion_xkb.h" #include "ui/events/keycodes/keyboard_code_conversion_xkb.h"
#include "ui/events/keycodes/keysym_to_unicode.h" #include "ui/events/keycodes/keysym_to_unicode.h"
#include "ui/gfx/font_render_params.h" #include "ui/gfx/font_render_params.h"
#include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h"
#include "ui/views/widget/widget.h" #include "ui/views/widget/widget.h"
#include "third_party/blink/public/mojom/renderer_preferences.mojom.h" #include "third_party/blink/public/mojom/renderer_preferences.mojom.h"
#if defined(USE_X11)
#include "libcef/browser/native/window_x11.h"
#include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h"
#endif
namespace { namespace {
// Returns the number of seconds since system boot. // Returns the number of seconds since system boot.
...@@ -48,8 +51,7 @@ CefBrowserPlatformDelegateNativeLinux::CefBrowserPlatformDelegateNativeLinux( ...@@ -48,8 +51,7 @@ CefBrowserPlatformDelegateNativeLinux::CefBrowserPlatformDelegateNativeLinux(
false, false,
use_external_begin_frame), use_external_begin_frame),
host_window_created_(false), host_window_created_(false),
window_widget_(nullptr), window_widget_(nullptr) {}
window_x11_(nullptr) {}
void CefBrowserPlatformDelegateNativeLinux::BrowserDestroyed( void CefBrowserPlatformDelegateNativeLinux::BrowserDestroyed(
CefBrowserHostImpl* browser) { CefBrowserHostImpl* browser) {
...@@ -62,7 +64,6 @@ void CefBrowserPlatformDelegateNativeLinux::BrowserDestroyed( ...@@ -62,7 +64,6 @@ void CefBrowserPlatformDelegateNativeLinux::BrowserDestroyed(
} }
bool CefBrowserPlatformDelegateNativeLinux::CreateHostWindow() { bool CefBrowserPlatformDelegateNativeLinux::CreateHostWindow() {
DCHECK(!window_x11_);
DCHECK(!window_widget_); DCHECK(!window_widget_);
if (window_info_.width == 0) if (window_info_.width == 0)
...@@ -73,6 +74,8 @@ bool CefBrowserPlatformDelegateNativeLinux::CreateHostWindow() { ...@@ -73,6 +74,8 @@ bool CefBrowserPlatformDelegateNativeLinux::CreateHostWindow() {
gfx::Rect rect(window_info_.x, window_info_.y, window_info_.width, gfx::Rect rect(window_info_.x, window_info_.y, window_info_.width,
window_info_.height); window_info_.height);
#if defined(USE_X11)
DCHECK(!window_x11_);
// Create a new window object. It will delete itself when the associated X11 // Create a new window object. It will delete itself when the associated X11
// window is destroyed. // window is destroyed.
window_x11_ = new CefWindowX11(browser_, window_info_.parent_window, rect, window_x11_ = new CefWindowX11(browser_, window_info_.parent_window, rect,
...@@ -93,6 +96,7 @@ bool CefBrowserPlatformDelegateNativeLinux::CreateHostWindow() { ...@@ -93,6 +96,7 @@ bool CefBrowserPlatformDelegateNativeLinux::CreateHostWindow() {
window_widget_->Show(); window_widget_->Show();
window_x11_->Show(); window_x11_->Show();
#endif // defined(USE_X11)
// As an additional requirement on Linux, we must set the colors for the // As an additional requirement on Linux, we must set the colors for the
// render widgets in webkit. // render widgets in webkit.
...@@ -121,8 +125,10 @@ bool CefBrowserPlatformDelegateNativeLinux::CreateHostWindow() { ...@@ -121,8 +125,10 @@ bool CefBrowserPlatformDelegateNativeLinux::CreateHostWindow() {
} }
void CefBrowserPlatformDelegateNativeLinux::CloseHostWindow() { void CefBrowserPlatformDelegateNativeLinux::CloseHostWindow() {
#if defined(USE_X11)
if (window_x11_) if (window_x11_)
window_x11_->Close(); window_x11_->Close();
#endif
} }
CefWindowHandle CefBrowserPlatformDelegateNativeLinux::GetHostWindowHandle() CefWindowHandle CefBrowserPlatformDelegateNativeLinux::GetHostWindowHandle()
...@@ -146,18 +152,21 @@ void CefBrowserPlatformDelegateNativeLinux::SendFocusEvent(bool setFocus) { ...@@ -146,18 +152,21 @@ void CefBrowserPlatformDelegateNativeLinux::SendFocusEvent(bool setFocus) {
browser_->web_contents()->Focus(); browser_->web_contents()->Focus();
} }
#if defined(USE_X11)
if (window_x11_) { if (window_x11_) {
// Give native focus to the DesktopNativeWidgetAura for the root window. // Give native focus to the DesktopNativeWidgetAura for the root window.
// Needs to be done via the ::Window so that keyboard focus is assigned // Needs to be done via the ::Window so that keyboard focus is assigned
// correctly. // correctly.
window_x11_->Focus(); window_x11_->Focus();
} }
#endif // defined(USE_X11)
} }
void CefBrowserPlatformDelegateNativeLinux::NotifyMoveOrResizeStarted() { void CefBrowserPlatformDelegateNativeLinux::NotifyMoveOrResizeStarted() {
// Call the parent method to dismiss any existing popups. // Call the parent method to dismiss any existing popups.
CefBrowserPlatformDelegate::NotifyMoveOrResizeStarted(); CefBrowserPlatformDelegate::NotifyMoveOrResizeStarted();
#if defined(USE_X11)
if (!window_x11_) if (!window_x11_)
return; return;
...@@ -175,13 +184,16 @@ void CefBrowserPlatformDelegateNativeLinux::NotifyMoveOrResizeStarted() { ...@@ -175,13 +184,16 @@ void CefBrowserPlatformDelegateNativeLinux::NotifyMoveOrResizeStarted() {
content::RenderWidgetHostImpl::From( content::RenderWidgetHostImpl::From(
browser_->web_contents()->GetRenderViewHost()->GetWidget()) browser_->web_contents()->GetRenderViewHost()->GetWidget())
->SendScreenRects(); ->SendScreenRects();
#endif // defined(USE_X11)
} }
void CefBrowserPlatformDelegateNativeLinux::SizeTo(int width, int height) { void CefBrowserPlatformDelegateNativeLinux::SizeTo(int width, int height) {
#if defined(USE_X11)
if (window_x11_) { if (window_x11_) {
window_x11_->SetBounds( window_x11_->SetBounds(
gfx::Rect(window_x11_->bounds().origin(), gfx::Size(width, height))); gfx::Rect(window_x11_->bounds().origin(), gfx::Size(width, height)));
} }
#endif // defined(USE_X11)
} }
gfx::Point CefBrowserPlatformDelegateNativeLinux::GetScreenPoint( gfx::Point CefBrowserPlatformDelegateNativeLinux::GetScreenPoint(
...@@ -189,6 +201,7 @@ gfx::Point CefBrowserPlatformDelegateNativeLinux::GetScreenPoint( ...@@ -189,6 +201,7 @@ gfx::Point CefBrowserPlatformDelegateNativeLinux::GetScreenPoint(
if (windowless_handler_) if (windowless_handler_)
return windowless_handler_->GetParentScreenPoint(view); return windowless_handler_->GetParentScreenPoint(view);
#if defined(USE_X11)
if (!window_x11_) if (!window_x11_)
return view; return view;
...@@ -198,6 +211,8 @@ gfx::Point CefBrowserPlatformDelegateNativeLinux::GetScreenPoint( ...@@ -198,6 +211,8 @@ gfx::Point CefBrowserPlatformDelegateNativeLinux::GetScreenPoint(
const gfx::Rect& bounds_in_screen = window_x11_->GetBoundsInScreen(); const gfx::Rect& bounds_in_screen = window_x11_->GetBoundsInScreen();
return gfx::Point(bounds_in_screen.x() + view.x(), return gfx::Point(bounds_in_screen.x() + view.x(),
bounds_in_screen.y() + view.y()); bounds_in_screen.y() + view.y());
#endif // defined(USE_X11)
return gfx::Point();
} }
void CefBrowserPlatformDelegateNativeLinux::ViewText(const std::string& text) { void CefBrowserPlatformDelegateNativeLinux::ViewText(const std::string& text) {
...@@ -260,6 +275,7 @@ void CefBrowserPlatformDelegateNativeLinux::TranslateKeyEvent( ...@@ -260,6 +275,7 @@ void CefBrowserPlatformDelegateNativeLinux::TranslateKeyEvent(
NOTREACHED(); NOTREACHED();
} }
#if defined(USE_X11)
// Populate DOM values that will be passed to JavaScript handlers via // Populate DOM values that will be passed to JavaScript handlers via
// KeyboardEvent. // KeyboardEvent.
result.dom_code = static_cast<int>( result.dom_code = static_cast<int>(
...@@ -275,6 +291,7 @@ void CefBrowserPlatformDelegateNativeLinux::TranslateKeyEvent( ...@@ -275,6 +291,7 @@ void CefBrowserPlatformDelegateNativeLinux::TranslateKeyEvent(
result.SetModifiers(result.GetModifiers() | result.SetModifiers(result.GetModifiers() |
TranslateModifiers(key_event.modifiers)); TranslateModifiers(key_event.modifiers));
#endif // defined(USE_X11)
} }
void CefBrowserPlatformDelegateNativeLinux::TranslateClickEvent( void CefBrowserPlatformDelegateNativeLinux::TranslateClickEvent(
...@@ -363,7 +380,8 @@ CefEventHandle CefBrowserPlatformDelegateNativeLinux::GetEventHandle( ...@@ -363,7 +380,8 @@ CefEventHandle CefBrowserPlatformDelegateNativeLinux::GetEventHandle(
const content::NativeWebKeyboardEvent& event) const { const content::NativeWebKeyboardEvent& event) const {
if (!event.os_event) if (!event.os_event)
return NULL; return NULL;
return const_cast<CefEventHandle>(event.os_event->native_event()); return const_cast<CefEventHandle>(
static_cast<CefEventHandle>(event.os_event->native_event()));
} }
std::unique_ptr<CefMenuRunner> std::unique_ptr<CefMenuRunner>
......
...@@ -7,7 +7,9 @@ ...@@ -7,7 +7,9 @@
#include "libcef/browser/native/browser_platform_delegate_native.h" #include "libcef/browser/native/browser_platform_delegate_native.h"
#if defined(USE_X11)
class CefWindowX11; class CefWindowX11;
#endif
// Windowed browser implementation for Linux. // Windowed browser implementation for Linux.
class CefBrowserPlatformDelegateNativeLinux class CefBrowserPlatformDelegateNativeLinux
...@@ -60,7 +62,9 @@ class CefBrowserPlatformDelegateNativeLinux ...@@ -60,7 +62,9 @@ class CefBrowserPlatformDelegateNativeLinux
// associated root window is destroyed. // associated root window is destroyed.
views::Widget* window_widget_; views::Widget* window_widget_;
CefWindowX11* window_x11_; #if defined(USE_X11)
CefWindowX11* window_x11_ = nullptr;
#endif
}; };
#endif // CEF_LIBCEF_BROWSER_NATIVE_BROWSER_PLATFORM_DELEGATE_NATIVE_LINUX_H_ #endif // CEF_LIBCEF_BROWSER_NATIVE_BROWSER_PLATFORM_DELEGATE_NATIVE_LINUX_H_
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
#include <utility> #include <utility>
#include "libcef/browser/browser_host_impl.h"
#include "libcef/browser/osr/osr_util.h" #include "libcef/browser/osr/osr_util.h"
#include "libcef/browser/osr/software_output_device_osr.h" #include "libcef/browser/osr/software_output_device_osr.h"
#include "libcef/browser/osr/synthetic_gesture_target_osr.h" #include "libcef/browser/osr/synthetic_gesture_target_osr.h"
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include "include/cef_base.h" #include "include/cef_base.h"
#include "include/cef_browser.h" #include "include/cef_browser.h"
#include "libcef/browser/browser_host_impl.h"
#include "libcef/browser/osr/motion_event_osr.h" #include "libcef/browser/osr/motion_event_osr.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
...@@ -60,7 +60,6 @@ class CursorManager; ...@@ -60,7 +60,6 @@ class CursorManager;
} // namespace content } // namespace content
class CefBeginFrameTimer; class CefBeginFrameTimer;
class CefBrowserHostImpl;
class CefCopyFrameGenerator; class CefCopyFrameGenerator;
class CefSoftwareOutputDeviceOSR; class CefSoftwareOutputDeviceOSR;
class CefWebContentsViewOSR; class CefWebContentsViewOSR;
......
...@@ -5,16 +5,20 @@ ...@@ -5,16 +5,20 @@
#include "libcef/browser/osr/render_widget_host_view_osr.h" #include "libcef/browser/osr/render_widget_host_view_osr.h"
#include "third_party/blink/public/platform/web_cursor_info.h"
#if defined(USE_X11)
#include <X11/Xlib.h> #include <X11/Xlib.h>
#include <X11/cursorfont.h> #include <X11/cursorfont.h>
#undef Status // Avoid conflicts with url_request_status.h #undef Status // Avoid conflicts with url_request_status.h
#include "libcef/browser/native/window_x11.h" #include "libcef/browser/native/window_x11.h"
#include "third_party/blink/public/platform/web_cursor_info.h"
#include "ui/base/x/x11_util.h" #include "ui/base/x/x11_util.h"
#include "ui/gfx/x/x11_types.h" #include "ui/gfx/x/x11_types.h"
#endif // defined(USE_X11)
#if defined(USE_X11)
namespace { namespace {
// Based on ui/base/cursor/cursor_loader_x11.cc. // Based on ui/base/cursor/cursor_loader_x11.cc.
...@@ -163,25 +167,31 @@ XCursorCache* cursor_cache = nullptr; ...@@ -163,25 +167,31 @@ XCursorCache* cursor_cache = nullptr;
} }
} // namespace } // namespace
#endif // defined(USE_X11)
void CefRenderWidgetHostViewOSR::PlatformCreateCompositorWidget( void CefRenderWidgetHostViewOSR::PlatformCreateCompositorWidget(
bool is_guest_view_hack) { bool is_guest_view_hack) {
#if defined(USE_X11)
// Create a hidden 1x1 window. It will delete itself on close. // Create a hidden 1x1 window. It will delete itself on close.
window_ = new CefWindowX11(NULL, None, gfx::Rect(0, 0, 1, 1), ""); window_ = new CefWindowX11(NULL, None, gfx::Rect(0, 0, 1, 1), "");
compositor_widget_ = window_->xwindow(); compositor_widget_ = window_->xwindow();
#endif
} }
void CefRenderWidgetHostViewOSR::PlatformResizeCompositorWidget( void CefRenderWidgetHostViewOSR::PlatformResizeCompositorWidget(
const gfx::Size&) {} const gfx::Size&) {}
void CefRenderWidgetHostViewOSR::PlatformDestroyCompositorWidget() { void CefRenderWidgetHostViewOSR::PlatformDestroyCompositorWidget() {
#if defined(USE_X11)
DCHECK(window_); DCHECK(window_);
window_->Close(); window_->Close();
#endif
compositor_widget_ = gfx::kNullAcceleratedWidget; compositor_widget_ = gfx::kNullAcceleratedWidget;
} }
ui::PlatformCursor CefRenderWidgetHostViewOSR::GetPlatformCursor(