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

Side by Side Diff: chrome/browser/notifications/platform_notification_service_impl.cc

Issue 2714743002: Retrive displayed notifications asynchronously
Patch Set: apply review comments from https://codereview.chromium.org/2709213005/ Created 3 years, 9 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
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 "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 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 DCHECK_CURRENTLY_ON(BrowserThread::UI); 376 DCHECK_CURRENTLY_ON(BrowserThread::UI);
377 377
378 Profile* profile = Profile::FromBrowserContext(browser_context); 378 Profile* profile = Profile::FromBrowserContext(browser_context);
379 if (!profile || profile->AsTestingProfile()) 379 if (!profile || profile->AsTestingProfile())
380 return false; // Tests will not have a message center. 380 return false; // Tests will not have a message center.
381 381
382 return GetNotificationDisplayService(profile)->GetDisplayed( 382 return GetNotificationDisplayService(profile)->GetDisplayed(
383 displayed_notifications); 383 displayed_notifications);
384 } 384 }
385 385
386 void PlatformNotificationServiceImpl::GetDisplayedNotificationsAsync(
387 BrowserContext* browser_context,
388 const NotificationCommon::NotificationResultCallback& callback) {
389 DCHECK_CURRENTLY_ON(BrowserThread::UI);
390
391 Profile* profile = Profile::FromBrowserContext(browser_context);
392 if (!profile || profile->AsTestingProfile())
393 return; // Tests will not have a message center.
394
395 GetNotificationDisplayService(profile)->GetDisplayedAsync(callback);
396 }
397
386 void PlatformNotificationServiceImpl::OnClickEventDispatchComplete( 398 void PlatformNotificationServiceImpl::OnClickEventDispatchComplete(
387 content::PersistentNotificationStatus status) { 399 content::PersistentNotificationStatus status) {
388 UMA_HISTOGRAM_ENUMERATION( 400 UMA_HISTOGRAM_ENUMERATION(
389 "Notifications.PersistentWebNotificationClickResult", status, 401 "Notifications.PersistentWebNotificationClickResult", status,
390 content::PersistentNotificationStatus:: 402 content::PersistentNotificationStatus::
391 PERSISTENT_NOTIFICATION_STATUS_MAX); 403 PERSISTENT_NOTIFICATION_STATUS_MAX);
392 #if BUILDFLAG(ENABLE_BACKGROUND) 404 #if BUILDFLAG(ENABLE_BACKGROUND)
393 DCHECK_GT(pending_click_dispatch_events_, 0); 405 DCHECK_GT(pending_click_dispatch_events_, 0);
394 if (--pending_click_dispatch_events_ == 0) { 406 if (--pending_click_dispatch_events_ == 0) {
395 click_dispatch_keep_alive_.reset(); 407 click_dispatch_keep_alive_.reset();
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
512 } 524 }
513 #endif 525 #endif
514 526
515 return base::string16(); 527 return base::string16();
516 } 528 }
517 529
518 void PlatformNotificationServiceImpl::SetNotificationDisplayServiceForTesting( 530 void PlatformNotificationServiceImpl::SetNotificationDisplayServiceForTesting(
519 NotificationDisplayService* display_service) { 531 NotificationDisplayService* display_service) {
520 test_display_service_ = display_service; 532 test_display_service_ = display_service;
521 } 533 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698