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

Unified Diff: chrome/browser/push_messaging/push_messaging_notification_manager.cc

Issue 1462923002: PushMessagingNotificationManager: utility function to get StoragePartition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename to GetStoragePartition. Created 5 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/push_messaging/push_messaging_notification_manager.cc
diff --git a/chrome/browser/push_messaging/push_messaging_notification_manager.cc b/chrome/browser/push_messaging/push_messaging_notification_manager.cc
index c26f0b65f9a1136ad783f3d92c69a95ae27a7d58..8dada7268842e657f3e764baff029db621e0a171 100644
--- a/chrome/browser/push_messaging/push_messaging_notification_manager.cc
+++ b/chrome/browser/push_messaging/push_messaging_notification_manager.cc
@@ -48,6 +48,11 @@ void RecordUserVisibleStatus(content::PushUserVisibleStatus status) {
content::PUSH_USER_VISIBLE_STATUS_LAST + 1);
}
+content::StoragePartition* GetStoragePartition(Profile* profile,
+ const GURL& origin) {
+ return content::BrowserContext::GetStoragePartitionForSite(profile, origin);
+}
+
} // namespace
PushMessagingNotificationManager::PushMessagingNotificationManager(
@@ -63,8 +68,8 @@ void PushMessagingNotificationManager::EnforceUserVisibleOnlyRequirements(
DCHECK_CURRENTLY_ON(BrowserThread::UI);
// TODO(johnme): Relax this heuristic slightly.
scoped_refptr<content::PlatformNotificationContext> notification_context =
- content::BrowserContext::GetStoragePartitionForSite(
- profile_, requesting_origin)->GetPlatformNotificationContext();
+ GetStoragePartition(profile_, requesting_origin)
+ ->GetPlatformNotificationContext();
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
base::Bind(
@@ -181,8 +186,8 @@ void PushMessagingNotificationManager::DidGetNotificationsFromDatabase(
// from needing to do so.
if (notification_shown || notification_needed) {
content::ServiceWorkerContext* service_worker_context =
- content::BrowserContext::GetStoragePartitionForSite(
- profile_, requesting_origin)->GetServiceWorkerContext();
+ GetStoragePartition(profile_, requesting_origin)
+ ->GetServiceWorkerContext();
content::PushMessagingService::GetNotificationsShownByLastFewPushes(
service_worker_context, service_worker_registration_id,
@@ -209,8 +214,8 @@ void PushMessagingNotificationManager::DidGetNotificationsShownAndNeeded(
const std::string& data, bool success, bool not_found) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
content::ServiceWorkerContext* service_worker_context =
- content::BrowserContext::GetStoragePartitionForSite(
- profile_, requesting_origin)->GetServiceWorkerContext();
+ GetStoragePartition(profile_, requesting_origin)
+ ->GetServiceWorkerContext();
// We remember whether the last (up to) 10 pushes showed notifications.
const size_t MISSED_NOTIFICATIONS_LENGTH = 10;
@@ -281,8 +286,8 @@ void PushMessagingNotificationManager::DidGetNotificationsShownAndNeeded(
database_data.notification_data = notification_data;
scoped_refptr<content::PlatformNotificationContext> notification_context =
- content::BrowserContext::GetStoragePartitionForSite(
- profile_, requesting_origin)->GetPlatformNotificationContext();
+ GetStoragePartition(profile_, requesting_origin)
+ ->GetPlatformNotificationContext();
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
base::Bind(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698