Chromium Code Reviews| 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_manager.h" | 5 #include "ui/arc/notification/arc_notification_manager.h" |
| 6 | 6 |
| 7 #include "ash/common/system/toast/toast_manager.h" | 7 #include "ash/common/system/toast/toast_manager.h" |
| 8 #include "ash/common/wm_shell.h" | 8 #include "ash/common/wm_shell.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 81 use_custom_notification | 81 use_custom_notification |
| 82 ? new ArcCustomNotificationItem(this, message_center_, key, | 82 ? new ArcCustomNotificationItem(this, message_center_, key, |
| 83 main_profile_id_) | 83 main_profile_id_) |
| 84 : new ArcNotificationItem(this, message_center_, key, | 84 : new ArcNotificationItem(this, message_center_, key, |
| 85 main_profile_id_); | 85 main_profile_id_); |
| 86 // TODO(yoshiki): Use emplacement for performance when it's available. | 86 // TODO(yoshiki): Use emplacement for performance when it's available. |
| 87 auto result = items_.insert(std::make_pair(key, base::WrapUnique(item))); | 87 auto result = items_.insert(std::make_pair(key, base::WrapUnique(item))); |
| 88 DCHECK(result.second); | 88 DCHECK(result.second); |
| 89 it = result.first; | 89 it = result.first; |
| 90 } | 90 } |
| 91 it->second->UpdateWithArcNotificationData(*data); | 91 LOG(ERROR) << data->type; |
|
xiyuan
2016/09/07 22:09:00
nit: remove ?
yoshiki
2016/09/09 16:45:30
Done.
| |
| 92 it->second->UpdateWithArcNotificationData(std::move(data)); | |
| 92 } | 93 } |
| 93 | 94 |
| 94 void ArcNotificationManager::OnNotificationRemoved(const mojo::String& key) { | 95 void ArcNotificationManager::OnNotificationRemoved(const mojo::String& key) { |
| 95 auto it = items_.find(key.get()); | 96 auto it = items_.find(key.get()); |
| 96 if (it == items_.end()) { | 97 if (it == items_.end()) { |
| 97 VLOG(3) << "Android requests to remove a notification (key: " << key | 98 VLOG(3) << "Android requests to remove a notification (key: " << key |
| 98 << "), but it is already gone."; | 99 << "), but it is already gone."; |
| 99 return; | 100 return; |
| 100 } | 101 } |
| 101 | 102 |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 254 ash::WmShell::Get()->toast_manager()->Show( | 255 ash::WmShell::Get()->toast_manager()->Show( |
| 255 ash::ToastData(data->id, data->text.To<base::string16>(), data->duration, | 256 ash::ToastData(data->id, data->text.To<base::string16>(), data->duration, |
| 256 data->dismiss_text.To<base::string16>())); | 257 data->dismiss_text.To<base::string16>())); |
| 257 } | 258 } |
| 258 | 259 |
| 259 void ArcNotificationManager::OnToastCancelled(mojom::ArcToastDataPtr data) { | 260 void ArcNotificationManager::OnToastCancelled(mojom::ArcToastDataPtr data) { |
| 260 ash::WmShell::Get()->toast_manager()->Cancel(data->id); | 261 ash::WmShell::Get()->toast_manager()->Cancel(data->id); |
| 261 } | 262 } |
| 262 | 263 |
| 263 } // namespace arc | 264 } // namespace arc |
| OLD | NEW |