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

Unified Diff: components/exo/notification_surface.cc

Issue 2065133002: exo: Implement notification surface support (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@notification-wayland-protocol
Patch Set: add NotificationServiceRegistry to track notification surface 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/notification_surface.cc
diff --git a/components/exo/notification_surface.cc b/components/exo/notification_surface.cc
new file mode 100644
index 0000000000000000000000000000000000000000..0266f482e694cc88ba84ae904216dadf62b6dd3f
--- /dev/null
+++ b/components/exo/notification_surface.cc
@@ -0,0 +1,34 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/exo/notification_surface.h"
+
+#include "components/exo/notification_surface_registry.h"
+#include "components/exo/surface.h"
+
+namespace exo {
+
+NotificationSurface::NotificationSurface(Surface* surface,
+ const std::string& notification_id)
+ : surface_(surface), notification_id_(notification_id) {
+ surface_->AddSurfaceObserver(this);
+ NotificationSurfaceRegistry::Get()->AddSurface(this);
+}
+
+NotificationSurface::~NotificationSurface() {
+ if (surface_)
+ surface_->RemoveSurfaceObserver(this);
+ NotificationSurfaceRegistry::Get()->RemoveSurface(this);
+}
+
+gfx::Size NotificationSurface::GetSize() const {
+ return surface_->GetHitTestBounds().size();
reveman 2016/06/16 03:35:20 Why hit test bounds and not the contents size?
xiyuan 2016/06/20 22:40:28 Did not notice we added a content_size(). Use it n
+}
+
+void NotificationSurface::OnSurfaceDestroying(Surface* surface) {
+ surface->RemoveSurfaceObserver(this);
+ surface_ = nullptr;
+}
+
+} // namespace exo

Powered by Google App Engine
This is Rietveld 408576698