Chromium Code Reviews| 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 // TODO(johnme): Pass action_index once it's supported. | 116 DCHECK_EQ(action_index, -1) << "Action buttons are only supported for " |
|
Peter Beverloo
2015/10/21 17:02:52
Can we have a constant please? That also removes t
johnme
2015/10/21 18:11:31
I'll add the constant in a follow-up patch to avoi
| |
| 117 "persistent notifications"; | |
| 117 page_iterator->second->NotificationClick(); | 118 page_iterator->second->NotificationClick(); |
| 118 return; | 119 return; |
| 119 } | 120 } |
| 120 | 121 |
| 121 // Then check for persistent notifications with the given title. | 122 // Then check for persistent notifications with the given title. |
| 122 const auto& persistent_iterator = persistent_notifications_.find(title); | 123 const auto& persistent_iterator = persistent_notifications_.find(title); |
| 123 if (persistent_iterator == persistent_notifications_.end()) | 124 if (persistent_iterator == persistent_notifications_.end()) |
| 124 return; | 125 return; |
| 125 | 126 |
| 126 const PersistentNotification& notification = persistent_iterator->second; | 127 const PersistentNotification& notification = persistent_iterator->second; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 195 LayoutTestNotificationManager::CheckPermission(const GURL& origin) { | 196 LayoutTestNotificationManager::CheckPermission(const GURL& origin) { |
| 196 return ToWebNotificationPermission(LayoutTestContentBrowserClient::Get() | 197 return ToWebNotificationPermission(LayoutTestContentBrowserClient::Get() |
| 197 ->GetLayoutTestBrowserContext() | 198 ->GetLayoutTestBrowserContext() |
| 198 ->GetLayoutTestPermissionManager() | 199 ->GetLayoutTestPermissionManager() |
| 199 ->GetPermissionStatus(PermissionType::NOTIFICATIONS, | 200 ->GetPermissionStatus(PermissionType::NOTIFICATIONS, |
| 200 origin, | 201 origin, |
| 201 origin)); | 202 origin)); |
| 202 } | 203 } |
| 203 | 204 |
| 204 } // namespace content | 205 } // namespace content |
| OLD | NEW |