| 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 "components/exo/notification_surface.h" | 7 #include "components/exo/notification_surface.h" |
| 8 #include "components/exo/surface.h" | 8 #include "components/exo/surface.h" |
| 9 #include "third_party/skia/include/core/SkColor.h" | 9 #include "third_party/skia/include/core/SkColor.h" |
| 10 #include "ui/base/l10n/l10n_util.h" | 10 #include "ui/base/l10n/l10n_util.h" |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 floating_close_button_widget_->Init(params); | 179 floating_close_button_widget_->Init(params); |
| 180 floating_close_button_widget_->SetContentsView(floating_close_button_); | 180 floating_close_button_widget_->SetContentsView(floating_close_button_); |
| 181 | 181 |
| 182 Layout(); | 182 Layout(); |
| 183 } | 183 } |
| 184 | 184 |
| 185 void ArcCustomNotificationView::SetSurface(exo::NotificationSurface* surface) { | 185 void ArcCustomNotificationView::SetSurface(exo::NotificationSurface* surface) { |
| 186 if (surface_ == surface) | 186 if (surface_ == surface) |
| 187 return; | 187 return; |
| 188 | 188 |
| 189 // Reset |floating_close_button_widget_| when |surface_| is changed. |
| 190 floating_close_button_widget_.reset(); |
| 191 |
| 189 if (surface_ && surface_->window()) { | 192 if (surface_ && surface_->window()) { |
| 190 surface_->window()->RemoveObserver(this); | 193 surface_->window()->RemoveObserver(this); |
| 191 surface_->window()->RemovePreTargetHandler(event_forwarder_.get()); | 194 surface_->window()->RemovePreTargetHandler(event_forwarder_.get()); |
| 192 } | 195 } |
| 193 | 196 |
| 194 surface_ = surface; | 197 surface_ = surface; |
| 195 | 198 |
| 196 if (surface_ && surface_->window()) { | 199 if (surface_ && surface_->window()) { |
| 197 surface_->window()->AddObserver(this); | 200 surface_->window()->AddObserver(this); |
| 198 surface_->window()->AddPreTargetHandler(event_forwarder_.get()); | 201 surface_->window()->AddPreTargetHandler(event_forwarder_.get()); |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 | 395 |
| 393 void ArcCustomNotificationView::OnNotificationSurfaceRemoved( | 396 void ArcCustomNotificationView::OnNotificationSurfaceRemoved( |
| 394 exo::NotificationSurface* surface) { | 397 exo::NotificationSurface* surface) { |
| 395 if (surface->notification_id() != notification_key_) | 398 if (surface->notification_id() != notification_key_) |
| 396 return; | 399 return; |
| 397 | 400 |
| 398 SetSurface(nullptr); | 401 SetSurface(nullptr); |
| 399 } | 402 } |
| 400 | 403 |
| 401 } // namespace arc | 404 } // namespace arc |
| OLD | NEW |