blob: 1abe7b40796f9441614fba9650ae975762583b2e [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;
20 content::JavaScriptDialogManager* GetJavaScriptDialogManager(
mathiash72a5e462014-11-19 08:18:5021 content::WebContents* source) override;
dcheng9b4dd1aa2015-02-04 02:56:5422 void FindReply(content::WebContents* web_contents,
23 int request_id,
24 int number_of_matches,
25 const gfx::Rect& selection_rect,
26 int active_match_ordinal,
27 bool final_update) override;
rdsmithdaa92272015-05-21 20:33:4128 void CanDownload(const GURL& url,
dcheng9b4dd1aa2015-02-04 02:56:5429 const std::string& request_method,
30 const base::Callback<void(bool)>& callback) override;
nasko35169af2016-06-10 18:47:1331 void RunFileChooser(content::RenderFrameHost* render_frame_host,
Kent Tamura512a27e2018-10-04 00:49:3232 std::unique_ptr<content::FileSelectListener> listener,
Kent Tamurac260c9a2018-09-14 09:10:5633 const blink::mojom::FileChooserParams& params) override;
dcheng9b4dd1aa2015-02-04 02:56:5434 void AddNewContents(content::WebContents* source,
erikchenbee5c9622018-04-27 19:30:2535 std::unique_ptr<content::WebContents> new_contents,
dcheng9b4dd1aa2015-02-04 02:56:5436 WindowOpenDisposition disposition,
37 const gfx::Rect& initial_rect,
38 bool user_gesture,
39 bool* was_blocked) override;
[email protected]0b85508d2013-12-10 04:33:5340
mnaganovb2803fd2015-03-04 13:42:0341 void NavigationStateChanged(content::WebContents* source,
42 content::InvalidateTypes changed_flags) override;
Bryan McQuaded2b93c02017-07-14 22:26:3143 void WebContentsCreated(content::WebContents* source_contents,
44 int opener_render_process_id,
45 int opener_render_frame_id,
46 const std::string& frame_name,
47 const GURL& target_url,
48 content::WebContents* new_contents) override;
[email protected]0b85508d2013-12-10 04:33:5349
dcheng9b4dd1aa2015-02-04 02:56:5450 void CloseContents(content::WebContents* source) override;
51 void ActivateContents(content::WebContents* contents) override;
mnaganov27cdc322015-06-05 15:40:2052 void LoadingStateChanged(content::WebContents* source,
53 bool to_different_document) override;
gsenntonf9205b6f2015-10-30 16:57:0354 bool ShouldResumeRequestsForCreatedWindow() override;
dcheng9b4dd1aa2015-02-04 02:56:5455 void RequestMediaAccessPermission(
[email protected]32e2d4aac2014-05-01 17:54:1356 content::WebContents* web_contents,
57 const content::MediaStreamRequest& request,
Mark Pilgrim57499082018-06-12 12:38:3058 content::MediaResponseCallback callback) override;
Dave Tapuska3ed44192018-05-01 18:53:3059 void EnterFullscreenModeForTab(
60 content::WebContents* web_contents,
61 const GURL& origin,
62 const blink::WebFullscreenOptions& options) override;
dcheng9b4dd1aa2015-02-04 02:56:5463 void ExitFullscreenModeForTab(content::WebContents* web_contents) override;
64 bool IsFullscreenForTabOrPending(
mostynbd731a4912014-10-07 13:36:1165 const content::WebContents* web_contents) const override;
Clark DuValla0e42992018-09-17 17:00:1166 void UpdateUserGestureCarryoverInfo(
67 content::WebContents* web_contents) override;
[email protected]1996a0b12014-07-08 19:01:1568
Kent Tamura512a27e2018-10-04 00:49:3269 std::unique_ptr<content::FileSelectListener> TakeFileSelectListener();
70
[email protected]1996a0b12014-07-08 19:01:1571 private:
72 bool is_fullscreen_;
Kent Tamura512a27e2018-10-04 00:49:3273
74 // Maintain a FileSelectListener instance passed to RunFileChooser() until
75 // a callback is called.
76 std::unique_ptr<content::FileSelectListener> file_select_listener_;
[email protected]f1c3c7972012-08-21 18:28:3077};
78
[email protected]f1c3c7972012-08-21 18:28:3079} // namespace android_webview
80
ctzsm0baa01d2017-05-09 04:27:3781#endif // ANDROID_WEBVIEW_BROWSER_AW_WEB_CONTENTS_DELEGATE_H_