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/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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 76 } | 76 } |
| 77 | 77 |
| 78 void LayoutTestNotificationManager::ClosePersistentNotification( | 78 void LayoutTestNotificationManager::ClosePersistentNotification( |
| 79 BrowserContext* browser_context, | 79 BrowserContext* browser_context, |
| 80 const std::string& notification_id) { | 80 const std::string& notification_id) { |
| 81 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 81 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 82 | 82 |
| 83 persistent_notifications_.erase(notification_id); | 83 persistent_notifications_.erase(notification_id); |
| 84 } | 84 } |
| 85 | 85 |
| 86 bool LayoutTestNotificationManager::GetDisplayedNotifications( | 86 void LayoutTestNotificationManager::GetDisplayedNotifications( |
| 87 BrowserContext* browser_context, | 87 BrowserContext* browser_context, |
| 88 std::set<std::string>* displayed_notifications) { | 88 const NotificationResultCallback& callback) { |
| 89 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 89 std::unique_ptr<std::set<std::string>> displayedNotifications = |
|
Peter Beverloo
2017/03/15 18:07:51
nit: displayed_notifications
Miguel Garcia
2017/03/16 14:57:43
Done.
| |
| 90 DCHECK(displayed_notifications); | 90 base::MakeUnique<std::set<std::string>>(); |
| 91 | 91 content::BrowserThread::PostTask( |
| 92 // Notifications will never outlive the lifetime of running layout tests. | 92 content::BrowserThread::UI, FROM_HERE, |
|
Peter Beverloo
2017/03/15 18:07:51
nit: drop content:: from these, you are in that na
Miguel Garcia
2017/03/16 14:57:42
Done.
| |
| 93 return false; | 93 base::Bind(callback, base::Passed(&displayedNotifications), |
| 94 false /* supports getting displayed notifications */)); | |
| 94 } | 95 } |
| 95 | 96 |
| 96 void LayoutTestNotificationManager::SimulateClick( | 97 void LayoutTestNotificationManager::SimulateClick( |
| 97 const std::string& title, | 98 const std::string& title, |
| 98 int action_index, | 99 int action_index, |
| 99 const base::NullableString16& reply) { | 100 const base::NullableString16& reply) { |
| 100 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 101 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 101 | 102 |
| 102 const auto notification_id_iter = notification_id_map_.find(title); | 103 const auto notification_id_iter = notification_id_map_.find(title); |
| 103 if (notification_id_iter == notification_id_map_.end()) | 104 if (notification_id_iter == notification_id_map_.end()) |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 192 LayoutTestNotificationManager::CheckPermission(const GURL& origin) { | 193 LayoutTestNotificationManager::CheckPermission(const GURL& origin) { |
| 193 return LayoutTestContentBrowserClient::Get() | 194 return LayoutTestContentBrowserClient::Get() |
| 194 ->GetLayoutTestBrowserContext() | 195 ->GetLayoutTestBrowserContext() |
| 195 ->GetLayoutTestPermissionManager() | 196 ->GetLayoutTestPermissionManager() |
| 196 ->GetPermissionStatus(PermissionType::NOTIFICATIONS, | 197 ->GetPermissionStatus(PermissionType::NOTIFICATIONS, |
| 197 origin, | 198 origin, |
| 198 origin); | 199 origin); |
| 199 } | 200 } |
| 200 | 201 |
| 201 } // namespace content | 202 } // namespace content |
| OLD | NEW |