blob: e565c40b190557442de4dcc622b3e445773fb682 [file] [log] [blame]
[email protected]f1c3c7972012-08-21 18:28:301// Copyright (c) 2012 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
ctzsm0baa01d2017-05-09 04:27:375#ifndef ANDROID_WEBVIEW_BROWSER_AW_WEB_CONTENTS_DELEGATE_H_
6#define ANDROID_WEBVIEW_BROWSER_AW_WEB_CONTENTS_DELEGATE_H_
[email protected]f1c3c7972012-08-21 18:28:307
Jinsuk Kim351a9252018-07-11 23:23:368#include "components/embedder_support/android/delegate/web_contents_delegate_android.h"
[email protected]f1c3c7972012-08-21 18:28:309
10namespace android_webview {
11
12// WebView specific WebContentsDelegate.
13// Should contain WebContentsDelegate code required by WebView that should not
14// be part of the Chromium Android port.
15class AwWebContentsDelegate
[email protected]da304442013-05-29 21:38:5316 : public web_contents_delegate_android::WebContentsDelegateAndroid {
[email protected]f1c3c7972012-08-21 18:28:3017 public:
18 AwWebContentsDelegate(JNIEnv* env, jobject obj);
dcheng9b4dd1aa2015-02-04 02:56:5419 ~AwWebContentsDelegate() override;
Tobias Sargeante0993fd72018-11-28 10:47:5320
21 void RendererUnresponsive(
22 content::WebContents* source,
23 content::RenderWidgetHost* render_widget_host,
24 base::RepeatingClosure hang_monitor_restarter) override;
25
26 void RendererResponsive(
27 content::WebContents* source,
28 content::RenderWidgetHost* render_widget_host) override;
29
dcheng9b4dd1aa2015-02-04 02:56:5430 content::JavaScriptDialogManager* GetJavaScriptDialogManager(
mathiash72a5e462014-11-19 08:18:5031 content::WebContents* source) override;
dcheng9b4dd1aa2015-02-04 02:56:5432 void FindReply(content::WebContents* web_contents,
33 int request_id,
34 int number_of_matches,
35 const gfx::Rect& selection_rect,
36 int active_match_ordinal,
37 bool final_update) override;
nasko35169af2016-06-10 18:47:1338 void RunFileChooser(content::RenderFrameHost* render_frame_host,
Kent Tamura3abb32d2020-07-02 00:23:0139 scoped_refptr<content::FileSelectListener> listener,
Kent Tamurac260c9a2018-09-14 09:10:5640 const blink::mojom::FileChooserParams& params) override;
Shimi Zhanga1905162020-03-25 23:09:0141 // See //android_webview/docs/how-does-on-create-window-work.md for more
42 // details.
dcheng9b4dd1aa2015-02-04 02:56:5443 void AddNewContents(content::WebContents* source,
erikchenbee5c9622018-04-27 19:30:2544 std::unique_ptr<content::WebContents> new_contents,
Joel Hockey891e88062020-04-30 05:38:4445 const GURL& target_url,
dcheng9b4dd1aa2015-02-04 02:56:5446 WindowOpenDisposition disposition,
47 const gfx::Rect& initial_rect,
48 bool user_gesture,
49 bool* was_blocked) override;
[email protected]0b85508d2013-12-10 04:33:5350
mnaganovb2803fd2015-03-04 13:42:0351 void NavigationStateChanged(content::WebContents* source,
52 content::InvalidateTypes changed_flags) override;
Bryan McQuaded2b93c02017-07-14 22:26:3153 void WebContentsCreated(content::WebContents* source_contents,
54 int opener_render_process_id,
55 int opener_render_frame_id,
56 const std::string& frame_name,
57 const GURL& target_url,
58 content::WebContents* new_contents) override;
[email protected]0b85508d2013-12-10 04:33:5359
dcheng9b4dd1aa2015-02-04 02:56:5460 void CloseContents(content::WebContents* source) override;
61 void ActivateContents(content::WebContents* contents) override;
mnaganov27cdc322015-06-05 15:40:2062 void LoadingStateChanged(content::WebContents* source,
63 bool to_different_document) override;
gsenntonf9205b6f2015-10-30 16:57:0364 bool ShouldResumeRequestsForCreatedWindow() override;
dcheng9b4dd1aa2015-02-04 02:56:5465 void RequestMediaAccessPermission(
[email protected]32e2d4aac2014-05-01 17:54:1366 content::WebContents* web_contents,
67 const content::MediaStreamRequest& request,
Mark Pilgrim57499082018-06-12 12:38:3068 content::MediaResponseCallback callback) override;
Dave Tapuska3ed44192018-05-01 18:53:3069 void EnterFullscreenModeForTab(
Mike Wasserman4ca09792020-05-29 17:44:4370 content::RenderFrameHost* requesting_frame,
Dave Tapuskaa4189512019-10-15 20:27:3471 const blink::mojom::FullscreenOptions& options) override;
dcheng9b4dd1aa2015-02-04 02:56:5472 void ExitFullscreenModeForTab(content::WebContents* web_contents) override;
73 bool IsFullscreenForTabOrPending(
Lucas Furukawa Gadani4909f3c2019-06-18 22:36:5274 const content::WebContents* web_contents) override;
Clark DuValla0e42992018-09-17 17:00:1175 void UpdateUserGestureCarryoverInfo(
76 content::WebContents* web_contents) override;
[email protected]1996a0b12014-07-08 19:01:1577
Kent Tamura3abb32d2020-07-02 00:23:0178 scoped_refptr<content::FileSelectListener> TakeFileSelectListener();
Kent Tamura512a27e2018-10-04 00:49:3279
[email protected]1996a0b12014-07-08 19:01:1580 private:
81 bool is_fullscreen_;
Kent Tamura512a27e2018-10-04 00:49:3282
83 // Maintain a FileSelectListener instance passed to RunFileChooser() until
84 // a callback is called.
Kent Tamura3abb32d2020-07-02 00:23:0185 scoped_refptr<content::FileSelectListener> file_select_listener_;
[email protected]f1c3c7972012-08-21 18:28:3086};
87
[email protected]f1c3c7972012-08-21 18:28:3088} // namespace android_webview
89
ctzsm0baa01d2017-05-09 04:27:3790#endif // ANDROID_WEBVIEW_BROWSER_AW_WEB_CONTENTS_DELEGATE_H_