| 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 "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "components/exo/notification_surface.h" | 8 #include "components/exo/notification_surface.h" |
| 9 #include "components/exo/surface.h" | 9 #include "components/exo/surface.h" |
| 10 #include "third_party/skia/include/core/SkColor.h" | 10 #include "third_party/skia/include/core/SkColor.h" |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 floating_close_button_widget_->Init(params); | 206 floating_close_button_widget_->Init(params); |
| 207 floating_close_button_widget_->SetContentsView(floating_close_button_); | 207 floating_close_button_widget_->SetContentsView(floating_close_button_); |
| 208 | 208 |
| 209 Layout(); | 209 Layout(); |
| 210 } | 210 } |
| 211 | 211 |
| 212 void ArcCustomNotificationView::SetSurface(exo::NotificationSurface* surface) { | 212 void ArcCustomNotificationView::SetSurface(exo::NotificationSurface* surface) { |
| 213 if (surface_ == surface) | 213 if (surface_ == surface) |
| 214 return; | 214 return; |
| 215 | 215 |
| 216 // Reset |floating_close_button_widget_| when |surface_| is changed. |
| 217 floating_close_button_widget_.reset(); |
| 218 |
| 216 if (surface_ && surface_->window()) { | 219 if (surface_ && surface_->window()) { |
| 217 surface_->window()->RemoveObserver(this); | 220 surface_->window()->RemoveObserver(this); |
| 218 surface_->window()->RemovePreTargetHandler(event_forwarder_.get()); | 221 surface_->window()->RemovePreTargetHandler(event_forwarder_.get()); |
| 219 } | 222 } |
| 220 | 223 |
| 221 surface_ = surface; | 224 surface_ = surface; |
| 222 | 225 |
| 223 if (surface_ && surface_->window()) { | 226 if (surface_ && surface_->window()) { |
| 224 surface_->window()->AddObserver(this); | 227 surface_->window()->AddObserver(this); |
| 225 surface_->window()->AddPreTargetHandler(event_forwarder_.get()); | 228 surface_->window()->AddPreTargetHandler(event_forwarder_.get()); |
| (...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 | 432 |
| 430 void ArcCustomNotificationView::OnNotificationSurfaceRemoved( | 433 void ArcCustomNotificationView::OnNotificationSurfaceRemoved( |
| 431 exo::NotificationSurface* surface) { | 434 exo::NotificationSurface* surface) { |
| 432 if (surface->notification_id() != notification_key_) | 435 if (surface->notification_id() != notification_key_) |
| 433 return; | 436 return; |
| 434 | 437 |
| 435 SetSurface(nullptr); | 438 SetSurface(nullptr); |
| 436 } | 439 } |
| 437 | 440 |
| 438 } // namespace arc | 441 } // namespace arc |
| OLD | NEW |