blob: fc68193713514fc74e84f73a57e34ff5cd6da658 [file] [log] [blame]
Avi Drissman4a6ec7e2022-09-08 20:26:461// Copyright 2014 The Chromium Authors
[email protected]b1656552014-06-09 19:59:382// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef ANDROID_WEBVIEW_RENDERER_AW_RENDER_FRAME_EXT_H_
6#define ANDROID_WEBVIEW_RENDERER_AW_RENDER_FRAME_EXT_H_
7
Dave Tapuska046559c82020-11-06 18:15:098#include "android_webview/common/mojom/frame.mojom.h"
[email protected]b1656552014-06-09 19:59:389#include "content/public/renderer/render_frame_observer.h"
Dave Tapuska046559c82020-11-06 18:15:0910#include "mojo/public/cpp/bindings/associated_receiver.h"
Gyuyoung Kim009ecd02020-12-11 23:27:5211#include "mojo/public/cpp/bindings/associated_remote.h"
Dave Tapuska046559c82020-11-06 18:15:0912#include "mojo/public/cpp/bindings/pending_associated_receiver.h"
Ken Rockot0aad7ec2018-07-31 15:58:4413#include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h"
Tao Bai1d5460a2017-08-10 01:02:2314#include "third_party/skia/include/core/SkColor.h"
hush28fab08662016-01-14 18:42:5115#include "ui/gfx/geometry/point_f.h"
16#include "ui/gfx/geometry/size.h"
17#include "ui/gfx/geometry/size_f.h"
avi0363eb922016-03-10 23:53:4618#include "url/origin.h"
hush28fab08662016-01-14 18:42:5119
20namespace blink {
lfgcaab5142016-02-26 19:06:5221class WebFrameWidget;
Dave Tapuska78667e82022-06-27 17:56:1422class WebHitTestResult;
hush28fab08662016-01-14 18:42:5123class WebView;
24}
[email protected]b1656552014-06-09 19:59:3825
26namespace android_webview {
27
28// Render process side of AwRenderViewHostExt, this provides cross-process
29// implementation of miscellaneous WebView functions that we need to poke
30// WebKit directly to implement (and that aren't needed in the chrome app).
Dave Tapuska046559c82020-11-06 18:15:0931class AwRenderFrameExt : public content::RenderFrameObserver,
32 mojom::LocalMainFrame {
[email protected]b1656552014-06-09 19:59:3833 public:
Christian O. Andersson822effcf2019-01-25 17:00:2534 explicit AwRenderFrameExt(content::RenderFrame* render_frame);
35
Peter Boström6cc06e22021-09-24 00:10:1336 AwRenderFrameExt(const AwRenderFrameExt&) = delete;
37 AwRenderFrameExt& operator=(const AwRenderFrameExt&) = delete;
38
[email protected]b1656552014-06-09 19:59:3839 private:
dcheng9f9f9342015-02-04 01:50:1740 ~AwRenderFrameExt() override;
[email protected]b1656552014-06-09 19:59:3841
hush28fab08662016-01-14 18:42:5142 // RenderFrameObserver:
Ken Rockot0aad7ec2018-07-31 15:58:4443 bool OnAssociatedInterfaceRequestForFrame(
Tao Bai1d5460a2017-08-10 01:02:2344 const std::string& interface_name,
Ken Rockot0aad7ec2018-07-31 15:58:4445 mojo::ScopedInterfaceEndpointHandle* handle) override;
Dmitry Gozman02dd8272020-06-09 20:01:2346 void DidCommitProvisionalLoad(ui::PageTransition transition) override;
hush28fab08662016-01-14 18:42:5147
Kent Tamura69d143e2019-05-22 00:31:4548 void FocusedElementChanged(const blink::WebElement& element) override;
Dave Tapuska78667e82022-06-27 17:56:1449 void DidCreateDocumentElement() override;
xjz694b50a92016-06-07 21:49:3750 void OnDestruct() override;
hush28fab08662016-01-14 18:42:5151
Dave Tapuska046559c82020-11-06 18:15:0952 // mojom::LocalMainFrame overrides:
Gyuyoung Kim53ebffc12020-12-12 05:36:3353 void SetInitialPageScale(double page_scale_factor) override;
Gyuyoung Kimb8086112020-12-12 02:03:1554 void SetTextZoomFactor(float zoom_factor) override;
Gyuyoung Kimddb9bd52020-12-03 02:19:4255 void DocumentHasImage(DocumentHasImageCallback callback) override;
Gyuyoung Kimc4b48b962020-12-12 03:08:5856 void ResetScrollAndScaleState() override;
Gyuyoung Kim1bf9bcb2020-12-12 06:26:2757 void SmoothScroll(int32_t target_x,
58 int32_t target_y,
59 base::TimeDelta duration) override;
Dave Tapuska046559c82020-11-06 18:15:0960
61 void BindLocalMainFrame(
62 mojo::PendingAssociatedReceiver<mojom::LocalMainFrame> pending_receiver);
63
Dave Tapuska78667e82022-06-27 17:56:1464 void HandleHitTestResult(const blink::WebHitTestResult& result);
65
Gyuyoung Kim009ecd02020-12-11 23:27:5266 const mojo::AssociatedRemote<mojom::FrameHost>& GetFrameHost();
67
hush28fab08662016-01-14 18:42:5168 blink::WebView* GetWebView();
lfgcaab5142016-02-26 19:06:5269 blink::WebFrameWidget* GetWebFrameWidget();
hush28fab08662016-01-14 18:42:5170
avi0363eb922016-03-10 23:53:4671 url::Origin last_origin_;
72
Ken Rockot0aad7ec2018-07-31 15:58:4473 blink::AssociatedInterfaceRegistry registry_;
Dave Tapuska046559c82020-11-06 18:15:0974 mojo::AssociatedReceiver<mojom::LocalMainFrame> local_main_frame_receiver_{
75 this};
Tao Bai1d5460a2017-08-10 01:02:2376
Gyuyoung Kim009ecd02020-12-11 23:27:5277 mojo::AssociatedRemote<mojom::FrameHost> frame_host_remote_;
[email protected]b1656552014-06-09 19:59:3878};
79
fanjinsongdb647e042017-06-09 20:26:4580} // namespace android_webview
[email protected]b1656552014-06-09 19:59:3881
82#endif // ANDROID_WEBVIEW_RENDERER_AW_RENDER_FRAME_EXT_H_