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 |