Chromium Code Reviews| Index: components/exo/wayland/server.cc |
| diff --git a/components/exo/wayland/server.cc b/components/exo/wayland/server.cc |
| index 5ba8ee4496989fe48d99864c4126dafeef57a06e..b2779d7eb5438f8499c82d2e78bb6af356fd9a60 100644 |
| --- a/components/exo/wayland/server.cc |
| +++ b/components/exo/wayland/server.cc |
| @@ -42,6 +42,8 @@ |
| #include "components/exo/display.h" |
| #include "components/exo/keyboard.h" |
| #include "components/exo/keyboard_delegate.h" |
| +#include "components/exo/notification_surface.h" |
| +#include "components/exo/notification_surface_manager.h" |
| #include "components/exo/pointer.h" |
| #include "components/exo/pointer_delegate.h" |
| #include "components/exo/shared_memory.h" |
| @@ -1485,6 +1487,16 @@ const struct zwp_remote_surface_v1_interface remote_surface_implementation = { |
| remote_surface_unfullscreen}; |
| //////////////////////////////////////////////////////////////////////////////// |
| +// notification_surface_interface: |
| + |
| +void notification_surface_destroy(wl_client* client, wl_resource* resource) { |
| + wl_resource_destroy(resource); |
| +} |
| + |
| +const struct zwp_notification_surface_v1_interface |
| + notification_surface_implementation = {notification_surface_destroy}; |
| + |
| +//////////////////////////////////////////////////////////////////////////////// |
| // remote_shell_interface: |
| // Implements remote shell interface and monitors workspace state needed |
| @@ -1517,6 +1529,12 @@ class WaylandRemoteShell : public ash::ShellObserver, |
| return display_->CreateRemoteShellSurface(surface, container); |
| } |
| + std::unique_ptr<NotificationSurface> CreateNotificationSurface( |
| + Surface* surface, |
| + const std::string& notification_id) { |
| + return display_->CreateNotificationSurface(surface, notification_id); |
| + } |
| + |
| // Overridden from display::DisplayObserver: |
| void OnDisplayAdded(const display::Display& new_display) override {} |
| void OnDisplayRemoved(const display::Display& new_display) override {} |
| @@ -1692,10 +1710,40 @@ void remote_shell_get_remote_surface(wl_client* client, |
| std::move(shell_surface)); |
| } |
| +void remote_shell_get_notification_surface(wl_client* client, |
| + wl_resource* resource, |
| + uint32_t id, |
| + wl_resource* surface, |
| + const char* notification_id) { |
| + if (GetUserDataAs<Surface>(surface)->HasSurfaceDelegate()) { |
| + wl_resource_post_error(resource, ZWP_REMOTE_SHELL_V1_ERROR_ROLE, |
| + "surface has already been assigned a role"); |
| + return; |
| + } |
| + |
| + std::unique_ptr<NotificationSurface> notification_surface = |
| + GetUserDataAs<WaylandRemoteShell>(resource)->CreateNotificationSurface( |
| + GetUserDataAs<Surface>(surface), std::string(notification_id)); |
| + if (!notification_surface) { |
| + wl_resource_post_error(resource, |
| + ZWP_REMOTE_SHELL_V1_ERROR_INVALID_NOTIFICATION_ID, |
| + "invalid notification id"); |
| + return; |
| + } |
| + |
| + wl_resource* notification_surface_resource = |
| + wl_resource_create(client, &zwp_notification_surface_v1_interface, |
| + wl_resource_get_version(resource), id); |
| + SetImplementation(notification_surface_resource, |
| + ¬ification_surface_implementation, |
| + std::move(notification_surface)); |
| +} |
| + |
| const struct zwp_remote_shell_v1_interface remote_shell_implementation = { |
| - remote_shell_destroy, remote_shell_get_remote_surface}; |
| + remote_shell_destroy, remote_shell_get_remote_surface, |
| + remote_shell_get_notification_surface}; |
| -const uint32_t remote_shell_version = 3; |
| +const uint32_t remote_shell_version = 4; |
|
reveman
2016/06/23 16:34:53
Note: I think this will be 6 after rebase
xiyuan
2016/06/23 17:46:10
will rebase and fix it in next PS.
|
| void bind_remote_shell(wl_client* client, |
| void* data, |