[email protected] | b165655 | 2014-06-09 19:59:38 | [diff] [blame] | 1 | // 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 | |||||
avi | de7d5c2 | 2015-12-20 05:48:44 | [diff] [blame] | 8 | #include "base/macros.h" |
[email protected] | b165655 | 2014-06-09 19:59:38 | [diff] [blame] | 9 | #include "content/public/renderer/render_frame_observer.h" |
Ken Rockot | 0aad7ec | 2018-07-31 15:58:44 | [diff] [blame] | 10 | #include "third_party/blink/public/common/associated_interfaces/associated_interface_registry.h" |
Tao Bai | 1d5460a | 2017-08-10 01:02:23 | [diff] [blame] | 11 | #include "third_party/skia/include/core/SkColor.h" |
hush | 28fab0866 | 2016-01-14 18:42:51 | [diff] [blame] | 12 | #include "ui/gfx/geometry/point_f.h" |
13 | #include "ui/gfx/geometry/size.h" | ||||
14 | #include "ui/gfx/geometry/size_f.h" | ||||
avi | 0363eb92 | 2016-03-10 23:53:46 | [diff] [blame] | 15 | #include "url/origin.h" |
hush | 28fab0866 | 2016-01-14 18:42:51 | [diff] [blame] | 16 | |
17 | namespace blink { | ||||
18 | enum WebMeaningfulLayout; | ||||
lfg | caab514 | 2016-02-26 19:06:52 | [diff] [blame] | 19 | class WebFrameWidget; |
hush | 28fab0866 | 2016-01-14 18:42:51 | [diff] [blame] | 20 | class WebView; |
21 | } | ||||
[email protected] | b165655 | 2014-06-09 19:59:38 | [diff] [blame] | 22 | |
23 | namespace 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). | ||||
28 | class AwRenderFrameExt : public content::RenderFrameObserver { | ||||
29 | public: | ||||
Christian O. Andersson | 822effcf | 2019-01-25 17:00:25 | [diff] [blame] | 30 | explicit AwRenderFrameExt(content::RenderFrame* render_frame); |
31 | |||||
32 | static AwRenderFrameExt* FromRenderFrame(content::RenderFrame* render_frame); | ||||
33 | |||||
Christian O. Andersson | e17c0386 | 2019-02-22 19:22:24 | [diff] [blame] | 34 | bool GetWillSuppressErrorPage(); |
[email protected] | b165655 | 2014-06-09 19:59:38 | [diff] [blame] | 35 | |
36 | private: | ||||
dcheng | 9f9f934 | 2015-02-04 01:50:17 | [diff] [blame] | 37 | ~AwRenderFrameExt() override; |
[email protected] | b165655 | 2014-06-09 19:59:38 | [diff] [blame] | 38 | |
hush | 28fab0866 | 2016-01-14 18:42:51 | [diff] [blame] | 39 | // RenderFrameObserver: |
Ken Rockot | 0aad7ec | 2018-07-31 15:58:44 | [diff] [blame] | 40 | bool OnAssociatedInterfaceRequestForFrame( |
Tao Bai | 1d5460a | 2017-08-10 01:02:23 | [diff] [blame] | 41 | const std::string& interface_name, |
Ken Rockot | 0aad7ec | 2018-07-31 15:58:44 | [diff] [blame] | 42 | mojo::ScopedInterfaceEndpointHandle* handle) override; |
Dmitry Gozman | 02dd827 | 2020-06-09 20:01:23 | [diff] [blame^] | 43 | void DidCommitProvisionalLoad(ui::PageTransition transition) override; |
hush | 28fab0866 | 2016-01-14 18:42:51 | [diff] [blame] | 44 | |
45 | bool OnMessageReceived(const IPC::Message& message) override; | ||||
Kent Tamura | 69d143e | 2019-05-22 00:31:45 | [diff] [blame] | 46 | void FocusedElementChanged(const blink::WebElement& element) override; |
xjz | 694b50a9 | 2016-06-07 21:49:37 | [diff] [blame] | 47 | void OnDestruct() override; |
hush | 28fab0866 | 2016-01-14 18:42:51 | [diff] [blame] | 48 | |
hush | d0baa9b | 2016-05-11 19:30:04 | [diff] [blame] | 49 | void OnDocumentHasImagesRequest(uint32_t id); |
hush | 28fab0866 | 2016-01-14 18:42:51 | [diff] [blame] | 50 | 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 Senin | 2127d7b | 2019-07-31 17:29:58 | [diff] [blame] | 61 | void OnSmoothScroll(int target_x, int target_y, base::TimeDelta duration); |
hush | 28fab0866 | 2016-01-14 18:42:51 | [diff] [blame] | 62 | |
Christian O. Andersson | e17c0386 | 2019-02-22 19:22:24 | [diff] [blame] | 63 | void OnSetWillSuppressErrorPage(bool suppress); |
Christian O. Andersson | 822effcf | 2019-01-25 17:00:25 | [diff] [blame] | 64 | |
hush | 28fab0866 | 2016-01-14 18:42:51 | [diff] [blame] | 65 | blink::WebView* GetWebView(); |
lfg | caab514 | 2016-02-26 19:06:52 | [diff] [blame] | 66 | blink::WebFrameWidget* GetWebFrameWidget(); |
hush | 28fab0866 | 2016-01-14 18:42:51 | [diff] [blame] | 67 | |
avi | 0363eb92 | 2016-03-10 23:53:46 | [diff] [blame] | 68 | url::Origin last_origin_; |
69 | |||||
Ken Rockot | 0aad7ec | 2018-07-31 15:58:44 | [diff] [blame] | 70 | blink::AssociatedInterfaceRegistry registry_; |
Tao Bai | 1d5460a | 2017-08-10 01:02:23 | [diff] [blame] | 71 | |
Christian O. Andersson | 822effcf | 2019-01-25 17:00:25 | [diff] [blame] | 72 | // Some WebView users might want to show their own error pages / logic |
Christian O. Andersson | e17c0386 | 2019-02-22 19:22:24 | [diff] [blame] | 73 | bool will_suppress_error_page_ = false; |
Christian O. Andersson | 822effcf | 2019-01-25 17:00:25 | [diff] [blame] | 74 | |
[email protected] | b165655 | 2014-06-09 19:59:38 | [diff] [blame] | 75 | DISALLOW_COPY_AND_ASSIGN(AwRenderFrameExt); |
76 | }; | ||||
77 | |||||
fanjinsong | db647e04 | 2017-06-09 20:26:45 | [diff] [blame] | 78 | } // namespace android_webview |
[email protected] | b165655 | 2014-06-09 19:59:38 | [diff] [blame] | 79 | |
80 | #endif // ANDROID_WEBVIEW_RENDERER_AW_RENDER_FRAME_EXT_H_ |