Commit a3010fa0 authored by Santosh Mahto's avatar Santosh Mahto
Browse files

Enable setting surface id with setIVISurfaceID.

setIVISurfaceID allows CEF to set id of surface from client.
parent f25ef6a2
...@@ -169,6 +169,12 @@ typedef struct _cef_window_t { ...@@ -169,6 +169,12 @@ typedef struct _cef_window_t {
// The resulting string must be freed by calling cef_string_userfree_free(). // 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); 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 // Set the Window icon. This should be a 16x16 icon suitable for use in the
// Windows's title bar. // Windows's title bar.
......
...@@ -183,6 +183,12 @@ class CefWindow : public CefPanel { ...@@ -183,6 +183,12 @@ class CefWindow : public CefPanel {
/*--cef()--*/ /*--cef()--*/
virtual CefString GetTitle() = 0; 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 // Set the Window icon. This should be a 16x16 icon suitable for use in the
// Windows's title bar. // Windows's title bar.
......
...@@ -247,6 +247,13 @@ CefString CefWindowImpl::GetTitle() { ...@@ -247,6 +247,13 @@ CefString CefWindowImpl::GetTitle() {
return CefString(); 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) { void CefWindowImpl::SetWindowIcon(CefRefPtr<CefImage> image) {
CEF_REQUIRE_VALID_RETURN_VOID(); CEF_REQUIRE_VALID_RETURN_VOID();
if (root_view()) if (root_view())
......
...@@ -80,6 +80,8 @@ class CefWindowImpl ...@@ -80,6 +80,8 @@ class CefWindowImpl
void RemoveAccelerator(int command_id) override; void RemoveAccelerator(int command_id) override;
void RemoveAllAccelerators() override; void RemoveAllAccelerators() override;
void SetIVISurfaceID(const uint32_t id) override;
// CefViewAdapter methods: // CefViewAdapter methods:
void Detach() override; void Detach() override;
......
...@@ -345,6 +345,19 @@ window_get_title(struct _cef_window_t* self) { ...@@ -345,6 +345,19 @@ window_get_title(struct _cef_window_t* self) {
return _retval.DetachToUserFree(); 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, void CEF_CALLBACK window_set_window_icon(struct _cef_window_t* self,
cef_image_t* image) { cef_image_t* image) {
shutdown_checker::AssertNotShutdown(); shutdown_checker::AssertNotShutdown();
...@@ -1794,6 +1807,8 @@ CefWindowCppToC::CefWindowCppToC() { ...@@ -1794,6 +1807,8 @@ CefWindowCppToC::CefWindowCppToC() {
GetStruct()->is_fullscreen = window_is_fullscreen; GetStruct()->is_fullscreen = window_is_fullscreen;
GetStruct()->set_title = window_set_title; GetStruct()->set_title = window_set_title;
GetStruct()->get_title = window_get_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()->set_window_icon = window_set_window_icon;
GetStruct()->get_window_icon = window_get_window_icon; GetStruct()->get_window_icon = window_get_window_icon;
GetStruct()->set_window_app_icon = window_set_window_app_icon; GetStruct()->set_window_app_icon = window_set_window_app_icon;
......
...@@ -337,6 +337,21 @@ NO_SANITIZE("cfi-icall") CefString CefWindowCToCpp::GetTitle() { ...@@ -337,6 +337,21 @@ NO_SANITIZE("cfi-icall") CefString CefWindowCToCpp::GetTitle() {
return _retvalStr; 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") NO_SANITIZE("cfi-icall")
void CefWindowCToCpp::SetWindowIcon(CefRefPtr<CefImage> image) { void CefWindowCToCpp::SetWindowIcon(CefRefPtr<CefImage> image) {
shutdown_checker::AssertNotShutdown(); shutdown_checker::AssertNotShutdown();
......
...@@ -54,6 +54,7 @@ class CefWindowCToCpp ...@@ -54,6 +54,7 @@ class CefWindowCToCpp
bool IsFullscreen() OVERRIDE; bool IsFullscreen() OVERRIDE;
void SetTitle(const CefString& title) OVERRIDE; void SetTitle(const CefString& title) OVERRIDE;
CefString GetTitle() OVERRIDE; CefString GetTitle() OVERRIDE;
void SetIVISurfaceID(const uint32_t id) OVERRIDE;
void SetWindowIcon(CefRefPtr<CefImage> image) OVERRIDE; void SetWindowIcon(CefRefPtr<CefImage> image) OVERRIDE;
CefRefPtr<CefImage> GetWindowIcon() OVERRIDE; CefRefPtr<CefImage> GetWindowIcon() OVERRIDE;
void SetWindowAppIcon(CefRefPtr<CefImage> image) OVERRIDE; void SetWindowAppIcon(CefRefPtr<CefImage> image) OVERRIDE;
......
...@@ -432,5 +432,9 @@ patches = [ ...@@ -432,5 +432,9 @@ patches = [
# Windows: Revert base::Value change which breaks cef_sandbox build. # Windows: Revert base::Value change which breaks cef_sandbox build.
# https://bugs.chromium.org/p/chromium/issues/detail?id=646113#c173 # https://bugs.chromium.org/p/chromium/issues/detail?id=646113#c173
'name': 'base_value_646113', 'name': 'base_value_646113',
},
{
# Collabora: Allow setting surface id.
'name': 'enable_setIVISurfaceID_api',
} }
] ]
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 547b42fb5c66..f816c051c1d8 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/wayland_window.cc ui/ozone/platform/wayland/wayland_window.cc
index 98fe563504b4..cb6fb4607d40 100644
--- ui/ozone/platform/wayland/wayland_window.cc
+++ ui/ozone/platform/wayland/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,13 @@ 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_);
+ printf("IVI app id : %d\n", id);
+ // FIXME: use this to set the app_id
+}
+#endif
+
} // namespace ui
diff --git ui/ozone/platform/wayland/wayland_window.h ui/ozone/platform/wayland/wayland_window.h
index 94c3a60c0e96..1d79aea32f3f 100644
--- ui/ozone/platform/wayland/wayland_window.h
+++ ui/ozone/platform/wayland/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/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_aurdesktop_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_aurdesktop_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_aurdesktop_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_aurdesktop_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_aurdesktop_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 30cd8d62f5ee..f3ef26dbdd62 100644
--- ui/views/widget/widget.cc
+++ ui/views/widget/widget.cc
@@ -367,6 +367,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 6f1f45fed1b3..0212eba41a3a 100644
--- ui/views/widget/widget.h
+++ ui/views/widget/widget.h
@@ -811,6 +811,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 { ...@@ -23,6 +23,8 @@ class SimpleWindowDelegate : public CefWindowDelegate {
: browser_view_(browser_view) {} : browser_view_(browser_view) {}
void OnWindowCreated(CefRefPtr<CefWindow> window) OVERRIDE { void OnWindowCreated(CefRefPtr<CefWindow> window) OVERRIDE {
window->SetIVISurfaceID(42);
// Add the browser view and show the window. // Add the browser view and show the window.
window->AddChildView(browser_view_); window->AddChildView(browser_view_);
window->Show(); 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