| 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 "chrome/browser/notifications/platform_notification_service_impl.h" | 5 #include "chrome/browser/notifications/platform_notification_service_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 GetNotificationDisplayService(profile)->Close(NotificationCommon::PERSISTENT, | 360 GetNotificationDisplayService(profile)->Close(NotificationCommon::PERSISTENT, |
| 361 notification_id); | 361 notification_id); |
| 362 } | 362 } |
| 363 | 363 |
| 364 bool PlatformNotificationServiceImpl::GetDisplayedPersistentNotifications( | 364 bool PlatformNotificationServiceImpl::GetDisplayedPersistentNotifications( |
| 365 BrowserContext* browser_context, | 365 BrowserContext* browser_context, |
| 366 std::set<std::string>* displayed_notifications) { | 366 std::set<std::string>* displayed_notifications) { |
| 367 DCHECK(displayed_notifications); | 367 DCHECK(displayed_notifications); |
| 368 | 368 |
| 369 Profile* profile = Profile::FromBrowserContext(browser_context); | 369 Profile* profile = Profile::FromBrowserContext(browser_context); |
| 370 if (!profile || profile->AsTestingProfile()) | 370 if (!profile) |
| 371 return false; // Tests will not have a message center. | 371 return false; |
| 372 |
| 373 NotificationDisplayService* display_service = |
| 374 GetNotificationDisplayService(profile); |
| 375 if (!display_service) { |
| 376 // Tests might not have a browser process |
| 377 DCHECK(profile->AsTestingProfile()); |
| 378 return false; |
| 379 } |
| 372 | 380 |
| 373 // TODO(peter): Filter for persistent notifications only. | 381 // TODO(peter): Filter for persistent notifications only. |
| 374 return GetNotificationDisplayService(profile)->GetDisplayed( | 382 return GetNotificationDisplayService(profile)->GetDisplayed( |
| 375 displayed_notifications); | 383 displayed_notifications); |
| 376 } | 384 } |
| 377 | 385 |
| 378 void PlatformNotificationServiceImpl::OnClickEventDispatchComplete( | 386 void PlatformNotificationServiceImpl::OnClickEventDispatchComplete( |
| 379 content::PersistentNotificationStatus status) { | 387 content::PersistentNotificationStatus status) { |
| 380 UMA_HISTOGRAM_ENUMERATION( | 388 UMA_HISTOGRAM_ENUMERATION( |
| 381 "Notifications.PersistentWebNotificationClickResult", status, | 389 "Notifications.PersistentWebNotificationClickResult", status, |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 } | 505 } |
| 498 #endif | 506 #endif |
| 499 | 507 |
| 500 return base::string16(); | 508 return base::string16(); |
| 501 } | 509 } |
| 502 | 510 |
| 503 void PlatformNotificationServiceImpl::SetNotificationDisplayServiceForTesting( | 511 void PlatformNotificationServiceImpl::SetNotificationDisplayServiceForTesting( |
| 504 NotificationDisplayService* display_service) { | 512 NotificationDisplayService* display_service) { |
| 505 test_display_service_ = display_service; | 513 test_display_service_ = display_service; |
| 506 } | 514 } |
| OLD | NEW |