blob: 602accb394becaa4abbfafc5ea8caa742231f1e9 [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;
rdsmithdaa92272015-05-21 20:33:4138 void CanDownload(const GURL& url,
dcheng9b4dd1aa2015-02-04 02:56:5439 const std::string& request_method,
Avi Drissman346e0ea2019-04-02 00:08:4640 base::OnceCallback<void(bool)> callback) override;
nasko35169af2016-06-10 18:47:1341 void RunFileChooser(content::RenderFrameHost* render_frame_host,
Kent Tamura512a27e2018-10-04 00:49:3242 std::unique_ptr<content::FileSelectListener> listener,
Kent Tamurac260c9a2018-09-14 09:10:5643 const blink::mojom::FileChooserParams& params) override;
Shimi Zhanga1905162020-03-25 23:09:0144 // See //android_webview/docs/how-does-on-create-window-work.md for more
45 // details.
dcheng9b4dd1aa2015-02-04 02:56:5446 void AddNewContents(content::WebContents* source,
erikchenbee5c9622018-04-27 19:30:2547 std::unique_ptr<content::WebContents> new_contents,
Joel Hockey891e88062020-04-30 05:38:4448 const GURL& target_url,
dcheng9b4dd1aa2015-02-04 02:56:5449 WindowOpenDisposition disposition,
50 const gfx::Rect& initial_rect,
51 bool user_gesture,
52 bool* was_blocked) override;
[email protected]0b85508d2013-12-10 04:33:5353
mnaganovb2803fd2015-03-04 13:42:0354 void NavigationStateChanged(content::WebContents* source,
55 content::InvalidateTypes changed_flags) override;
Bryan McQuaded2b93c02017-07-14 22:26:3156 void WebContentsCreated(content::WebContents* source_contents,
57 int opener_render_process_id,
58 int opener_render_frame_id,
59 const std::string& frame_name,
60 const GURL& target_url,
61 content::WebContents* new_contents) override;
[email protected]0b85508d2013-12-10 04:33:5362
dcheng9b4dd1aa2015-02-04 02:56:5463 void CloseContents(content::WebContents* source) override;
64 void ActivateContents(content::WebContents* contents) override;
mnaganov27cdc322015-06-05 15:40:2065 void LoadingStateChanged(content::WebContents* source,
66 bool to_different_document) override;
gsenntonf9205b6f2015-10-30 16:57:0367 bool ShouldResumeRequestsForCreatedWindow() override;
dcheng9b4dd1aa2015-02-04 02:56:5468 void RequestMediaAccessPermission(
[email protected]32e2d4aac2014-05-01 17:54:1369 content::WebContents* web_contents,
70 const content::MediaStreamRequest& request,
Mark Pilgrim57499082018-06-12 12:38:3071 content::MediaResponseCallback callback) override;
Dave Tapuska3ed44192018-05-01 18:53:3072 void EnterFullscreenModeForTab(
73 content::WebContents* web_contents,
74 const GURL& origin,
Dave Tapuskaa4189512019-10-15 20:27:3475 const blink::mojom::FullscreenOptions& options) override;
dcheng9b4dd1aa2015-02-04 02:56:5476 void ExitFullscreenModeForTab(content::WebContents* web_contents) override;
77 bool IsFullscreenForTabOrPending(
Lucas Furukawa Gadani4909f3c2019-06-18 22:36:5278 const content::WebContents* web_contents) override;
Clark DuValla0e42992018-09-17 17:00:1179 void UpdateUserGestureCarryoverInfo(
80 content::WebContents* web_contents) override;
[email protected]1996a0b12014-07-08 19:01:1581
Kent Tamura512a27e2018-10-04 00:49:3282 std::unique_ptr<content::FileSelectListener> TakeFileSelectListener();
83
[email protected]1996a0b12014-07-08 19:01:1584 private:
85 bool is_fullscreen_;
Kent Tamura512a27e2018-10-04 00:49:3286
87 // Maintain a FileSelectListener instance passed to RunFileChooser() until
88 // a callback is called.
89 std::unique_ptr<content::FileSelectListener> file_select_listener_;
[email protected]f1c3c7972012-08-21 18:28:3090};
91
[email protected]f1c3c7972012-08-21 18:28:3092} // namespace android_webview
93
ctzsm0baa01d2017-05-09 04:27:3794#endif // ANDROID_WEBVIEW_BROWSER_AW_WEB_CONTENTS_DELEGATE_H_