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