| Index: content/child/push_messaging/push_provider.h
|
| diff --git a/content/child/push_messaging/push_provider.h b/content/child/push_messaging/push_provider.h
|
| index 9d554fe8ed61251204077ffa083030dd0ec1a00d..1b9c9a7af8e01622413fde2d00f71aa4a80dc491 100644
|
| --- a/content/child/push_messaging/push_provider.h
|
| +++ b/content/child/push_messaging/push_provider.h
|
| @@ -11,10 +11,9 @@
|
| #include <string>
|
| #include <vector>
|
|
|
| -#include "base/id_map.h"
|
| #include "base/macros.h"
|
| #include "base/memory/ref_counted.h"
|
| -#include "content/child/push_messaging/push_dispatcher.h"
|
| +#include "content/common/push_messaging.mojom.h"
|
| #include "content/public/child/worker_thread.h"
|
| #include "content/public/common/push_messaging_status.h"
|
| #include "third_party/WebKit/public/platform/modules/push_messaging/WebPushError.h"
|
| @@ -28,7 +27,6 @@ struct WebPushSubscriptionOptions;
|
|
|
| namespace content {
|
|
|
| -class ThreadSafeSender;
|
| struct PushSubscriptionOptions;
|
|
|
| blink::WebPushError PushRegistrationStatusToWebPushError(
|
| @@ -39,11 +37,9 @@ class PushProvider : public blink::WebPushProvider,
|
| public:
|
| ~PushProvider() override;
|
|
|
| - // The |thread_safe_sender| and |push_dispatcher| are used if calling this
|
| - // leads to construction.
|
| static PushProvider* ThreadSpecificInstance(
|
| - ThreadSafeSender* thread_safe_sender,
|
| - PushDispatcher* push_dispatcher);
|
| + const scoped_refptr<base::SingleThreadTaskRunner>&
|
| + main_thread_task_runner);
|
|
|
| // WorkerThread::Observer implementation.
|
| void WillStopCurrentWorkerThread() override;
|
| @@ -65,53 +61,42 @@ class PushProvider : public blink::WebPushProvider,
|
| std::unique_ptr<blink::WebPushPermissionStatusCallbacks> callbacks)
|
| override;
|
|
|
| - // Called by the PushDispatcher.
|
| - bool OnMessageReceived(const IPC::Message& message);
|
| -
|
| private:
|
| - PushProvider(ThreadSafeSender* thread_safe_sender,
|
| - PushDispatcher* push_dispatcher);
|
| -
|
| - // IPC message handlers.
|
| - void OnSubscribeFromWorkerSuccess(int request_id,
|
| - const GURL& endpoint,
|
| - const PushSubscriptionOptions& options,
|
| - const std::vector<uint8_t>& p256dh,
|
| - const std::vector<uint8_t>& auth);
|
| - void OnSubscribeFromWorkerError(int request_id,
|
| - PushRegistrationStatus status);
|
| - void OnUnsubscribeSuccess(int request_id, bool did_unsubscribe);
|
| - void OnUnsubscribeError(int request_id,
|
| - blink::WebPushError::ErrorType error_type,
|
| - const std::string& error_message);
|
| - void OnGetSubscriptionSuccess(int request_id,
|
| - const GURL& endpoint,
|
| - const PushSubscriptionOptions& options,
|
| - const std::vector<uint8_t>& p256dh,
|
| - const std::vector<uint8_t>& auth);
|
| - void OnGetSubscriptionError(int request_id, PushGetRegistrationStatus status);
|
| - void OnGetPermissionStatusSuccess(int request_id,
|
| - blink::WebPushPermissionStatus status);
|
| - void OnGetPermissionStatusError(int request_id,
|
| - blink::WebPushError::ErrorType error);
|
| -
|
| - scoped_refptr<ThreadSafeSender> thread_safe_sender_;
|
| - scoped_refptr<PushDispatcher> push_dispatcher_;
|
| -
|
| - // Stores the subscription callbacks with their request ids. This class owns
|
| - // the callbacks.
|
| - IDMap<std::unique_ptr<blink::WebPushSubscriptionCallbacks>>
|
| - subscription_callbacks_;
|
| -
|
| - // Stores the permission status callbacks with their request ids. This class
|
| - // owns the callbacks.
|
| - IDMap<std::unique_ptr<blink::WebPushPermissionStatusCallbacks>>
|
| - permission_status_callbacks_;
|
| -
|
| - // Stores the unsubscription callbacks with their request ids. This class owns
|
| - // the callbacks.
|
| - IDMap<std::unique_ptr<blink::WebPushUnsubscribeCallbacks>>
|
| - unsubscribe_callbacks_;
|
| + explicit PushProvider(const scoped_refptr<base::SingleThreadTaskRunner>&
|
| + main_thread_task_runner);
|
| +
|
| + static void GetInterface(mojom::PushMessagingRequest request);
|
| +
|
| + void SubscribeCallback(
|
| + std::unique_ptr<blink::WebPushSubscriptionCallbacks> callbacks,
|
| + content::PushRegistrationStatus status,
|
| + const base::Optional<GURL>& endpoint,
|
| + const base::Optional<content::PushSubscriptionOptions>& options,
|
| + const base::Optional<std::vector<uint8_t>>& p256dh,
|
| + const base::Optional<std::vector<uint8_t>>& auth);
|
| +
|
| + void UnsubscribeCallback(
|
| + std::unique_ptr<blink::WebPushUnsubscribeCallbacks> callbacks,
|
| + bool is_success,
|
| + bool did_unsubscribe,
|
| + blink::WebPushError::ErrorType error_type,
|
| + const base::Optional<std::string>& error_message);
|
| +
|
| + void GetSubscriptionCallback(
|
| + std::unique_ptr<blink::WebPushSubscriptionCallbacks> callbacks,
|
| + content::PushGetRegistrationStatus status,
|
| + const base::Optional<GURL>& endpoint,
|
| + const base::Optional<content::PushSubscriptionOptions>& options,
|
| + const base::Optional<std::vector<uint8_t>>& p256dh,
|
| + const base::Optional<std::vector<uint8_t>>& auth);
|
| +
|
| + void GetPermissionStatusCallback(
|
| + std::unique_ptr<blink::WebPushPermissionStatusCallbacks> callbacks,
|
| + bool is_success,
|
| + blink::WebPushPermissionStatus status,
|
| + blink::WebPushError::ErrorType error);
|
| +
|
| + mojom::PushMessagingPtr push_messaging_manager_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(PushProvider);
|
| };
|
|
|