summaryrefslogtreecommitdiffstats
path: root/chrome/browser/push_messaging/push_messaging_service_impl.h
diff options
context:
space:
mode:
authorjohnme <johnme@chromium.org>2015-04-30 08:22:54 -0700
committerCommit bot <commit-bot@chromium.org>2015-04-30 15:23:29 +0000
commit830ecef7ea5e4fb162fb7cfdc6be2cbe4fd1d52b (patch)
treeb7cbd9e1bf2eef70047e6e9d2ec2b3516c2411a4 /chrome/browser/push_messaging/push_messaging_service_impl.h
parentebaa4791c7a6f1c58a93e60b1f428a69a0d7e927 (diff)
downloadchromium_src-830ecef7ea5e4fb162fb7cfdc6be2cbe4fd1d52b.zip
chromium_src-830ecef7ea5e4fb162fb7cfdc6be2cbe4fd1d52b.tar.gz
chromium_src-830ecef7ea5e4fb162fb7cfdc6be2cbe4fd1d52b.tar.bz2
Push API: Forced notifications should use Notifications database
1. Writes to the Notifications database when creating forced notifications. 2. Uses Notifications database when counting notifications, instead of the unreliable NotificationUIManager APIs. This gives more reliable values after browser restarts. BUG=437277 TBR=avi@chromium.org Review URL: https://codereview.chromium.org/1099093003 Cr-Commit-Position: refs/heads/master@{#327716}
Diffstat (limited to 'chrome/browser/push_messaging/push_messaging_service_impl.h')
-rw-r--r--chrome/browser/push_messaging/push_messaging_service_impl.h48
1 files changed, 43 insertions, 5 deletions
diff --git a/chrome/browser/push_messaging/push_messaging_service_impl.h b/chrome/browser/push_messaging/push_messaging_service_impl.h
index 2a4ed65..1c6370e 100644
--- a/chrome/browser/push_messaging/push_messaging_service_impl.h
+++ b/chrome/browser/push_messaging/push_messaging_service_impl.h
@@ -5,6 +5,8 @@
#ifndef CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_SERVICE_IMPL_H_
#define CHROME_BROWSER_PUSH_MESSAGING_PUSH_MESSAGING_SERVICE_IMPL_H_
+#include <stdint.h>
+
#include "base/callback.h"
#include "base/compiler_specific.h"
#include "base/memory/weak_ptr.h"
@@ -20,8 +22,9 @@
class Profile;
class PushMessagingApplicationId;
-namespace user_prefs {
-class PrefRegistrySyncable;
+namespace content {
+struct NotificationDatabaseData;
+struct PlatformNotificationData;
}
namespace gcm {
@@ -29,6 +32,10 @@ class GCMDriver;
class GCMProfileService;
}
+namespace user_prefs {
+class PrefRegistrySyncable;
+}
+
class PushMessagingServiceImpl : public content::PushMessagingService,
public gcm::GCMAppHandler,
public content_settings::Observer,
@@ -113,11 +120,27 @@ class PushMessagingServiceImpl : public content::PushMessagingService,
// happened in the background. When they forget to do so, display a default
// notification on their behalf.
void RequireUserVisibleUX(const GURL& requesting_origin,
- int64 service_worker_registration_id,
+ int64_t service_worker_registration_id,
const base::Closure& message_handled_closure);
- void DidGetNotificationsShown(
+
+ static void DidGetNotificationsFromDatabaseIOProxy(
+ const base::WeakPtr<PushMessagingServiceImpl>& ui_weak_ptr,
const GURL& requesting_origin,
- int64 service_worker_registration_id,
+ int64_t service_worker_registration_id,
+ const base::Closure& message_handled_closure,
+ bool success,
+ const std::vector<content::NotificationDatabaseData>& data);
+
+ void DidGetNotificationsFromDatabase(
+ const GURL& requesting_origin,
+ int64_t service_worker_registration_id,
+ const base::Closure& message_handled_closure,
+ bool success,
+ const std::vector<content::NotificationDatabaseData>& data);
+
+ void DidGetNotificationsShownAndNeeded(
+ const GURL& requesting_origin,
+ int64_t service_worker_registration_id,
bool notification_shown,
bool notification_needed,
const base::Closure& message_handled_closure,
@@ -125,6 +148,21 @@ class PushMessagingServiceImpl : public content::PushMessagingService,
bool success,
bool not_found);
+ static void DidWriteNotificationDataIOProxy(
+ const base::WeakPtr<PushMessagingServiceImpl>& ui_weak_ptr,
+ const GURL& requesting_origin,
+ const content::PlatformNotificationData& notification_data,
+ const base::Closure& message_handled_closure,
+ bool success,
+ int64_t persistent_notification_id);
+
+ void DidWriteNotificationData(
+ const GURL& requesting_origin,
+ const content::PlatformNotificationData& notification_data,
+ const base::Closure& message_handled_closure,
+ bool success,
+ int64_t persistent_notification_id);
+
// Register methods ----------------------------------------------------------
void RegisterEnd(