OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_test_util.h" | 5 #include "chrome/browser/notifications/notification_test_util.h" |
6 | 6 |
7 MockNotificationDelegate::MockNotificationDelegate(const std::string& id) | 7 MockNotificationDelegate::MockNotificationDelegate(const std::string& id) |
8 : id_(id) {} | 8 : id_(id) {} |
9 | 9 |
10 MockNotificationDelegate::~MockNotificationDelegate() {} | 10 MockNotificationDelegate::~MockNotificationDelegate() {} |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 iter->first.delegate()->Close(false /* by_user */); | 75 iter->first.delegate()->Close(false /* by_user */); |
76 notifications_.erase(iter); | 76 notifications_.erase(iter); |
77 return true; | 77 return true; |
78 } | 78 } |
79 | 79 |
80 return false; | 80 return false; |
81 } | 81 } |
82 | 82 |
83 std::set<std::string> | 83 std::set<std::string> |
84 StubNotificationUIManager::GetAllIdsByProfileAndSourceOrigin( | 84 StubNotificationUIManager::GetAllIdsByProfileAndSourceOrigin( |
85 Profile* profile, | 85 ProfileID profile_id, |
86 const GURL& source) { | 86 const GURL& source) { |
87 std::set<std::string> delegate_ids; | 87 std::set<std::string> delegate_ids; |
88 for (const auto& pair : notifications_) { | 88 for (const auto& pair : notifications_) { |
89 if (pair.second == profile && pair.first.origin_url() == source) | 89 if (pair.second == profile_id && pair.first.origin_url() == source) |
90 delegate_ids.insert(pair.first.delegate_id()); | 90 delegate_ids.insert(pair.first.delegate_id()); |
91 } | 91 } |
92 return delegate_ids; | 92 return delegate_ids; |
93 } | 93 } |
94 | 94 |
95 std::set<std::string> StubNotificationUIManager::GetAllIdsByProfile( | 95 std::set<std::string> StubNotificationUIManager::GetAllIdsByProfile( |
96 Profile* profile) { | 96 ProfileID profile_id) { |
97 std::set<std::string> delegate_ids; | 97 std::set<std::string> delegate_ids; |
98 for (const auto& pair : notifications_) { | 98 for (const auto& pair : notifications_) { |
99 if (pair.second == profile) | 99 if (pair.second == profile_id) |
100 delegate_ids.insert(pair.first.delegate_id()); | 100 delegate_ids.insert(pair.first.delegate_id()); |
101 } | 101 } |
102 return delegate_ids; | 102 return delegate_ids; |
103 } | 103 } |
104 | 104 |
105 bool StubNotificationUIManager::CancelAllBySourceOrigin( | 105 bool StubNotificationUIManager::CancelAllBySourceOrigin( |
106 const GURL& source_origin) { | 106 const GURL& source_origin) { |
107 NOTIMPLEMENTED(); | 107 NOTIMPLEMENTED(); |
108 return false; | 108 return false; |
109 } | 109 } |
110 | 110 |
111 bool StubNotificationUIManager::CancelAllByProfile(ProfileID profile_id) { | 111 bool StubNotificationUIManager::CancelAllByProfile(ProfileID profile_id) { |
112 NOTIMPLEMENTED(); | 112 NOTIMPLEMENTED(); |
113 return false; | 113 return false; |
114 } | 114 } |
115 | 115 |
116 void StubNotificationUIManager::CancelAll() { | 116 void StubNotificationUIManager::CancelAll() { |
117 for (const auto& pair : notifications_) | 117 for (const auto& pair : notifications_) |
118 pair.first.delegate()->Close(false /* by_user */); | 118 pair.first.delegate()->Close(false /* by_user */); |
119 notifications_.clear(); | 119 notifications_.clear(); |
120 } | 120 } |
OLD | NEW |