| 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 "base/stl_util.h" | 7 #include "base/stl_util.h" |
| 8 #include "ui/arc/notification/arc_notification_item.h" | 8 #include "ui/arc/notification/arc_notification_item.h" |
| 9 | 9 |
| 10 namespace arc { | 10 namespace arc { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 } | 22 } |
| 23 | 23 |
| 24 void ArcNotificationManager::OnNotificationsInstanceReady() { | 24 void ArcNotificationManager::OnNotificationsInstanceReady() { |
| 25 NotificationsInstance* notifications_instance = | 25 NotificationsInstance* notifications_instance = |
| 26 arc_bridge_service()->notifications_instance(); | 26 arc_bridge_service()->notifications_instance(); |
| 27 if (!notifications_instance) { | 27 if (!notifications_instance) { |
| 28 VLOG(2) << "Request to refresh app list when bridge service is not ready."; | 28 VLOG(2) << "Request to refresh app list when bridge service is not ready."; |
| 29 return; | 29 return; |
| 30 } | 30 } |
| 31 | 31 |
| 32 NotificationsHostPtr host; | 32 notifications_instance->Init(binding_.CreateInterfacePtrAndBind()); |
| 33 binding_.Bind(mojo::GetProxy(&host)); | |
| 34 notifications_instance->Init(std::move(host)); | |
| 35 } | 33 } |
| 36 | 34 |
| 37 void ArcNotificationManager::OnNotificationPosted(ArcNotificationDataPtr data) { | 35 void ArcNotificationManager::OnNotificationPosted(ArcNotificationDataPtr data) { |
| 38 ArcNotificationItem* item = items_.get(data->key); | 36 ArcNotificationItem* item = items_.get(data->key); |
| 39 if (!item) { | 37 if (!item) { |
| 40 // Show a notification on the primary loged-in user's desktop. | 38 // Show a notification on the primary loged-in user's desktop. |
| 41 // TODO(yoshiki): Reconsider when ARC supports multi-user. | 39 // TODO(yoshiki): Reconsider when ARC supports multi-user. |
| 42 item = new ArcNotificationItem(this, message_center::MessageCenter::Get(), | 40 item = new ArcNotificationItem(this, message_center::MessageCenter::Get(), |
| 43 data->key, main_profile_id_); | 41 data->key, main_profile_id_); |
| 44 items_.set(data->key, make_scoped_ptr(item)); | 42 items_.set(data->key, make_scoped_ptr(item)); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 << key << "), but it is gone."; | 79 << key << "), but it is gone."; |
| 82 return; | 80 return; |
| 83 } | 81 } |
| 84 | 82 |
| 85 arc_bridge_service() | 83 arc_bridge_service() |
| 86 ->notifications_instance() | 84 ->notifications_instance() |
| 87 ->SendNotificationEventToAndroid(key, ArcNotificationEvent::BODY_CLICKED); | 85 ->SendNotificationEventToAndroid(key, ArcNotificationEvent::BODY_CLICKED); |
| 88 } | 86 } |
| 89 | 87 |
| 90 } // namespace arc | 88 } // namespace arc |
| OLD | NEW |