blob: bd2608cdbf9a8dc880efb7aad1fea13eafcdd949 [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"
12#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;
hush28fab08662016-01-14 18:42:5122class WebView;
23}
[email protected]b1656552014-06-09 19:59:3824
25namespace android_webview {
26
27// Render process side of AwRenderViewHostExt, this provides cross-process
28// implementation of miscellaneous WebView functions that we need to poke
29// WebKit directly to implement (and that aren't needed in the chrome app).
Dave Tapuska046559c82020-11-06 18:15:0930class AwRenderFrameExt : public content::RenderFrameObserver,
31 mojom::LocalMainFrame {
[email protected]b1656552014-06-09 19:59:3832 public:
Christian O. Andersson822effcf2019-01-25 17:00:2533 explicit AwRenderFrameExt(content::RenderFrame* render_frame);
34
35 static AwRenderFrameExt* FromRenderFrame(content::RenderFrame* render_frame);
36
[email protected]b1656552014-06-09 19:59:3837 private:
dcheng9f9f9342015-02-04 01:50:1738 ~AwRenderFrameExt() override;
[email protected]b1656552014-06-09 19:59:3839
hush28fab08662016-01-14 18:42:5140 // RenderFrameObserver:
Ken Rockot0aad7ec2018-07-31 15:58:4441 bool OnAssociatedInterfaceRequestForFrame(
Tao Bai1d5460a2017-08-10 01:02:2342 const std::string& interface_name,
Ken Rockot0aad7ec2018-07-31 15:58:4443 mojo::ScopedInterfaceEndpointHandle* handle) override;
Dmitry Gozman02dd8272020-06-09 20:01:2344 void DidCommitProvisionalLoad(ui::PageTransition transition) override;
hush28fab08662016-01-14 18:42:5145
46 bool OnMessageReceived(const IPC::Message& message) override;
Kent Tamura69d143e2019-05-22 00:31:4547 void FocusedElementChanged(const blink::WebElement& element) override;
xjz694b50a92016-06-07 21:49:3748 void OnDestruct() override;
hush28fab08662016-01-14 18:42:5149
hushd0baa9b2016-05-11 19:30:0450 void OnDocumentHasImagesRequest(uint32_t id);
hush28fab08662016-01-14 18:42:5151 void OnDoHitTest(const gfx::PointF& touch_center,
52 const gfx::SizeF& touch_area);
53
54 void OnSetTextZoomFactor(float zoom_factor);
55
56 void OnResetScrollAndScaleState();
57
58 void OnSetInitialPageScale(double page_scale_factor);
59
Sergio Villar Senin2127d7b2019-07-31 17:29:5860 void OnSmoothScroll(int target_x, int target_y, base::TimeDelta duration);
hush28fab08662016-01-14 18:42:5161
Dave Tapuska046559c82020-11-06 18:15:0962 // mojom::LocalMainFrame overrides:
63 void SetBackgroundColor(SkColor c) override;
64
65 void BindLocalMainFrame(
66 mojo::PendingAssociatedReceiver<mojom::LocalMainFrame> pending_receiver);
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
[email protected]b1656552014-06-09 19:59:3877 DISALLOW_COPY_AND_ASSIGN(AwRenderFrameExt);
78};
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_