261954137b
* chore: bump chromium in DEPS to 128.0.6571.0 Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> * 5636652: [4/n] Introduce RenderInputRouterClient and move InputRouterClient implementation to RenderInputRouter. https://chromium-review.googlesource.com/c/chromium/src/+/5636652 Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * 5655811: Revert "Reland "Reland "Add toolchains without PartitionAlloc-Everywhere for dump_syms et al""" https://chromium-review.googlesource.com/c/chromium/src/+/5655811 Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * 5581006: [tracing] Forward startup tracing config as shmem https://chromium-review.googlesource.com/c/chromium/src/+/5581006 Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * chore: fixup patch indices Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * 5608450: [Views AX] Move Image Auto Captioning strings to ui/ https://chromium-review.googlesource.com/c/chromium/src/+/5608450 Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * 5648900: [Extensions] Move ExtensionAPIEnabledForServiceWorkerScript() https://chromium-review.googlesource.com/c/chromium/src/+/5648900 Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * 5651681: Remove Web Speech API profanity masking https://chromium-review.googlesource.com/c/chromium/src/+/5651681 Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * 5651361: `content::RenderFrame::GetBrowserInterfaceBroker`: return a const-ref. https://chromium-review.googlesource.com/c/chromium/src/+/5651361 Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * 5604943: Start capture of toolbar after gesture end events are received https://chromium-review.googlesource.com/c/chromium/src/+/5604943 Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * 5624392: [BRP] Enforce raw_ptr/ref in Renderer code https://chromium-review.googlesource.com/c/chromium/src/+/5624392 Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * 5659259: Portals: Remove WebContentsView::TransferDragSecurityInfo https://chromium-review.googlesource.com/c/chromium/src/+/5659259 Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * 5230721: Move ComposeStatus to components/compose https://chromium-review.googlesource.com/c/chromium/src/+/5230721 Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> * 5647894: [api] Cleanup usages of v8::ReturnValue<void>::Set[NonEmpty](..) https://chromium-review.googlesource.com/c/v8/v8/+/5647894 Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com> --------- Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com> Co-authored-by: electron-roller[bot] <84116207+electron-roller[bot]@users.noreply.github.com> Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
72 lines
2.4 KiB
C++
72 lines
2.4 KiB
C++
// Copyright (c) 2019 Slack Technologies, Inc.
|
|
// Use of this source code is governed by the MIT license that can be
|
|
// found in the LICENSE file.
|
|
|
|
#ifndef ELECTRON_SHELL_RENDERER_ELECTRON_API_SERVICE_IMPL_H_
|
|
#define ELECTRON_SHELL_RENDERER_ELECTRON_API_SERVICE_IMPL_H_
|
|
|
|
#include <string>
|
|
|
|
#include "base/memory/weak_ptr.h"
|
|
#include "content/public/renderer/render_frame.h"
|
|
#include "content/public/renderer/render_frame_observer.h"
|
|
#include "electron/buildflags/buildflags.h"
|
|
#include "electron/shell/common/api/api.mojom.h"
|
|
#include "mojo/public/cpp/bindings/pending_receiver.h"
|
|
#include "mojo/public/cpp/bindings/receiver.h"
|
|
|
|
namespace electron {
|
|
|
|
class RendererClientBase;
|
|
|
|
class ElectronApiServiceImpl : public mojom::ElectronRenderer,
|
|
public content::RenderFrameObserver {
|
|
public:
|
|
ElectronApiServiceImpl(content::RenderFrame* render_frame,
|
|
RendererClientBase* renderer_client);
|
|
~ElectronApiServiceImpl() override;
|
|
|
|
// disable copy
|
|
ElectronApiServiceImpl(const ElectronApiServiceImpl&) = delete;
|
|
ElectronApiServiceImpl& operator=(const ElectronApiServiceImpl&) = delete;
|
|
|
|
void BindTo(mojo::PendingReceiver<mojom::ElectronRenderer> receiver);
|
|
|
|
void Message(bool internal,
|
|
const std::string& channel,
|
|
blink::CloneableMessage arguments) override;
|
|
void ReceivePostMessage(const std::string& channel,
|
|
blink::TransferableMessage message) override;
|
|
void TakeHeapSnapshot(mojo::ScopedHandle file,
|
|
TakeHeapSnapshotCallback callback) override;
|
|
void ProcessPendingMessages();
|
|
|
|
base::WeakPtr<ElectronApiServiceImpl> GetWeakPtr() {
|
|
return weak_factory_.GetWeakPtr();
|
|
}
|
|
|
|
void OnInterfaceRequestForFrame(
|
|
const std::string& interface_name,
|
|
mojo::ScopedMessagePipeHandle* interface_pipe) override;
|
|
|
|
private:
|
|
// RenderFrameObserver implementation.
|
|
void DidCreateDocumentElement() override;
|
|
void OnDestruct() override;
|
|
|
|
void OnConnectionError();
|
|
|
|
// Whether the DOM document element has been created.
|
|
bool document_created_ = false;
|
|
service_manager::BinderRegistry registry_;
|
|
|
|
mojo::PendingReceiver<mojom::ElectronRenderer> pending_receiver_;
|
|
mojo::Receiver<mojom::ElectronRenderer> receiver_{this};
|
|
|
|
raw_ptr<RendererClientBase> renderer_client_;
|
|
base::WeakPtrFactory<ElectronApiServiceImpl> weak_factory_{this};
|
|
};
|
|
|
|
} // namespace electron
|
|
|
|
#endif // ELECTRON_SHELL_RENDERER_ELECTRON_API_SERVICE_IMPL_H_
|