ae0c55c0b1
* refactor: use private inheritance in PushNotifications * refactor: use private inheritance in electron::api::App * refactor: use private inheritance in electron::api::BrowserWindow * refactor: use private inheritance in electron::api::NativeTheme * refactor: use private inheritance in electron::api::Tray * refactor: use private inheritance in electron::api::Session * refactor: use private inheritance in electron::api::WebContents * refactor: use private inheritance in electron::api::DownloadItem * refactor: use private inheritance in electron::api::MenuBar * refactor: use private inheritance in ClearDataOperation * refactor: use private inheritance in electron::api::Screen * refactor: use private inheritance in electron::ElectronDesktopWindowTreeHostLinux * refactor: use private inheritance in SpellCheckerHolder * refactor: use private inheritance in electron::api::PowerMonitor * refactor: use private inheritance in electron::api::BaseWindow * refactor: use private inheritance in electron::api::AutoUpdater * refactor: use private inheritance in electron::api::Menu * refactor: use private inheritance in electron::api::NativeWindowViews * refactor: use private inheritance in electron::ElectronBrowserClient * refactor: use private inheritance in electron::AutofillPopupView * refactor: use private inheritance in GtkMessageBox * refactor: use private inheritance in electron::OffScreenRenderWidgetHostView * refactor: use private inheritance in electron::InspectableWebContents * refactor: use private inheritance in electron::ElectronUsbDelegate * refactor: use private inheritance in electron::LoginHandler * refactor: use private inheritance in WebFrameRenderer * refactor: use private inheritance in electron::ElectronSerialDelegate * refactor: use private inheritance in electron::ClientFrameViewLinux * refactor: use private inheritance in electron::ElectronHidDelegate * refactor: use private inheritance in IPCRenderer * refactor: use private inheritance in electron::WinCaptionButtonContainer * refactor: use private inheritance in electron::ElectronApiIPCHandlerImpl * refactor: use private inheritance in electron::api::ServiceWorkerContext * refactor: use private inheritance in ui::FileSelectHelper * refactor: use private inheritance in electron::api::WebContentsView * refactor: use private inheritance in electron::api::SimpleURLLoaderWrapper * refactor: use private inheritance in electron::api::InAppPurchase * refactor: use private inheritance in electron::api::Debugger * refactor: use private inheritance in electron::ElectronWebContentsUtilityHandlerImpl * refactor: use private inheritance in electron::OffScreenWebContentsView
69 lines
2.3 KiB
C++
69 lines
2.3 KiB
C++
// Copyright (c) 2022 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_BROWSER_ELECTRON_WEB_CONTENTS_UTILITY_HANDLER_IMPL_H_
|
|
#define ELECTRON_SHELL_BROWSER_ELECTRON_WEB_CONTENTS_UTILITY_HANDLER_IMPL_H_
|
|
|
|
#include <vector>
|
|
|
|
#include "base/memory/weak_ptr.h"
|
|
#include "content/public/browser/global_routing_id.h"
|
|
#include "content/public/browser/web_contents_observer.h"
|
|
#include "electron/shell/common/api/api.mojom.h"
|
|
#include "mojo/public/cpp/bindings/associated_receiver.h"
|
|
#include "shell/browser/api/electron_api_web_contents.h"
|
|
|
|
namespace content {
|
|
class RenderFrameHost;
|
|
}
|
|
|
|
namespace electron {
|
|
class ElectronWebContentsUtilityHandlerImpl
|
|
: public mojom::ElectronWebContentsUtility,
|
|
private content::WebContentsObserver {
|
|
public:
|
|
explicit ElectronWebContentsUtilityHandlerImpl(
|
|
content::RenderFrameHost* render_frame_host,
|
|
mojo::PendingAssociatedReceiver<mojom::ElectronWebContentsUtility>
|
|
receiver);
|
|
|
|
static void Create(
|
|
content::RenderFrameHost* frame_host,
|
|
mojo::PendingAssociatedReceiver<mojom::ElectronWebContentsUtility>
|
|
receiver);
|
|
|
|
// disable copy
|
|
ElectronWebContentsUtilityHandlerImpl(
|
|
const ElectronWebContentsUtilityHandlerImpl&) = delete;
|
|
ElectronWebContentsUtilityHandlerImpl& operator=(
|
|
const ElectronWebContentsUtilityHandlerImpl&) = delete;
|
|
|
|
// mojom::ElectronWebContentsUtility:
|
|
void OnFirstNonEmptyLayout() override;
|
|
void SetTemporaryZoomLevel(double level) override;
|
|
void DoGetZoomLevel(DoGetZoomLevelCallback callback) override;
|
|
|
|
base::WeakPtr<ElectronWebContentsUtilityHandlerImpl> GetWeakPtr() {
|
|
return weak_factory_.GetWeakPtr();
|
|
}
|
|
|
|
private:
|
|
~ElectronWebContentsUtilityHandlerImpl() override;
|
|
|
|
// content::WebContentsObserver:
|
|
void WebContentsDestroyed() override;
|
|
|
|
void OnConnectionError();
|
|
|
|
content::RenderFrameHost* GetRenderFrameHost();
|
|
|
|
content::GlobalRenderFrameHostId render_frame_host_id_;
|
|
|
|
mojo::AssociatedReceiver<mojom::ElectronWebContentsUtility> receiver_{this};
|
|
|
|
base::WeakPtrFactory<ElectronWebContentsUtilityHandlerImpl> weak_factory_{
|
|
this};
|
|
};
|
|
} // namespace electron
|
|
#endif // ELECTRON_SHELL_BROWSER_ELECTRON_WEB_CONTENTS_UTILITY_HANDLER_IMPL_H_
|