#include "third_party/blink/renderer/modules/notifications/notification_manager.h"
#include <utility>
#include "base/metrics/histogram_macros.h"
#include "base/numerics/safe_conversions.h"
#include "base/task/single_thread_task_runner.h"
#include "third_party/blink/public/mojom/notifications/notification.mojom-blink.h"
#include "third_party/blink/public/mojom/permissions/permission.mojom-blink.h"
#include "third_party/blink/public/mojom/permissions/permission_status.mojom-blink.h"
#include "third_party/blink/public/platform/browser_interface_broker_proxy.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/renderer/bindings/core/v8/script_promise_resolver.h"
#include "third_party/blink/renderer/bindings/modules/v8/v8_notification_permission.h"
#include "third_party/blink/renderer/core/frame/frame.h"
#include "third_party/blink/renderer/core/frame/local_dom_window.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/modules/notifications/notification.h"
#include "third_party/blink/renderer/modules/notifications/notification_metrics.h"
#include "third_party/blink/renderer/modules/permissions/permission_utils.h"
#include "third_party/blink/renderer/platform/bindings/script_state.h"
#include "third_party/blink/renderer/platform/heap/collection_support/heap_vector.h"
#include "third_party/blink/renderer/platform/heap/member.h"
#include "third_party/blink/renderer/platform/heap/persistent.h"
#include "third_party/blink/renderer/platform/weborigin/security_origin.h"
#include "third_party/blink/renderer/platform/wtf/functional.h"
namespace blink {
NotificationManager* NotificationManager::From(ExecutionContext* context) { … }
const char NotificationManager::kSupplementName[] = …;
NotificationManager::NotificationManager(ExecutionContext& context)
: … { … }
NotificationManager::~NotificationManager() = default;
mojom::blink::PermissionStatus NotificationManager::GetPermissionStatus() { … }
void NotificationManager::GetPermissionStatusAsync(
base::OnceCallback<void(mojom::blink::PermissionStatus)> callback) { … }
ScriptPromise<V8NotificationPermission> NotificationManager::RequestPermission(
ScriptState* script_state,
V8NotificationPermissionCallback* deprecated_callback) { … }
V8NotificationPermission PermissionStatusToEnum(
mojom::blink::PermissionStatus permission) { … }
void NotificationManager::OnPermissionRequestComplete(
ScriptPromiseResolver<V8NotificationPermission>* resolver,
V8NotificationPermissionCallback* deprecated_callback,
mojom::blink::PermissionStatus status) { … }
void NotificationManager::OnNotificationServiceConnectionError() { … }
void NotificationManager::OnPermissionServiceConnectionError() { … }
void NotificationManager::DisplayNonPersistentNotification(
const String& token,
mojom::blink::NotificationDataPtr notification_data,
mojom::blink::NotificationResourcesPtr notification_resources,
mojo::PendingRemote<mojom::blink::NonPersistentNotificationListener>
event_listener) { … }
void NotificationManager::CloseNonPersistentNotification(const String& token) { … }
void NotificationManager::DisplayPersistentNotification(
int64_t service_worker_registration_id,
mojom::blink::NotificationDataPtr notification_data,
mojom::blink::NotificationResourcesPtr notification_resources,
ScriptPromiseResolver<IDLUndefined>* resolver) { … }
void NotificationManager::DidDisplayPersistentNotification(
ScriptPromiseResolver<IDLUndefined>* resolver,
mojom::blink::PersistentNotificationError error) { … }
void NotificationManager::ClosePersistentNotification(
const WebString& notification_id) { … }
void NotificationManager::GetNotifications(
int64_t service_worker_registration_id,
const WebString& filter_tag,
bool include_triggered,
ScriptPromiseResolver<IDLSequence<Notification>>* resolver) { … }
void NotificationManager::DidGetNotifications(
ScriptPromiseResolver<IDLSequence<Notification>>* resolver,
const Vector<String>& notification_ids,
Vector<mojom::blink::NotificationDataPtr> notification_datas) { … }
mojom::blink::NotificationService*
NotificationManager::GetNotificationService() { … }
void NotificationManager::Trace(Visitor* visitor) const { … }
}