Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(473)

Unified Diff: components/exo/display.cc

Issue 2065133002: exo: Implement notification surface support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@notification-wayland-protocol
Patch Set: address comments from reveman Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: components/exo/display.cc
diff --git a/components/exo/display.cc b/components/exo/display.cc
index 7039936a1db49b11a4de1b0ff40cd987806c3a5f..24d3419a82dda71a7ae11ac301e73edfa93abca5 100644
--- a/components/exo/display.cc
+++ b/components/exo/display.cc
@@ -12,6 +12,8 @@
#include "base/memory/ptr_util.h"
#include "base/trace_event/trace_event.h"
#include "base/trace_event/trace_event_argument.h"
+#include "components/exo/notification_surface.h"
+#include "components/exo/notification_surface_manager.h"
#include "components/exo/shared_memory.h"
#include "components/exo/shell_surface.h"
#include "components/exo/sub_surface.h"
@@ -179,4 +181,25 @@ std::unique_ptr<SubSurface> Display::CreateSubSurface(Surface* surface,
return base::WrapUnique(new SubSurface(surface, parent));
}
+std::unique_ptr<NotificationSurface> Display::CreateNotificationSurface(
+ Surface* surface,
+ const std::string& notification_id) {
+ TRACE_EVENT2("exo", "Display::CreateNotificationSurface", "surface",
+ surface->AsTracedValue(), "notification_id", notification_id);
+
+ if (notification_surface_manager_ &&
reveman 2016/06/23 16:34:52 nit: please fail if "!notification_surface_manager
xiyuan 2016/06/23 17:46:09 Done.
+ notification_surface_manager_->GetSurface(notification_id) != nullptr) {
reveman 2016/06/23 16:34:52 nit: s/GetSurface(notification_id) != nullptr/GetS
xiyuan 2016/06/23 17:46:09 Done.
+ DLOG(ERROR) << "Invalid notification id, id=" << notification_id;
+ return nullptr;
+ }
+
+ return base::WrapUnique(new NotificationSurface(
+ notification_surface_manager_.get(), surface, notification_id));
+}
+
+void Display::SetNotificationSurfaceManager(
+ std::unique_ptr<NotificationSurfaceManager> notification_surface_manager) {
+ notification_surface_manager_ = std::move(notification_surface_manager);
+}
+
} // namespace exo

Powered by Google App Engine
This is Rietveld 408576698