| 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" |
| 11 #include "components/exo/surface.h" | 11 #include "components/exo/surface.h" |
| 12 #include "third_party/skia/include/core/SkColor.h" | 12 #include "third_party/skia/include/core/SkColor.h" |
| 13 #include "ui/base/l10n/l10n_util.h" | 13 #include "ui/base/l10n/l10n_util.h" |
| 14 #include "ui/base/resource/resource_bundle.h" | 14 #include "ui/base/resource/resource_bundle.h" |
| 15 #include "ui/compositor/layer_animation_observer.h" | 15 #include "ui/compositor/layer_animation_observer.h" |
| 16 #include "ui/compositor/layer_type.h" |
| 16 #include "ui/display/screen.h" | 17 #include "ui/display/screen.h" |
| 17 #include "ui/events/event_handler.h" | 18 #include "ui/events/event_handler.h" |
| 18 #include "ui/gfx/canvas.h" | 19 #include "ui/gfx/canvas.h" |
| 19 #include "ui/gfx/image/image_skia.h" | 20 #include "ui/gfx/image/image_skia.h" |
| 20 #include "ui/gfx/transform.h" | 21 #include "ui/gfx/transform.h" |
| 21 #include "ui/message_center/message_center_style.h" | 22 #include "ui/message_center/message_center_style.h" |
| 22 #include "ui/message_center/views/custom_notification_view.h" | 23 #include "ui/message_center/views/custom_notification_view.h" |
| 23 #include "ui/resources/grit/ui_resources.h" | 24 #include "ui/resources/grit/ui_resources.h" |
| 24 #include "ui/strings/grit/ui_strings.h" | 25 #include "ui/strings/grit/ui_strings.h" |
| 25 #include "ui/views/background.h" | 26 #include "ui/views/background.h" |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 item_->IncrementWindowRefCount(); | 232 item_->IncrementWindowRefCount(); |
| 232 item_->AddObserver(this); | 233 item_->AddObserver(this); |
| 233 | 234 |
| 234 ArcNotificationSurfaceManager::Get()->AddObserver(this); | 235 ArcNotificationSurfaceManager::Get()->AddObserver(this); |
| 235 exo::NotificationSurface* surface = | 236 exo::NotificationSurface* surface = |
| 236 ArcNotificationSurfaceManager::Get()->GetSurface(notification_key_); | 237 ArcNotificationSurfaceManager::Get()->GetSurface(notification_key_); |
| 237 if (surface) | 238 if (surface) |
| 238 OnNotificationSurfaceAdded(surface); | 239 OnNotificationSurfaceAdded(surface); |
| 239 | 240 |
| 240 // Create a layer as an anchor to insert surface copy during a slide. | 241 // Create a layer as an anchor to insert surface copy during a slide. |
| 241 SetPaintToLayer(true); | 242 SetPaintToLayer(ui::LAYER_TEXTURED); |
| 242 UpdatePreferredSize(); | 243 UpdatePreferredSize(); |
| 243 } | 244 } |
| 244 | 245 |
| 245 ArcCustomNotificationView::~ArcCustomNotificationView() { | 246 ArcCustomNotificationView::~ArcCustomNotificationView() { |
| 246 SetSurface(nullptr); | 247 SetSurface(nullptr); |
| 247 if (item_) { | 248 if (item_) { |
| 248 item_->DecrementWindowRefCount(); | 249 item_->DecrementWindowRefCount(); |
| 249 item_->RemoveObserver(this); | 250 item_->RemoveObserver(this); |
| 250 } | 251 } |
| 251 | 252 |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 542 | 543 |
| 543 void ArcCustomNotificationView::OnNotificationSurfaceRemoved( | 544 void ArcCustomNotificationView::OnNotificationSurfaceRemoved( |
| 544 exo::NotificationSurface* surface) { | 545 exo::NotificationSurface* surface) { |
| 545 if (surface->notification_id() != notification_key_) | 546 if (surface->notification_id() != notification_key_) |
| 546 return; | 547 return; |
| 547 | 548 |
| 548 SetSurface(nullptr); | 549 SetSurface(nullptr); |
| 549 } | 550 } |
| 550 | 551 |
| 551 } // namespace arc | 552 } // namespace arc |
| OLD | NEW |