Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(752)

Side by Side Diff: content/test/mock_platform_notification_service.cc

Issue 2928303002: Deprecate native and extension notification delegates. (Closed)
Patch Set: review Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/notifications/web_notification_delegate.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 ResourceContext* resource_context, 157 ResourceContext* resource_context,
158 const GURL& origin, 158 const GURL& origin,
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 NotificationEventDispatcher::GetInstance()->DispatchNonPersistentCloseEvent(
168 non_persistent_notifications_.find(notification_id); 168 notification_id);
169 if (non_persistent_iter == non_persistent_notifications_.end()) { 169 non_persistent_notifications_.erase(notification_id);
170 NotificationEventDispatcher::GetInstance()->DispatchNonPersistentCloseEvent(
171 notification_id);
172 non_persistent_notifications_.erase(non_persistent_iter);
173 }
174 } 170 }
175 171
176 void MockPlatformNotificationService::ReplaceNotificationIfNeeded( 172 void MockPlatformNotificationService::ReplaceNotificationIfNeeded(
177 const std::string& notification_id) { 173 const std::string& notification_id) {
178 persistent_notifications_.erase(notification_id); 174 persistent_notifications_.erase(notification_id);
179 non_persistent_notifications_.erase(notification_id); 175 non_persistent_notifications_.erase(notification_id);
180 } 176 }
181 177
182 blink::mojom::PermissionStatus MockPlatformNotificationService::CheckPermission( 178 blink::mojom::PermissionStatus MockPlatformNotificationService::CheckPermission(
183 const GURL& origin) { 179 const GURL& origin) {
184 return blink::mojom::PermissionStatus::GRANTED; 180 return blink::mojom::PermissionStatus::GRANTED;
185 } 181 }
186 182
187 } // namespace content 183 } // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/notifications/web_notification_delegate.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698