Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(37)

Side by Side Diff: chrome/browser/notifications/stub_notification_platform_bridge.cc

Issue 2093953002: Introduce a new API to handle native notification clicks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "chrome/browser/notifications/stub_notification_platform_bridge.h" 5 #include "chrome/browser/notifications/stub_notification_platform_bridge.h"
6 6
7 StubNotificationPlatformBridge::StubNotificationPlatformBridge() 7 StubNotificationPlatformBridge::StubNotificationPlatformBridge()
8 : NotificationPlatformBridge() {} 8 : NotificationPlatformBridge() {}
9 9
10 StubNotificationPlatformBridge::~StubNotificationPlatformBridge() {} 10 StubNotificationPlatformBridge::~StubNotificationPlatformBridge() {}
11 11
12 Notification StubNotificationPlatformBridge::GetNotificationAt( 12 Notification StubNotificationPlatformBridge::GetNotificationAt(
13 std::string profile_id, 13 std::string profile_id,
14 size_t index) { 14 size_t index) {
15 DCHECK(notifications_.find(profile_id) != notifications_.end()); 15 DCHECK(notifications_.find(profile_id) != notifications_.end());
16 DCHECK_GT(notifications_[profile_id].size(), index); 16 DCHECK_GT(notifications_[profile_id].size(), index);
17 17
18 return notifications_[profile_id][index]; 18 return notifications_[profile_id][index];
19 } 19 }
20 20
21 void StubNotificationPlatformBridge::Display(const std::string& notification_id, 21 void StubNotificationPlatformBridge::Display(
22 const std::string& profile_id, 22 NotificationCommon::Type notification_type,
23 bool incognito, 23 const std::string& notification_id,
24 const Notification& notification) { 24 const std::string& profile_id,
25 bool incognito,
26 const Notification& notification) {
25 notifications_[profile_id].push_back(notification); 27 notifications_[profile_id].push_back(notification);
26 } 28 }
27 29
28 void StubNotificationPlatformBridge::Close(const std::string& profile_id, 30 void StubNotificationPlatformBridge::Close(const std::string& profile_id,
29 const std::string& notification_id) { 31 const std::string& notification_id) {
30 if (notifications_.find(profile_id) == notifications_.end()) 32 if (notifications_.find(profile_id) == notifications_.end())
31 return; 33 return;
32 std::vector<Notification> profile_notifications = notifications_[profile_id]; 34 std::vector<Notification> profile_notifications = notifications_[profile_id];
33 for (auto iter = profile_notifications.begin(); 35 for (auto iter = profile_notifications.begin();
34 iter != profile_notifications.end(); ++iter) { 36 iter != profile_notifications.end(); ++iter) {
(...skipping 16 matching lines...) Expand all
51 const std::vector<Notification>& profile_notifications = 53 const std::vector<Notification>& profile_notifications =
52 notifications_.at(profile_id); 54 notifications_.at(profile_id);
53 for (auto notification : profile_notifications) 55 for (auto notification : profile_notifications)
54 notifications->insert(notification.id()); 56 notifications->insert(notification.id());
55 return true; 57 return true;
56 } 58 }
57 59
58 bool StubNotificationPlatformBridge::SupportsNotificationCenter() const { 60 bool StubNotificationPlatformBridge::SupportsNotificationCenter() const {
59 return false; 61 return false;
60 } 62 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698