[email protected] | f1c3c797 | 2012-08-21 18:28:30 | [diff] [blame] | 1 | // 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 | |
ctzsm | 0baa01d | 2017-05-09 04:27:37 | [diff] [blame] | 5 | #ifndef ANDROID_WEBVIEW_BROWSER_AW_WEB_CONTENTS_DELEGATE_H_ |
| 6 | #define ANDROID_WEBVIEW_BROWSER_AW_WEB_CONTENTS_DELEGATE_H_ |
[email protected] | f1c3c797 | 2012-08-21 18:28:30 | [diff] [blame] | 7 | |
Jinsuk Kim | 351a925 | 2018-07-11 23:23:36 | [diff] [blame] | 8 | #include "components/embedder_support/android/delegate/web_contents_delegate_android.h" |
[email protected] | f1c3c797 | 2012-08-21 18:28:30 | [diff] [blame] | 9 | |
| 10 | namespace 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. |
| 15 | class AwWebContentsDelegate |
[email protected] | da30444 | 2013-05-29 21:38:53 | [diff] [blame] | 16 | : public web_contents_delegate_android::WebContentsDelegateAndroid { |
[email protected] | f1c3c797 | 2012-08-21 18:28:30 | [diff] [blame] | 17 | public: |
| 18 | AwWebContentsDelegate(JNIEnv* env, jobject obj); |
dcheng | 9b4dd1aa | 2015-02-04 02:56:54 | [diff] [blame] | 19 | ~AwWebContentsDelegate() override; |
Tobias Sargeant | e0993fd7 | 2018-11-28 10:47:53 | [diff] [blame] | 20 | |
| 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 | |
dcheng | 9b4dd1aa | 2015-02-04 02:56:54 | [diff] [blame] | 30 | content::JavaScriptDialogManager* GetJavaScriptDialogManager( |
mathiash | 72a5e46 | 2014-11-19 08:18:50 | [diff] [blame] | 31 | content::WebContents* source) override; |
dcheng | 9b4dd1aa | 2015-02-04 02:56:54 | [diff] [blame] | 32 | 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; |
rdsmith | daa9227 | 2015-05-21 20:33:41 | [diff] [blame] | 38 | void CanDownload(const GURL& url, |
dcheng | 9b4dd1aa | 2015-02-04 02:56:54 | [diff] [blame] | 39 | const std::string& request_method, |
Avi Drissman | 346e0ea | 2019-04-02 00:08:46 | [diff] [blame] | 40 | base::OnceCallback<void(bool)> callback) override; |
nasko | 35169af | 2016-06-10 18:47:13 | [diff] [blame] | 41 | void RunFileChooser(content::RenderFrameHost* render_frame_host, |
Kent Tamura | 512a27e | 2018-10-04 00:49:32 | [diff] [blame] | 42 | std::unique_ptr<content::FileSelectListener> listener, |
Kent Tamura | c260c9a | 2018-09-14 09:10:56 | [diff] [blame] | 43 | const blink::mojom::FileChooserParams& params) override; |
dcheng | 9b4dd1aa | 2015-02-04 02:56:54 | [diff] [blame] | 44 | void AddNewContents(content::WebContents* source, |
erikchen | bee5c962 | 2018-04-27 19:30:25 | [diff] [blame] | 45 | std::unique_ptr<content::WebContents> new_contents, |
dcheng | 9b4dd1aa | 2015-02-04 02:56:54 | [diff] [blame] | 46 | WindowOpenDisposition disposition, |
| 47 | const gfx::Rect& initial_rect, |
| 48 | bool user_gesture, |
| 49 | bool* was_blocked) override; |
[email protected] | 0b85508d | 2013-12-10 04:33:53 | [diff] [blame] | 50 | |
mnaganov | b2803fd | 2015-03-04 13:42:03 | [diff] [blame] | 51 | void NavigationStateChanged(content::WebContents* source, |
| 52 | content::InvalidateTypes changed_flags) override; |
Bryan McQuade | d2b93c0 | 2017-07-14 22:26:31 | [diff] [blame] | 53 | 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] | 0b85508d | 2013-12-10 04:33:53 | [diff] [blame] | 59 | |
dcheng | 9b4dd1aa | 2015-02-04 02:56:54 | [diff] [blame] | 60 | void CloseContents(content::WebContents* source) override; |
| 61 | void ActivateContents(content::WebContents* contents) override; |
mnaganov | 27cdc32 | 2015-06-05 15:40:20 | [diff] [blame] | 62 | void LoadingStateChanged(content::WebContents* source, |
| 63 | bool to_different_document) override; |
gsennton | f9205b6f | 2015-10-30 16:57:03 | [diff] [blame] | 64 | bool ShouldResumeRequestsForCreatedWindow() override; |
dcheng | 9b4dd1aa | 2015-02-04 02:56:54 | [diff] [blame] | 65 | void RequestMediaAccessPermission( |
[email protected] | 32e2d4aac | 2014-05-01 17:54:13 | [diff] [blame] | 66 | content::WebContents* web_contents, |
| 67 | const content::MediaStreamRequest& request, |
Mark Pilgrim | 5749908 | 2018-06-12 12:38:30 | [diff] [blame] | 68 | content::MediaResponseCallback callback) override; |
Dave Tapuska | 3ed4419 | 2018-05-01 18:53:30 | [diff] [blame] | 69 | void EnterFullscreenModeForTab( |
| 70 | content::WebContents* web_contents, |
| 71 | const GURL& origin, |
| 72 | const blink::WebFullscreenOptions& options) override; |
dcheng | 9b4dd1aa | 2015-02-04 02:56:54 | [diff] [blame] | 73 | void ExitFullscreenModeForTab(content::WebContents* web_contents) override; |
| 74 | bool IsFullscreenForTabOrPending( |
Lucas Furukawa Gadani | 4909f3c | 2019-06-18 22:36:52 | [diff] [blame^] | 75 | const content::WebContents* web_contents) override; |
Clark DuVall | a0e4299 | 2018-09-17 17:00:11 | [diff] [blame] | 76 | void UpdateUserGestureCarryoverInfo( |
| 77 | content::WebContents* web_contents) override; |
[email protected] | 1996a0b1 | 2014-07-08 19:01:15 | [diff] [blame] | 78 | |
Kent Tamura | 512a27e | 2018-10-04 00:49:32 | [diff] [blame] | 79 | std::unique_ptr<content::FileSelectListener> TakeFileSelectListener(); |
| 80 | |
[email protected] | 1996a0b1 | 2014-07-08 19:01:15 | [diff] [blame] | 81 | private: |
| 82 | bool is_fullscreen_; |
Kent Tamura | 512a27e | 2018-10-04 00:49:32 | [diff] [blame] | 83 | |
| 84 | // Maintain a FileSelectListener instance passed to RunFileChooser() until |
| 85 | // a callback is called. |
| 86 | std::unique_ptr<content::FileSelectListener> file_select_listener_; |
[email protected] | f1c3c797 | 2012-08-21 18:28:30 | [diff] [blame] | 87 | }; |
| 88 | |
[email protected] | f1c3c797 | 2012-08-21 18:28:30 | [diff] [blame] | 89 | } // namespace android_webview |
| 90 | |
ctzsm | 0baa01d | 2017-05-09 04:27:37 | [diff] [blame] | 91 | #endif // ANDROID_WEBVIEW_BROWSER_AW_WEB_CONTENTS_DELEGATE_H_ |