| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ui/arc/notification/arc_custom_notification_view.h" | 5 #include "ui/arc/notification/arc_custom_notification_view.h" |
| 6 | 6 |
| 7 #include "ash/wm/window_util.h" | 7 #include "ash/wm/window_util.h" |
| 8 #include "base/auto_reset.h" | 8 #include "base/auto_reset.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "components/exo/notification_surface.h" | 10 #include "components/exo/notification_surface.h" |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 item_->IncrementWindowRefCount(); | 231 item_->IncrementWindowRefCount(); |
| 232 item_->AddObserver(this); | 232 item_->AddObserver(this); |
| 233 | 233 |
| 234 ArcNotificationSurfaceManager::Get()->AddObserver(this); | 234 ArcNotificationSurfaceManager::Get()->AddObserver(this); |
| 235 exo::NotificationSurface* surface = | 235 exo::NotificationSurface* surface = |
| 236 ArcNotificationSurfaceManager::Get()->GetSurface(notification_key_); | 236 ArcNotificationSurfaceManager::Get()->GetSurface(notification_key_); |
| 237 if (surface) | 237 if (surface) |
| 238 OnNotificationSurfaceAdded(surface); | 238 OnNotificationSurfaceAdded(surface); |
| 239 | 239 |
| 240 // Create a layer as an anchor to insert surface copy during a slide. | 240 // Create a layer as an anchor to insert surface copy during a slide. |
| 241 SetPaintToLayer(true); | 241 SetPaintToLayer(); |
| 242 UpdatePreferredSize(); | 242 UpdatePreferredSize(); |
| 243 } | 243 } |
| 244 | 244 |
| 245 ArcCustomNotificationView::~ArcCustomNotificationView() { | 245 ArcCustomNotificationView::~ArcCustomNotificationView() { |
| 246 SetSurface(nullptr); | 246 SetSurface(nullptr); |
| 247 if (item_) { | 247 if (item_) { |
| 248 item_->DecrementWindowRefCount(); | 248 item_->DecrementWindowRefCount(); |
| 249 item_->RemoveObserver(this); | 249 item_->RemoveObserver(this); |
| 250 } | 250 } |
| 251 | 251 |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 | 542 |
| 543 void ArcCustomNotificationView::OnNotificationSurfaceRemoved( | 543 void ArcCustomNotificationView::OnNotificationSurfaceRemoved( |
| 544 exo::NotificationSurface* surface) { | 544 exo::NotificationSurface* surface) { |
| 545 if (surface->notification_id() != notification_key_) | 545 if (surface->notification_id() != notification_key_) |
| 546 return; | 546 return; |
| 547 | 547 |
| 548 SetSurface(nullptr); | 548 SetSurface(nullptr); |
| 549 } | 549 } |
| 550 | 550 |
| 551 } // namespace arc | 551 } // namespace arc |
| OLD | NEW |