OLD | NEW |
---|---|
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 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 "chrome/browser/notifications/notification_platform_bridge_linux.h" | 5 #include "chrome/browser/notifications/notification_platform_bridge_linux.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/barrier_closure.h" | 9 #include "base/barrier_closure.h" |
10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
(...skipping 436 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
447 } | 447 } |
448 for (NotificationData* data : to_erase) | 448 for (NotificationData* data : to_erase) |
449 notifications_.erase(data); | 449 notifications_.erase(data); |
450 } | 450 } |
451 | 451 |
452 void GetDisplayedOnTaskRunner( | 452 void GetDisplayedOnTaskRunner( |
453 const std::string& profile_id, | 453 const std::string& profile_id, |
454 bool incognito, | 454 bool incognito, |
455 const GetDisplayedNotificationsCallback& callback) const { | 455 const GetDisplayedNotificationsCallback& callback) const { |
456 DCHECK(task_runner_->RunsTasksOnCurrentThread()); | 456 DCHECK(task_runner_->RunsTasksOnCurrentThread()); |
457 // TODO(thomasanderson): Implement. | 457 auto displayed = base::MakeUnique<std::set<std::string>>(); |
458 PostTaskToUiThread(base::BindOnce( | 458 for (const auto& notification : notifications_) { |
459 callback, base::Passed(base::MakeUnique<std::set<std::string>>()), | 459 if (notification.first->profile_id == profile_id && |
460 false)); | 460 notification.first->is_incognito == incognito) { |
461 displayed->insert(notification.first->notification_id); | |
462 } | |
463 } | |
Peter Beverloo
2017/05/02 13:53:42
Are we confident that we can rely on the Notificat
Tom (Use chromium acct)
2017/05/02 20:59:16
yes I believe so
| |
464 PostTaskToUiThread(base::BindOnce(callback, std::move(displayed), true)); | |
461 } | 465 } |
462 | 466 |
463 NotificationData* FindNotificationData(const std::string& notification_id, | 467 NotificationData* FindNotificationData(const std::string& notification_id, |
464 const std::string& profile_id, | 468 const std::string& profile_id, |
465 bool is_incognito) { | 469 bool is_incognito) { |
466 DCHECK(task_runner_->RunsTasksOnCurrentThread()); | 470 DCHECK(task_runner_->RunsTasksOnCurrentThread()); |
467 for (const auto& pair : notifications_) { | 471 for (const auto& pair : notifications_) { |
468 NotificationData* data = pair.first; | 472 NotificationData* data = pair.first; |
469 if (data->notification_id == notification_id && | 473 if (data->notification_id == notification_id && |
470 data->profile_id == profile_id && | 474 data->profile_id == profile_id && |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
633 const std::string& profile_id, | 637 const std::string& profile_id, |
634 bool incognito, | 638 bool incognito, |
635 const GetDisplayedNotificationsCallback& callback) const { | 639 const GetDisplayedNotificationsCallback& callback) const { |
636 impl_->GetDisplayed(profile_id, incognito, callback); | 640 impl_->GetDisplayed(profile_id, incognito, callback); |
637 } | 641 } |
638 | 642 |
639 void NotificationPlatformBridgeLinux::SetReadyCallback( | 643 void NotificationPlatformBridgeLinux::SetReadyCallback( |
640 NotificationBridgeReadyCallback callback) { | 644 NotificationBridgeReadyCallback callback) { |
641 impl_->SetReadyCallback(std::move(callback)); | 645 impl_->SetReadyCallback(std::move(callback)); |
642 } | 646 } |
OLD | NEW |