chromium/pdf/post_message_receiver.h

// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef PDF_POST_MESSAGE_RECEIVER_H_
#define PDF_POST_MESSAGE_RECEIVER_H_

#include <memory>

#include "base/memory/raw_ptr.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
#include "base/values.h"
#include "gin/interceptor.h"
#include "gin/public/wrapper_info.h"
#include "gin/wrappable.h"
#include "v8/include/v8.h"

namespace base {
class SequencedTaskRunner;
}  // namespace base

namespace gin {
class ObjectTemplateBuilder;
}  // namespace gin

namespace chrome_pdf {

class V8ValueConverter;

// Implements the `postMessage()` API exposed to the plugin embedder. The
// received messages are converted and forwarded to the `Client`.
// `PostMessageReceiver`'s lifetime is managed by the V8 garbage collector,
// meaning it can outlive the `Client`. Messages are dropped if the `Client` is
// destroyed.
class PostMessageReceiver final : public gin::Wrappable<PostMessageReceiver>,
                                  public gin::NamedPropertyInterceptor {};

}  // namespace chrome_pdf

#endif  // PDF_POST_MESSAGE_RECEIVER_H_