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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 const PersistentNotification& notification = persistent_iterator->second; | 130 const PersistentNotification& notification = persistent_iterator->second; |
131 content::NotificationEventDispatcher::GetInstance() | 131 content::NotificationEventDispatcher::GetInstance() |
132 ->DispatchNotificationCloseEvent( | 132 ->DispatchNotificationCloseEvent( |
133 notification.browser_context, | 133 notification.browser_context, |
134 notification.persistent_id, | 134 notification.persistent_id, |
135 notification.origin, | 135 notification.origin, |
136 by_user, | 136 by_user, |
137 base::Bind(&OnEventDispatchComplete)); | 137 base::Bind(&OnEventDispatchComplete)); |
138 } | 138 } |
139 | 139 |
140 permissions::mojom::PermissionStatus | 140 blink::mojom::PermissionStatus |
141 LayoutTestNotificationManager::CheckPermissionOnUIThread( | 141 LayoutTestNotificationManager::CheckPermissionOnUIThread( |
142 BrowserContext* browser_context, | 142 BrowserContext* browser_context, |
143 const GURL& origin, | 143 const GURL& origin, |
144 int render_process_id) { | 144 int render_process_id) { |
145 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 145 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
146 return CheckPermission(origin); | 146 return CheckPermission(origin); |
147 } | 147 } |
148 | 148 |
149 permissions::mojom::PermissionStatus | 149 blink::mojom::PermissionStatus |
150 LayoutTestNotificationManager::CheckPermissionOnIOThread( | 150 LayoutTestNotificationManager::CheckPermissionOnIOThread( |
151 ResourceContext* resource_context, | 151 ResourceContext* resource_context, |
152 const GURL& origin, | 152 const GURL& origin, |
153 int render_process_id) { | 153 int render_process_id) { |
154 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 154 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
155 return CheckPermission(origin); | 155 return CheckPermission(origin); |
156 } | 156 } |
157 | 157 |
158 void LayoutTestNotificationManager::Close(const std::string& title) { | 158 void LayoutTestNotificationManager::Close(const std::string& title) { |
159 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 159 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
(...skipping 28 matching lines...) Expand all Loading... |
188 | 188 |
189 const auto& persistent_notification_iter = | 189 const auto& persistent_notification_iter = |
190 persistent_notifications_.find(previous_title); | 190 persistent_notifications_.find(previous_title); |
191 if (persistent_notification_iter != persistent_notifications_.end()) | 191 if (persistent_notification_iter != persistent_notifications_.end()) |
192 persistent_notifications_.erase(persistent_notification_iter); | 192 persistent_notifications_.erase(persistent_notification_iter); |
193 } | 193 } |
194 | 194 |
195 replacements_[tag] = base::UTF16ToUTF8(notification_data.title); | 195 replacements_[tag] = base::UTF16ToUTF8(notification_data.title); |
196 } | 196 } |
197 | 197 |
198 permissions::mojom::PermissionStatus | 198 blink::mojom::PermissionStatus |
199 LayoutTestNotificationManager::CheckPermission(const GURL& origin) { | 199 LayoutTestNotificationManager::CheckPermission(const GURL& origin) { |
200 return LayoutTestContentBrowserClient::Get() | 200 return LayoutTestContentBrowserClient::Get() |
201 ->GetLayoutTestBrowserContext() | 201 ->GetLayoutTestBrowserContext() |
202 ->GetLayoutTestPermissionManager() | 202 ->GetLayoutTestPermissionManager() |
203 ->GetPermissionStatus(PermissionType::NOTIFICATIONS, | 203 ->GetPermissionStatus(PermissionType::NOTIFICATIONS, |
204 origin, | 204 origin, |
205 origin); | 205 origin); |
206 } | 206 } |
207 | 207 |
208 } // namespace content | 208 } // namespace content |
OLD | NEW |