blob: 87624a9e1a9dd63af03c2eaf20d4ccd1042ee6f5 [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
avide7d5c22015-12-20 05:48:448#include "base/macros.h"
[email protected]b1656552014-06-09 19:59:389#include "content/public/renderer/render_frame_observer.h"
Ken Rockot0aad7ec2018-07-31 15:58:4410#include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h"
Tao Bai1d5460a2017-08-10 01:02:2311#include "third_party/skia/include/core/SkColor.h"
hush28fab08662016-01-14 18:42:5112#include "ui/gfx/geometry/point_f.h"
13#include "ui/gfx/geometry/size.h"
14#include "ui/gfx/geometry/size_f.h"
avi0363eb922016-03-10 23:53:4615#include "url/origin.h"
hush28fab08662016-01-14 18:42:5116
17namespace blink {
18enum WebMeaningfulLayout;
lfgcaab5142016-02-26 19:06:5219class WebFrameWidget;
hush28fab08662016-01-14 18:42:5120class WebView;
21}
[email protected]b1656552014-06-09 19:59:3822
23namespace android_webview {
24
25// Render process side of AwRenderViewHostExt, this provides cross-process
26// implementation of miscellaneous WebView functions that we need to poke
27// WebKit directly to implement (and that aren't needed in the chrome app).
28class AwRenderFrameExt : public content::RenderFrameObserver {
29 public:
Christian O. Andersson822effcf2019-01-25 17:00:2530 explicit AwRenderFrameExt(content::RenderFrame* render_frame);
31
32 static AwRenderFrameExt* FromRenderFrame(content::RenderFrame* render_frame);
33
Christian O. Anderssone17c03862019-02-22 19:22:2434 bool GetWillSuppressErrorPage();
[email protected]b1656552014-06-09 19:59:3835
36 private:
dcheng9f9f9342015-02-04 01:50:1737 ~AwRenderFrameExt() override;
[email protected]b1656552014-06-09 19:59:3838
hush28fab08662016-01-14 18:42:5139 // RenderFrameObserver:
Ken Rockot0aad7ec2018-07-31 15:58:4440 bool OnAssociatedInterfaceRequestForFrame(
Tao Bai1d5460a2017-08-10 01:02:2341 const std::string& interface_name,
Ken Rockot0aad7ec2018-07-31 15:58:4442 mojo::ScopedInterfaceEndpointHandle* handle) override;
Dmitry Gozman02dd8272020-06-09 20:01:2343 void DidCommitProvisionalLoad(ui::PageTransition transition) override;
hush28fab08662016-01-14 18:42:5144
45 bool OnMessageReceived(const IPC::Message& message) override;
Kent Tamura69d143e2019-05-22 00:31:4546 void FocusedElementChanged(const blink::WebElement& element) override;
xjz694b50a92016-06-07 21:49:3747 void OnDestruct() override;
hush28fab08662016-01-14 18:42:5148
hushd0baa9b2016-05-11 19:30:0449 void OnDocumentHasImagesRequest(uint32_t id);
hush28fab08662016-01-14 18:42:5150 void OnDoHitTest(const gfx::PointF& touch_center,
51 const gfx::SizeF& touch_area);
52
53 void OnSetTextZoomFactor(float zoom_factor);
54
55 void OnResetScrollAndScaleState();
56
57 void OnSetInitialPageScale(double page_scale_factor);
58
59 void OnSetBackgroundColor(SkColor c);
60
Sergio Villar Senin2127d7b2019-07-31 17:29:5861 void OnSmoothScroll(int target_x, int target_y, base::TimeDelta duration);
hush28fab08662016-01-14 18:42:5162
Christian O. Anderssone17c03862019-02-22 19:22:2463 void OnSetWillSuppressErrorPage(bool suppress);
Christian O. Andersson822effcf2019-01-25 17:00:2564
hush28fab08662016-01-14 18:42:5165 blink::WebView* GetWebView();
lfgcaab5142016-02-26 19:06:5266 blink::WebFrameWidget* GetWebFrameWidget();
hush28fab08662016-01-14 18:42:5167
avi0363eb922016-03-10 23:53:4668 url::Origin last_origin_;
69
Ken Rockot0aad7ec2018-07-31 15:58:4470 blink::AssociatedInterfaceRegistry registry_;
Tao Bai1d5460a2017-08-10 01:02:2371
Christian O. Andersson822effcf2019-01-25 17:00:2572 // Some WebView users might want to show their own error pages / logic
Christian O. Anderssone17c03862019-02-22 19:22:2473 bool will_suppress_error_page_ = false;
Christian O. Andersson822effcf2019-01-25 17:00:2574
[email protected]b1656552014-06-09 19:59:3875 DISALLOW_COPY_AND_ASSIGN(AwRenderFrameExt);
76};
77
fanjinsongdb647e042017-06-09 20:26:4578} // namespace android_webview
[email protected]b1656552014-06-09 19:59:3879
80#endif // ANDROID_WEBVIEW_RENDERER_AW_RENDER_FRAME_EXT_H_