Commit 8fb21ef4 authored by Santosh Mahto's avatar Santosh Mahto Committed by Santosh Mahto
Browse files

Enable setting surface id with setIVISurfaceID.

setIVISurfaceID allows CEF to set id of surface from client.

fixup! fix malformed paths in patch

Adjust patch.
parent 0c10186c
......@@ -169,6 +169,12 @@ typedef struct _cef_window_t {
// The resulting string must be freed by calling cef_string_userfree_free().
cef_string_userfree_t(CEF_CALLBACK* get_title)(struct _cef_window_t* self);
///
// Set LayerManagerSurface ID
///
void (CEF_CALLBACK *set_ivi_surface_id)(struct _cef_window_t* self,
uint32_t layer_manager_id);
///
// Set the Window icon. This should be a 16x16 icon suitable for use in the
// Windows's title bar.
......
......@@ -183,6 +183,12 @@ class CefWindow : public CefPanel {
/*--cef()--*/
virtual CefString GetTitle() = 0;
///
// Set LayerManagerSurface ID
///
/*--cef()--*/
virtual void SetIVISurfaceID(const uint32_t id) =0;
///
// Set the Window icon. This should be a 16x16 icon suitable for use in the
// Windows's title bar.
......
......@@ -250,6 +250,13 @@ CefString CefWindowImpl::GetTitle() {
return CefString();
}
void CefWindowImpl::SetIVISurfaceID(const uint32_t id) {
#if defined(USE_IVI)
if (widget_)
widget_->SetIVISurfaceID(id);
#endif
}
void CefWindowImpl::SetWindowIcon(CefRefPtr<CefImage> image) {
CEF_REQUIRE_VALID_RETURN_VOID();
if (root_view())
......
......@@ -80,6 +80,8 @@ class CefWindowImpl
void RemoveAccelerator(int command_id) override;
void RemoveAllAccelerators() override;
void SetIVISurfaceID(const uint32_t id) override;
// CefViewAdapter methods:
void Detach() override;
......
......@@ -345,6 +345,19 @@ window_get_title(struct _cef_window_t* self) {
return _retval.DetachToUserFree();
}
void CEF_CALLBACK window_set_ivi_surface_id(
struct _cef_window_t* self, uint32_t id) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
DCHECK(self);
if (!self)
return;
// Execute
CefWindowCppToC::Get(self)->SetIVISurfaceID(
id);
}
void CEF_CALLBACK window_set_window_icon(struct _cef_window_t* self,
cef_image_t* image) {
shutdown_checker::AssertNotShutdown();
......@@ -1794,6 +1807,8 @@ CefWindowCppToC::CefWindowCppToC() {
GetStruct()->is_fullscreen = window_is_fullscreen;
GetStruct()->set_title = window_set_title;
GetStruct()->get_title = window_get_title;
GetStruct()->set_ivi_surface_id =
window_set_ivi_surface_id;
GetStruct()->set_window_icon = window_set_window_icon;
GetStruct()->get_window_icon = window_get_window_icon;
GetStruct()->set_window_app_icon = window_set_window_app_icon;
......
......@@ -337,6 +337,21 @@ NO_SANITIZE("cfi-icall") CefString CefWindowCToCpp::GetTitle() {
return _retvalStr;
}
NO_SANITIZE("cfi-icall") void CefWindowCToCpp::SetIVISurfaceID(
const uint32_t id) {
cef_window_t* _struct = GetStruct();
if (CEF_MEMBER_MISSING(_struct, set_ivi_surface_id))
return;
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
// Execute
_struct->set_ivi_surface_id(_struct,
id);
}
NO_SANITIZE("cfi-icall")
void CefWindowCToCpp::SetWindowIcon(CefRefPtr<CefImage> image) {
shutdown_checker::AssertNotShutdown();
......
......@@ -54,6 +54,7 @@ class CefWindowCToCpp
bool IsFullscreen() OVERRIDE;
void SetTitle(const CefString& title) OVERRIDE;
CefString GetTitle() OVERRIDE;
void SetIVISurfaceID(const uint32_t id) OVERRIDE;
void SetWindowIcon(CefRefPtr<CefImage> image) OVERRIDE;
CefRefPtr<CefImage> GetWindowIcon() OVERRIDE;
void SetWindowAppIcon(CefRefPtr<CefImage> image) OVERRIDE;
......
......@@ -468,4 +468,8 @@ patches = [
# https://bitbucket.org/chromiumembedded/cef/issues/2745
'name': 'osr_fling_2745',
},
{
# Collabora: Allow setting surface id.
'name': 'setIVISurfaceID',
}
]
diff --git build/config/BUILD.gn build/config/BUILD.gn
index 6a6b8f8a45de..d17128dd46ce 100644
--- build/config/BUILD.gn
+++ build/config/BUILD.gn
@@ -88,6 +88,10 @@ config("feature_flags") {
# TODO(crbug.com/837032): Maybe this can be cleaned up if we can avoid
# setting use_ozone globally.
defines += [ "USE_OZONE=1" ]
+ if (use_ivi) {
+ defines += [ "USE_IVI=1" ]
+ }
+
}
if (use_x11) {
defines += [ "USE_X11=1" ]
diff --git build/config/ui.gni build/config/ui.gni
index 0eae3470e1bb..b8e698f04154 100644
--- build/config/ui.gni
+++ build/config/ui.gni
@@ -31,6 +31,9 @@ declare_args() {
# Whether we should use glib, a low level C utility library.
use_glib = is_linux
+
+ # Whether IVI integration is enabled.
+ use_ivi = false
}
declare_args() {
diff --git ui/ozone/platform/wayland/host/wayland_window.cc ui/ozone/platform/wayland/host/wayland_window.cc
index 98fe563504b4..4c34e046db2a 100644
--- ui/ozone/platform/wayland/host/wayland_window.cc
+++ ui/ozone/platform/wayland/host/wayland_window.cc
@@ -88,7 +88,8 @@ WaylandWindow::WaylandWindow(PlatformWindowDelegate* delegate,
connection_(connection),
xdg_shell_objects_factory_(new XDGShellObjectFactory()),
state_(PlatformWindowState::PLATFORM_WINDOW_STATE_NORMAL),
- pending_state_(PlatformWindowState::PLATFORM_WINDOW_STATE_UNKNOWN) {
+ pending_state_(PlatformWindowState::PLATFORM_WINDOW_STATE_UNKNOWN),
+ ivi_surface_id_(0) {
// Set a class property key, which allows |this| to be used for interactive
// events, e.g. move or resize.
SetWmMoveResizeHandler(this, AsWmMoveResizeHandler());
@@ -891,4 +892,12 @@ void WaylandWindow::Leave(void* data,
}
}
+#if defined(USE_IVI)
+void WaylandWindow::SetIVISurfaceID(const unsigned int id) {
+ ivi_surface_id_ = id;
+ xdg_surface_->SetAppID(ivi_surface_id_);
+ LOG(INFO) << "IVI app id : " << ivi_surface_id_;
+}
+#endif
+
} // namespace ui
diff --git ui/ozone/platform/wayland/host/wayland_window.h ui/ozone/platform/wayland/host/wayland_window.h
index 94c3a60c0e96..1d79aea32f3f 100644
--- ui/ozone/platform/wayland/host/wayland_window.h
+++ ui/ozone/platform/wayland/host/wayland_window.h
@@ -125,6 +125,10 @@ class WaylandWindow : public PlatformWindow,
void SetRestoredBoundsInPixels(const gfx::Rect& bounds) override;
gfx::Rect GetRestoredBoundsInPixels() const override;
+#if defined(USE_IVI)
+ void SetIVISurfaceID(const unsigned int id) override;
+#endif
+
// PlatformEventDispatcher
bool CanDispatchEvent(const PlatformEvent& event) override;
uint32_t DispatchEvent(const PlatformEvent& event) override;
@@ -239,6 +243,7 @@ class WaylandWindow : public PlatformWindow,
// Stores the list of entered outputs that the window is currently in.
std::set<uint32_t> entered_outputs_ids_;
+ unsigned int ivi_surface_id_;
DISALLOW_COPY_AND_ASSIGN(WaylandWindow);
};
diff --git ui/ozone/platform/wayland/host/xdg_surface_wrapper.h ui/ozone/platform/wayland/host/xdg_surface_wrapper.h
index 58bf12938b24..d35b82dba63d 100644
--- ui/ozone/platform/wayland/host/xdg_surface_wrapper.h
+++ ui/ozone/platform/wayland/host/xdg_surface_wrapper.h
@@ -59,6 +59,10 @@ class XDGSurfaceWrapper {
// Sets a desired window geometry once wayland requests client to do so.
virtual void SetWindowGeometry(const gfx::Rect& bounds) = 0;
+
+#if defined(USE_IVI)
+ virtual void SetAppID(const unsigned int ivi_surface_id) = 0;
+#endif
};
bool CheckIfWlArrayHasValue(struct wl_array* wl_array, uint32_t value);
diff --git ui/ozone/platform/wayland/host/xdg_surface_wrapper_v5.cc ui/ozone/platform/wayland/host/xdg_surface_wrapper_v5.cc
index 7f9cdf85ad25..203865b724f9 100644
--- ui/ozone/platform/wayland/host/xdg_surface_wrapper_v5.cc
+++ ui/ozone/platform/wayland/host/xdg_surface_wrapper_v5.cc
@@ -6,6 +6,7 @@
#include <xdg-shell-unstable-v5-client-protocol.h>
+#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "ui/base/hit_test.h"
#include "ui/ozone/platform/wayland/host/wayland_connection.h"
@@ -79,6 +80,15 @@ void XDGSurfaceWrapperV5::SetWindowGeometry(const gfx::Rect& bounds) {
bounds.width(), bounds.height());
}
+#if defined(USE_IVI)
+void XDGSurfaceWrapperV5::SetAppID(const unsigned int ivi_surface_id) {
+ DCHECK(xdg_surface_);
+ std::string result = base::StringPrintf("%u", ivi_surface_id);
+ xdg_surface_set_app_id(xdg_surface_.get(),
+ result.c_str());
+}
+#endif
+
// static
void XDGSurfaceWrapperV5::Configure(void* data,
xdg_surface* obj,
diff --git ui/ozone/platform/wayland/host/xdg_surface_wrapper_v5.h ui/ozone/platform/wayland/host/xdg_surface_wrapper_v5.h
index 5ef0e607a4ed..cee2f30b8586 100644
--- ui/ozone/platform/wayland/host/xdg_surface_wrapper_v5.h
+++ ui/ozone/platform/wayland/host/xdg_surface_wrapper_v5.h
@@ -35,6 +35,10 @@ class XDGSurfaceWrapperV5 : public XDGSurfaceWrapper {
void SetTitle(const base::string16& title) override;
void AckConfigure() override;
void SetWindowGeometry(const gfx::Rect& bounds) override;
+#if defined(USE_IVI)
+ void SetAppID(const unsigned int ivi_surface_id) override;
+#endif
+
// xdg_surface_listener
static void Configure(void* data,
diff --git ui/ozone/platform/wayland/host/xdg_surface_wrapper_v6.cc ui/ozone/platform/wayland/host/xdg_surface_wrapper_v6.cc
index f913d208b637..f7a7f2354b8b 100644
--- ui/ozone/platform/wayland/host/xdg_surface_wrapper_v6.cc
+++ ui/ozone/platform/wayland/host/xdg_surface_wrapper_v6.cc
@@ -6,6 +6,7 @@
#include <xdg-shell-unstable-v6-client-protocol.h>
+#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
#include "ui/base/hit_test.h"
#include "ui/ozone/platform/wayland/host/wayland_connection.h"
@@ -147,6 +148,16 @@ void XDGSurfaceWrapperV6::ConfigureTopLevel(
is_fullscreen, is_activated);
}
+#if defined(USE_IVI)
+void XDGSurfaceWrapperV6::SetAppID(const unsigned int ivi_surface_id) {
+ DCHECK(zxdg_toplevel_v6_);
+ std::string result = base::StringPrintf("%u", ivi_surface_id);
+ zxdg_toplevel_v6_set_app_id(zxdg_toplevel_v6_.get(),
+ result.c_str());
+}
+#endif
+
+
// static
void XDGSurfaceWrapperV6::CloseTopLevel(
void* data,
diff --git ui/ozone/platform/wayland/host/xdg_surface_wrapper_v6.h ui/ozone/platform/wayland/host/xdg_surface_wrapper_v6.h
index 92443cce94ce..ae15dbb91dff 100644
--- ui/ozone/platform/wayland/host/xdg_surface_wrapper_v6.h
+++ ui/ozone/platform/wayland/host/xdg_surface_wrapper_v6.h
@@ -36,6 +36,9 @@ class XDGSurfaceWrapperV6 : public XDGSurfaceWrapper {
void SetTitle(const base::string16& title) override;
void AckConfigure() override;
void SetWindowGeometry(const gfx::Rect& bounds) override;
+#if defined(USE_IVI)
+ void SetAppID(const unsigned int ivi_surface_id) override;
+#endif
// xdg_surface_listener
static void Configure(void* data,
diff --git ui/platform_window/platform_window.h ui/platform_window/platform_window.h
index c7611eee8afd..0b0cb88c1dc1 100644
--- ui/platform_window/platform_window.h
+++ ui/platform_window/platform_window.h
@@ -71,6 +71,9 @@ class PlatformWindow : public PropertyHandler {
// Sets and gets the restored bounds of the platform-window.
virtual void SetRestoredBoundsInPixels(const gfx::Rect& bounds) = 0;
virtual gfx::Rect GetRestoredBoundsInPixels() const = 0;
+#if defined(USE_IVI)
+ virtual void SetIVISurfaceID(const unsigned int id) {}
+#endif
};
} // namespace ui
diff --git ui/views/mus/desktop_window_tree_host_mus.h ui/views/mus/desktop_window_tree_host_mus.h
index 1246f2d277ce..06dd05cecd61 100644
--- ui/views/mus/desktop_window_tree_host_mus.h
+++ ui/views/mus/desktop_window_tree_host_mus.h
@@ -40,6 +40,10 @@ class VIEWS_MUS_EXPORT DesktopWindowTreeHostMus
// Called when the window was deleted on the server.
void ServerDestroyedWindow() { CloseNow(); }
+#if defined(USE_IVI)
+ void SetIVISurfaceID(const unsigned int id) override {}
+#endif
+
private:
class WindowTreeHostWindowObserver;
diff --git ui/views/widget/desktop_aura/desktop_native_widget_aura.cc ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
index 5b0508bd16df..c1de48690d69 100644
--- ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
+++ ui/views/widget/desktop_aura/desktop_native_widget_aura.cc
@@ -1020,6 +1020,12 @@ std::string DesktopNativeWidgetAura::GetName() const {
return name_;
}
+#if defined(USE_IVI)
+void DesktopNativeWidgetAura::SetIVISurfaceID(const unsigned int id) {
+ desktop_window_tree_host_->SetIVISurfaceID(id);
+}
+#endif
+
////////////////////////////////////////////////////////////////////////////////
// DesktopNativeWidgetAura, aura::WindowDelegate implementation:
diff --git ui/views/widget/desktop_aura/desktop_native_widget_aura.h ui/views/widget/desktop_aura/desktop_native_widget_aura.h
index 453195293e16..dc84354466e3 100644
--- ui/views/widget/desktop_aura/desktop_native_widget_aura.h
+++ ui/views/widget/desktop_aura/desktop_native_widget_aura.h
@@ -192,6 +192,9 @@ class VIEWS_EXPORT DesktopNativeWidgetAura
void OnSizeConstraintsChanged() override;
void OnCanActivateChanged() override;
std::string GetName() const override;
+#if defined(USE_IVI)
+ void SetIVISurfaceID(const unsigned int id) override;
+#endif
// Overridden from aura::WindowDelegate:
gfx::Size GetMinimumSize() const override;
diff --git ui/views/widget/desktop_aura/desktop_window_tree_host.h ui/views/widget/desktop_aura/desktop_window_tree_host.h
index eff14bc37bc1..2055f1af5c7d 100644
--- ui/views/widget/desktop_aura/desktop_window_tree_host.h
+++ ui/views/widget/desktop_aura/desktop_window_tree_host.h
@@ -200,6 +200,10 @@ class VIEWS_EXPORT DesktopWindowTreeHost {
// See description in Widget::OnCanActivateChanged().
virtual void OnCanActivateChanged() {}
+
+#if defined(USE_IVI)
+ virtual void SetIVISurfaceID(const unsigned int id) = 0;
+#endif
};
} // namespace views
diff --git ui/views/widget/desktop_aura/desktop_window_tree_host_platform.cc ui/views/widget/desktop_aura/desktop_window_tree_host_platform.cc
index 1afcdd749e5b..e33d64367388 100644
--- ui/views/widget/desktop_aura/desktop_window_tree_host_platform.cc
+++ ui/views/widget/desktop_aura/desktop_window_tree_host_platform.cc
@@ -398,6 +398,13 @@ void DesktopWindowTreeHostPlatform::SetVisibilityChangedAnimationsEnabled(
NOTIMPLEMENTED_LOG_ONCE();
}
+#if defined(USE_IVI)
+void DesktopWindowTreeHostPlatform::SetIVISurfaceID(const unsigned int id)
+{
+ platform_window()->SetIVISurfaceID(id);
+}
+#endif
+
NonClientFrameView* DesktopWindowTreeHostPlatform::CreateNonClientFrameView() {
return ShouldUseNativeFrame() ? new NativeFrameView(GetWidget()) : nullptr;
}
diff --git ui/views/widget/desktop_aura/desktop_window_tree_host_platform.h ui/views/widget/desktop_aura/desktop_window_tree_host_platform.h
index 02f30ef40ca3..9783c2be5497 100644
--- ui/views/widget/desktop_aura/desktop_window_tree_host_platform.h
+++ ui/views/widget/desktop_aura/desktop_window_tree_host_platform.h
@@ -89,6 +89,9 @@ class VIEWS_EXPORT DesktopWindowTreeHostPlatform
bool ShouldUpdateWindowTransparency() const override;
bool ShouldUseDesktopNativeCursorManager() const override;
bool ShouldCreateVisibilityController() const override;
+#if defined(USE_IVI)
+ void SetIVISurfaceID(const unsigned int id) override;
+#endif
// WindowTreeHostPlatform:
void DispatchEvent(ui::Event* event) override;
diff --git ui/views/widget/native_widget_private.h ui/views/widget/native_widget_private.h
index e594c698c4f5..9930c6ff5493 100644
--- ui/views/widget/native_widget_private.h
+++ ui/views/widget/native_widget_private.h
@@ -237,6 +237,9 @@ class VIEWS_EXPORT NativeWidgetPrivate : public NativeWidget {
// Returns an internal name that matches the name of the associated Widget.
virtual std::string GetName() const = 0;
+#if defined(USE_IVI)
+ virtual void SetIVISurfaceID(const unsigned int id) {}
+#endif
// Overridden from NativeWidget:
internal::NativeWidgetPrivate* AsNativeWidgetPrivate() override;
diff --git ui/views/widget/widget.cc ui/views/widget/widget.cc
index 21cabfd06228..c6c9acee3ff0 100644
--- ui/views/widget/widget.cc
+++ ui/views/widget/widget.cc
@@ -373,6 +373,11 @@ void Widget::ShowEmojiPanel() {
native_widget_->ShowEmojiPanel();
}
+#if defined(USE_IVI)
+void Widget::SetIVISurfaceID(const unsigned int id) {
+ native_widget_->SetIVISurfaceID(id);
+}
+#endif
// Unconverted methods (see header) --------------------------------------------
gfx::NativeView Widget::GetNativeView() const {
diff --git ui/views/widget/widget.h ui/views/widget/widget.h
index 063e4c8ac778..8194d35262e4 100644
--- ui/views/widget/widget.h
+++ ui/views/widget/widget.h
@@ -812,6 +812,11 @@ class VIEWS_EXPORT Widget : public internal::NativeWidgetDelegate,
// Returns the internal name for this Widget and NativeWidget.
std::string GetName() const;
+#if defined(USE_IVI)
+ void SetIVISurfaceID(const unsigned int id);
+#endif
+
+
// Overridden from NativeWidgetDelegate:
bool IsModal() const override;
bool IsDialogBox() const override;
......@@ -23,6 +23,8 @@ class SimpleWindowDelegate : public CefWindowDelegate {
: browser_view_(browser_view) {}
void OnWindowCreated(CefRefPtr<CefWindow> window) OVERRIDE {
window->SetIVISurfaceID(42);
// Add the browser view and show the window.
window->AddChildView(browser_view_);
window->Show();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment