OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "components/exo/notification_surface.h" | |
6 | |
7 #include "components/exo/notification_surface_registry.h" | |
8 #include "components/exo/surface.h" | |
9 | |
10 namespace exo { | |
11 | |
12 NotificationSurface::NotificationSurface(Surface* surface, | |
13 const std::string& notification_id) | |
14 : surface_(surface), notification_id_(notification_id) { | |
15 surface_->AddSurfaceObserver(this); | |
16 NotificationSurfaceRegistry::Get()->AddSurface(this); | |
17 } | |
18 | |
19 NotificationSurface::~NotificationSurface() { | |
20 if (surface_) | |
21 surface_->RemoveSurfaceObserver(this); | |
22 NotificationSurfaceRegistry::Get()->RemoveSurface(this); | |
23 } | |
24 | |
25 gfx::Size NotificationSurface::GetSize() const { | |
26 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
| |
27 } | |
28 | |
29 void NotificationSurface::OnSurfaceDestroying(Surface* surface) { | |
30 surface->RemoveSurfaceObserver(this); | |
31 surface_ = nullptr; | |
32 } | |
33 | |
34 } // namespace exo | |
OLD | NEW |