blob: 522c271b800d6be6e4bc444223edae6af8744ee3 [file] [log] [blame]
[email protected]b1656552014-06-09 19:59:381// Copyright 2014 The Chromium Authors. All rights reserved.
2// 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
Christian O. Andersson822effcf2019-01-25 17:00:2539 static AwRenderFrameExt* FromRenderFrame(content::RenderFrame* render_frame);
40
[email protected]b1656552014-06-09 19:59:3841 private:
dcheng9f9f9342015-02-04 01:50:1742 ~AwRenderFrameExt() override;
[email protected]b1656552014-06-09 19:59:3843
hush28fab08662016-01-14 18:42:5144 // RenderFrameObserver:
Ken Rockot0aad7ec2018-07-31 15:58:4445 bool OnAssociatedInterfaceRequestForFrame(
Tao Bai1d5460a2017-08-10 01:02:2346 const std::string& interface_name,
Ken Rockot0aad7ec2018-07-31 15:58:4447 mojo::ScopedInterfaceEndpointHandle* handle) override;
Dmitry Gozman02dd8272020-06-09 20:01:2348 void DidCommitProvisionalLoad(ui::PageTransition transition) override;
hush28fab08662016-01-14 18:42:5149
Kent Tamura69d143e2019-05-22 00:31:4550 void FocusedElementChanged(const blink::WebElement& element) override;
Dave Tapuska78667e82022-06-27 17:56:1451 void DidCreateDocumentElement() override;
xjz694b50a92016-06-07 21:49:3752 void OnDestruct() override;
hush28fab08662016-01-14 18:42:5153
Dave Tapuska046559c82020-11-06 18:15:0954 // mojom::LocalMainFrame overrides:
Gyuyoung Kim53ebffc12020-12-12 05:36:3355 void SetInitialPageScale(double page_scale_factor) override;
Gyuyoung Kimb8086112020-12-12 02:03:1556 void SetTextZoomFactor(float zoom_factor) override;
Gyuyoung Kim71d2d282020-12-02 22:31:3057 void HitTest(const gfx::PointF& touch_center,
58 const gfx::SizeF& touch_area) override;
Gyuyoung Kimddb9bd52020-12-03 02:19:4259 void DocumentHasImage(DocumentHasImageCallback callback) override;
Gyuyoung Kimc4b48b962020-12-12 03:08:5860 void ResetScrollAndScaleState() override;
Gyuyoung Kim1bf9bcb2020-12-12 06:26:2761 void SmoothScroll(int32_t target_x,
62 int32_t target_y,
63 base::TimeDelta duration) override;
Dave Tapuska046559c82020-11-06 18:15:0964
65 void BindLocalMainFrame(
66 mojo::PendingAssociatedReceiver<mojom::LocalMainFrame> pending_receiver);
67
Dave Tapuska78667e82022-06-27 17:56:1468 void HandleHitTestResult(const blink::WebHitTestResult& result);
69
Gyuyoung Kim009ecd02020-12-11 23:27:5270 const mojo::AssociatedRemote<mojom::FrameHost>& GetFrameHost();
71
hush28fab08662016-01-14 18:42:5172 blink::WebView* GetWebView();
lfgcaab5142016-02-26 19:06:5273 blink::WebFrameWidget* GetWebFrameWidget();
hush28fab08662016-01-14 18:42:5174
avi0363eb922016-03-10 23:53:4675 url::Origin last_origin_;
76
Ken Rockot0aad7ec2018-07-31 15:58:4477 blink::AssociatedInterfaceRegistry registry_;
Dave Tapuska046559c82020-11-06 18:15:0978 mojo::AssociatedReceiver<mojom::LocalMainFrame> local_main_frame_receiver_{
79 this};
Tao Bai1d5460a2017-08-10 01:02:2380
Gyuyoung Kim009ecd02020-12-11 23:27:5281 mojo::AssociatedRemote<mojom::FrameHost> frame_host_remote_;
[email protected]b1656552014-06-09 19:59:3882};
83
fanjinsongdb647e042017-06-09 20:26:4584} // namespace android_webview
[email protected]b1656552014-06-09 19:59:3885
86#endif // ANDROID_WEBVIEW_RENDERER_AW_RENDER_FRAME_EXT_H_