blob: c25f70f908a085d8a82a2fbe7c8fcea1a6c022ac [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"
avide7d5c22015-12-20 05:48:449#include "base/macros.h"
[email protected]b1656552014-06-09 19:59:3810#include "content/public/renderer/render_frame_observer.h"
Dave Tapuska046559c82020-11-06 18:15:0911#include "mojo/public/cpp/bindings/associated_receiver.h"
Gyuyoung Kim009ecd02020-12-11 23:27:5212#include "mojo/public/cpp/bindings/associated_remote.h"
Dave Tapuska046559c82020-11-06 18:15:0913#include "mojo/public/cpp/bindings/pending_associated_receiver.h"
Ken Rockot0aad7ec2018-07-31 15:58:4414#include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h"
Tao Bai1d5460a2017-08-10 01:02:2315#include "third_party/skia/include/core/SkColor.h"
hush28fab08662016-01-14 18:42:5116#include "ui/gfx/geometry/point_f.h"
17#include "ui/gfx/geometry/size.h"
18#include "ui/gfx/geometry/size_f.h"
avi0363eb922016-03-10 23:53:4619#include "url/origin.h"
hush28fab08662016-01-14 18:42:5120
21namespace blink {
lfgcaab5142016-02-26 19:06:5222class WebFrameWidget;
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
36 static AwRenderFrameExt* FromRenderFrame(content::RenderFrame* render_frame);
37
[email protected]b1656552014-06-09 19:59:3838 private:
dcheng9f9f9342015-02-04 01:50:1739 ~AwRenderFrameExt() override;
[email protected]b1656552014-06-09 19:59:3840
hush28fab08662016-01-14 18:42:5141 // RenderFrameObserver:
Ken Rockot0aad7ec2018-07-31 15:58:4442 bool OnAssociatedInterfaceRequestForFrame(
Tao Bai1d5460a2017-08-10 01:02:2343 const std::string& interface_name,
Ken Rockot0aad7ec2018-07-31 15:58:4444 mojo::ScopedInterfaceEndpointHandle* handle) override;
Dmitry Gozman02dd8272020-06-09 20:01:2345 void DidCommitProvisionalLoad(ui::PageTransition transition) override;
hush28fab08662016-01-14 18:42:5146
47 bool OnMessageReceived(const IPC::Message& message) override;
Kent Tamura69d143e2019-05-22 00:31:4548 void FocusedElementChanged(const blink::WebElement& element) override;
xjz694b50a92016-06-07 21:49:3749 void OnDestruct() override;
hush28fab08662016-01-14 18:42:5150
Sergio Villar Senin2127d7b2019-07-31 17:29:5851 void OnSmoothScroll(int target_x, int target_y, base::TimeDelta duration);
hush28fab08662016-01-14 18:42:5152
Dave Tapuska046559c82020-11-06 18:15:0953 // mojom::LocalMainFrame overrides:
54 void SetBackgroundColor(SkColor c) override;
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;
Dave Tapuska046559c82020-11-06 18:15:0961
62 void BindLocalMainFrame(
63 mojo::PendingAssociatedReceiver<mojom::LocalMainFrame> pending_receiver);
64
Gyuyoung Kim009ecd02020-12-11 23:27:5265 const mojo::AssociatedRemote<mojom::FrameHost>& GetFrameHost();
66
hush28fab08662016-01-14 18:42:5167 blink::WebView* GetWebView();
lfgcaab5142016-02-26 19:06:5268 blink::WebFrameWidget* GetWebFrameWidget();
hush28fab08662016-01-14 18:42:5169
avi0363eb922016-03-10 23:53:4670 url::Origin last_origin_;
71
Ken Rockot0aad7ec2018-07-31 15:58:4472 blink::AssociatedInterfaceRegistry registry_;
Dave Tapuska046559c82020-11-06 18:15:0973 mojo::AssociatedReceiver<mojom::LocalMainFrame> local_main_frame_receiver_{
74 this};
Tao Bai1d5460a2017-08-10 01:02:2375
Gyuyoung Kim009ecd02020-12-11 23:27:5276 mojo::AssociatedRemote<mojom::FrameHost> frame_host_remote_;
77
[email protected]b1656552014-06-09 19:59:3878 DISALLOW_COPY_AND_ASSIGN(AwRenderFrameExt);
79};
80
fanjinsongdb647e042017-06-09 20:26:4581} // namespace android_webview
[email protected]b1656552014-06-09 19:59:3882
83#endif // ANDROID_WEBVIEW_RENDERER_AW_RENDER_FRAME_EXT_H_