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/shell/browser/layout_test/layout_test_notification_manager.h" | 5 #include "content/shell/browser/layout_test/layout_test_notification_manager.h" |
6 | 6 |
7 #include "base/guid.h" | 7 #include "base/guid.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
10 #include "content/public/browser/desktop_notification_delegate.h" | 10 #include "content/public/browser/desktop_notification_delegate.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 return false; | 106 return false; |
107 } | 107 } |
108 | 108 |
109 void LayoutTestNotificationManager::SimulateClick(const std::string& title, | 109 void LayoutTestNotificationManager::SimulateClick(const std::string& title, |
110 int action_index) { | 110 int action_index) { |
111 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 111 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
112 | 112 |
113 // First check for page-notifications with the given title. | 113 // First check for page-notifications with the given title. |
114 const auto& page_iterator = page_notifications_.find(title); | 114 const auto& page_iterator = page_notifications_.find(title); |
115 if (page_iterator != page_notifications_.end()) { | 115 if (page_iterator != page_notifications_.end()) { |
116 DCHECK_EQ(action_index, -1) << "Action buttons are only supported for " | 116 DCHECK_EQ(action_index, |
117 "persistent notifications"; | 117 kNotificationClickWasNotAnAction) << "Action buttons are only " |
| 118 "supported for persistent " |
| 119 "notifications"; |
118 page_iterator->second->NotificationClick(); | 120 page_iterator->second->NotificationClick(); |
119 return; | 121 return; |
120 } | 122 } |
121 | 123 |
122 // Then check for persistent notifications with the given title. | 124 // Then check for persistent notifications with the given title. |
123 const auto& persistent_iterator = persistent_notifications_.find(title); | 125 const auto& persistent_iterator = persistent_notifications_.find(title); |
124 if (persistent_iterator == persistent_notifications_.end()) | 126 if (persistent_iterator == persistent_notifications_.end()) |
125 return; | 127 return; |
126 | 128 |
127 const PersistentNotification& notification = persistent_iterator->second; | 129 const PersistentNotification& notification = persistent_iterator->second; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
196 LayoutTestNotificationManager::CheckPermission(const GURL& origin) { | 198 LayoutTestNotificationManager::CheckPermission(const GURL& origin) { |
197 return ToWebNotificationPermission(LayoutTestContentBrowserClient::Get() | 199 return ToWebNotificationPermission(LayoutTestContentBrowserClient::Get() |
198 ->GetLayoutTestBrowserContext() | 200 ->GetLayoutTestBrowserContext() |
199 ->GetLayoutTestPermissionManager() | 201 ->GetLayoutTestPermissionManager() |
200 ->GetPermissionStatus(PermissionType::NOTIFICATIONS, | 202 ->GetPermissionStatus(PermissionType::NOTIFICATIONS, |
201 origin, | 203 origin, |
202 origin)); | 204 origin)); |
203 } | 205 } |
204 | 206 |
205 } // namespace content | 207 } // namespace content |
OLD | NEW |