OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/test/mock_platform_notification_service.h" | 5 #include "content/test/mock_platform_notification_service.h" |
6 | 6 |
7 #include "base/guid.h" | 7 #include "base/guid.h" |
8 #include "base/strings/nullable_string16.h" | 8 #include "base/strings/nullable_string16.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 int render_process_id) { | 159 int render_process_id) { |
160 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 160 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
161 return CheckPermission(origin); | 161 return CheckPermission(origin); |
162 } | 162 } |
163 | 163 |
164 void MockPlatformNotificationService::Close( | 164 void MockPlatformNotificationService::Close( |
165 const std::string& notification_id) { | 165 const std::string& notification_id) { |
166 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 166 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
167 const auto non_persistent_iter = | 167 const auto non_persistent_iter = |
168 non_persistent_notifications_.find(notification_id); | 168 non_persistent_notifications_.find(notification_id); |
169 if (non_persistent_iter == non_persistent_notifications_.end()) { | 169 content::NotificationEventDispatcher::GetInstance() |
170 NotificationEventDispatcher::GetInstance()->DispatchNonPersistentCloseEvent( | 170 ->DispatchNonPersistentCloseEvent(notification_id); |
171 notification_id); | 171 non_persistent_notifications_.erase(non_persistent_iter); |
172 non_persistent_notifications_.erase(non_persistent_iter); | |
173 } | |
174 } | 172 } |
175 | 173 |
176 void MockPlatformNotificationService::ReplaceNotificationIfNeeded( | 174 void MockPlatformNotificationService::ReplaceNotificationIfNeeded( |
177 const std::string& notification_id) { | 175 const std::string& notification_id) { |
178 persistent_notifications_.erase(notification_id); | 176 persistent_notifications_.erase(notification_id); |
179 non_persistent_notifications_.erase(notification_id); | 177 non_persistent_notifications_.erase(notification_id); |
180 } | 178 } |
181 | 179 |
182 blink::mojom::PermissionStatus MockPlatformNotificationService::CheckPermission( | 180 blink::mojom::PermissionStatus MockPlatformNotificationService::CheckPermission( |
183 const GURL& origin) { | 181 const GURL& origin) { |
184 return blink::mojom::PermissionStatus::GRANTED; | 182 return blink::mojom::PermissionStatus::GRANTED; |
185 } | 183 } |
186 | 184 |
187 } // namespace content | 185 } // namespace content |
OLD | NEW |