| 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_notification_surface_manager.h" | 5 #include "ui/arc/notification/arc_notification_surface_manager.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "components/exo/notification_surface.h" | 9 #include "components/exo/notification_surface.h" |
| 10 | 10 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 void ArcNotificationSurfaceManager::AddSurface( | 40 void ArcNotificationSurfaceManager::AddSurface( |
| 41 exo::NotificationSurface* surface) { | 41 exo::NotificationSurface* surface) { |
| 42 if (notification_surface_map_.find(surface->notification_id()) != | 42 if (notification_surface_map_.find(surface->notification_id()) != |
| 43 notification_surface_map_.end()) { | 43 notification_surface_map_.end()) { |
| 44 NOTREACHED(); | 44 NOTREACHED(); |
| 45 return; | 45 return; |
| 46 } | 46 } |
| 47 | 47 |
| 48 notification_surface_map_[surface->notification_id()] = surface; | 48 notification_surface_map_[surface->notification_id()] = surface; |
| 49 | 49 |
| 50 FOR_EACH_OBSERVER(Observer, observers_, OnNotificationSurfaceAdded(surface)); | 50 for (auto& observer : observers_) |
| 51 observer.OnNotificationSurfaceAdded(surface); |
| 51 } | 52 } |
| 52 | 53 |
| 53 void ArcNotificationSurfaceManager::RemoveSurface( | 54 void ArcNotificationSurfaceManager::RemoveSurface( |
| 54 exo::NotificationSurface* surface) { | 55 exo::NotificationSurface* surface) { |
| 55 auto it = notification_surface_map_.find(surface->notification_id()); | 56 auto it = notification_surface_map_.find(surface->notification_id()); |
| 56 if (it == notification_surface_map_.end()) | 57 if (it == notification_surface_map_.end()) |
| 57 return; | 58 return; |
| 58 | 59 |
| 59 notification_surface_map_.erase(it); | 60 notification_surface_map_.erase(it); |
| 60 FOR_EACH_OBSERVER(Observer, observers_, | 61 for (auto& observer : observers_) |
| 61 OnNotificationSurfaceRemoved(surface)); | 62 observer.OnNotificationSurfaceRemoved(surface); |
| 62 } | 63 } |
| 63 | 64 |
| 64 void ArcNotificationSurfaceManager::AddObserver(Observer* observer) { | 65 void ArcNotificationSurfaceManager::AddObserver(Observer* observer) { |
| 65 observers_.AddObserver(observer); | 66 observers_.AddObserver(observer); |
| 66 } | 67 } |
| 67 | 68 |
| 68 void ArcNotificationSurfaceManager::RemoveObserver(Observer* observer) { | 69 void ArcNotificationSurfaceManager::RemoveObserver(Observer* observer) { |
| 69 observers_.RemoveObserver(observer); | 70 observers_.RemoveObserver(observer); |
| 70 } | 71 } |
| 71 | 72 |
| 72 } // namespace arc | 73 } // namespace arc |
| OLD | NEW |