James Cook | b0bf8e8 | 2017-04-09 17:01:44 | [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 | |
| 5 | #ifndef ASH_SHELL_DELEGATE_H_ |
| 6 | #define ASH_SHELL_DELEGATE_H_ |
| 7 | |
| 8 | #include <memory> |
| 9 | #include <string> |
| 10 | |
| 11 | #include "ash/ash_export.h" |
| 12 | #include "base/callback.h" |
| 13 | #include "base/strings/string16.h" |
Ken Rockot | 6b5017e | 2019-12-05 20:39:41 | [diff] [blame] | 14 | #include "chromeos/services/multidevice_setup/public/mojom/multidevice_setup.mojom-forward.h" |
Ken Rockot | 3f90e70e0 | 2019-12-04 23:27:23 | [diff] [blame] | 15 | #include "mojo/public/cpp/bindings/pending_receiver.h" |
Ken Rockot | b9bab54 | 2019-12-12 00:53:30 | [diff] [blame] | 16 | #include "services/device/public/mojom/bluetooth_system.mojom-forward.h" |
| 17 | #include "services/device/public/mojom/fingerprint.mojom-forward.h" |
Becca Hughes | c742784 | 2020-11-04 23:27:38 | [diff] [blame^] | 18 | #include "services/media_session/public/cpp/media_session_service.h" |
minch | 64f3b43b | 2019-10-21 21:59:26 | [diff] [blame] | 19 | #include "ui/gfx/native_widget_types.h" |
James Cook | b0bf8e8 | 2017-04-09 17:01:44 | [diff] [blame] | 20 | |
varkha | d43f5524 | 2017-05-26 20:55:58 | [diff] [blame] | 21 | namespace aura { |
| 22 | class Window; |
| 23 | } |
| 24 | |
Collin Baker | 1ca0b7a3 | 2020-04-14 18:33:00 | [diff] [blame] | 25 | namespace ui { |
| 26 | class OSExchangeData; |
| 27 | } |
| 28 | |
James Cook | b0bf8e8 | 2017-04-09 17:01:44 | [diff] [blame] | 29 | namespace ash { |
| 30 | |
| 31 | class AccessibilityDelegate; |
Ahmed Fakhry | 0c6efef | 2020-07-30 21:51:19 | [diff] [blame] | 32 | class CaptureModeDelegate; |
James Cook | 5e9d340 | 2017-11-01 00:20:12 | [diff] [blame] | 33 | class ScreenshotDelegate; |
Xiaoqian Dai | c9f06c79 | 2020-02-19 20:52:35 | [diff] [blame] | 34 | class BackGestureContextualNudgeDelegate; |
| 35 | class BackGestureContextualNudgeController; |
Curt Clemens | 1def3a3 | 2020-09-21 20:10:24 | [diff] [blame] | 36 | class NearbyShareController; |
Curt Clemens | c665963 | 2020-09-16 18:32:15 | [diff] [blame] | 37 | class NearbyShareDelegate; |
James Cook | b0bf8e8 | 2017-04-09 17:01:44 | [diff] [blame] | 38 | |
| 39 | // Delegate of the Shell. |
| 40 | class ASH_EXPORT ShellDelegate { |
| 41 | public: |
| 42 | // The Shell owns the delegate. |
Ahmed Fakhry | 0c6efef | 2020-07-30 21:51:19 | [diff] [blame] | 43 | virtual ~ShellDelegate() = default; |
James Cook | b0bf8e8 | 2017-04-09 17:01:44 | [diff] [blame] | 44 | |
James Cook | b0bf8e8 | 2017-04-09 17:01:44 | [diff] [blame] | 45 | // Returns true if |window| can be shown for the delegate's concept of current |
| 46 | // user. |
Andrew Xu | 048f24b | 2019-01-16 21:21:23 | [diff] [blame] | 47 | virtual bool CanShowWindowForUser(const aura::Window* window) const = 0; |
James Cook | b0bf8e8 | 2017-04-09 17:01:44 | [diff] [blame] | 48 | |
Ahmed Fakhry | 0c6efef | 2020-07-30 21:51:19 | [diff] [blame] | 49 | // Creates and returns the delegate of the Capture Mode feature. |
| 50 | virtual std::unique_ptr<CaptureModeDelegate> CreateCaptureModeDelegate() |
| 51 | const = 0; |
| 52 | |
James Cook | d0312761 | 2020-08-28 20:11:04 | [diff] [blame] | 53 | // Creates the screenshot delegate, which has dependencies on //chrome. |
James Cook | 5e9d340 | 2017-11-01 00:20:12 | [diff] [blame] | 54 | virtual std::unique_ptr<ScreenshotDelegate> CreateScreenshotDelegate() = 0; |
| 55 | |
James Cook | b0bf8e8 | 2017-04-09 17:01:44 | [diff] [blame] | 56 | // Creates a accessibility delegate. Shell takes ownership of the delegate. |
| 57 | virtual AccessibilityDelegate* CreateAccessibilityDelegate() = 0; |
| 58 | |
Xiaoqian Dai | c9f06c79 | 2020-02-19 20:52:35 | [diff] [blame] | 59 | // Creates a back gesture contextual nudge delegate for |controller|. |
| 60 | virtual std::unique_ptr<BackGestureContextualNudgeDelegate> |
| 61 | CreateBackGestureContextualNudgeDelegate( |
| 62 | BackGestureContextualNudgeController* controller) = 0; |
| 63 | |
Curt Clemens | 1def3a3 | 2020-09-21 20:10:24 | [diff] [blame] | 64 | virtual std::unique_ptr<NearbyShareDelegate> CreateNearbyShareDelegate( |
| 65 | NearbyShareController* controller) const = 0; |
Curt Clemens | c665963 | 2020-09-16 18:32:15 | [diff] [blame] | 66 | |
minch | 64f3b43b | 2019-10-21 21:59:26 | [diff] [blame] | 67 | // Check whether the current tab of the browser window can go back. |
| 68 | virtual bool CanGoBack(gfx::NativeWindow window) const = 0; |
| 69 | |
chinsenj | ade910fd | 2020-09-30 20:28:16 | [diff] [blame] | 70 | // Sets the tab scrubber |enabled_| field to |enabled|. |
| 71 | virtual void SetTabScrubberEnabled(bool enabled) = 0; |
| 72 | |
Xiaoqian Dai | 1067eab | 2020-06-03 22:20:33 | [diff] [blame] | 73 | // Returns true if |window| allows default touch behaviors. If false, it means |
| 74 | // no default touch behavior is allowed (i.e., the touch action of window is |
| 75 | // cc::TouchAction::kNone). This function is used by BackGestureEventHandler |
| 76 | // to decide if we can perform the system default back gesture. |
| 77 | virtual bool AllowDefaultTouchActions(gfx::NativeWindow window); |
| 78 | |
| 79 | // Returns true if we should wait for touch press ack when deciding if back |
| 80 | // gesture can be performed. |
| 81 | virtual bool ShouldWaitForTouchPressAck(gfx::NativeWindow window); |
| 82 | |
Collin Baker | e5fb2f69 | 2020-05-14 01:24:44 | [diff] [blame] | 83 | // Checks whether a drag-drop operation is a tab drag. |
| 84 | virtual bool IsTabDrag(const ui::OSExchangeData& drop_data); |
| 85 | |
| 86 | // Drops tab in a new browser window. |drop_data| must be from a tab |
| 87 | // drag as determined by IsTabDrag() above. |
Collin Baker | aec4387 | 2020-05-07 20:28:57 | [diff] [blame] | 88 | virtual aura::Window* CreateBrowserForTabDrop( |
| 89 | aura::Window* source_window, |
| 90 | const ui::OSExchangeData& drop_data); |
Collin Baker | 1ca0b7a3 | 2020-04-14 18:33:00 | [diff] [blame] | 91 | |
Ken Rockot | b9bab54 | 2019-12-12 00:53:30 | [diff] [blame] | 92 | // Binds a BluetoothSystemFactory receiver if possible. |
| 93 | virtual void BindBluetoothSystemFactory( |
| 94 | mojo::PendingReceiver<device::mojom::BluetoothSystemFactory> receiver) {} |
| 95 | |
| 96 | // Binds a fingerprint receiver in the Device Service if possible. |
| 97 | virtual void BindFingerprint( |
| 98 | mojo::PendingReceiver<device::mojom::Fingerprint> receiver) {} |
| 99 | |
Ken Rockot | 6b5017e | 2019-12-05 20:39:41 | [diff] [blame] | 100 | // Binds a MultiDeviceSetup receiver for the primary profile. |
| 101 | virtual void BindMultiDeviceSetup( |
| 102 | mojo::PendingReceiver< |
| 103 | chromeos::multidevice_setup::mojom::MultiDeviceSetup> receiver) = 0; |
| 104 | |
Ken Rockot | b2ac2f1 | 2019-12-06 18:33:54 | [diff] [blame] | 105 | // Returns an interface to the Media Session service, or null if not |
| 106 | // available. |
Becca Hughes | c742784 | 2020-11-04 23:27:38 | [diff] [blame^] | 107 | virtual media_session::MediaSessionService* GetMediaSessionService(); |
Ken Rockot | b2ac2f1 | 2019-12-06 18:33:54 | [diff] [blame] | 108 | |
James Cook | b0bf8e8 | 2017-04-09 17:01:44 | [diff] [blame] | 109 | virtual void OpenKeyboardShortcutHelpPage() const {} |
James Cook | b0bf8e8 | 2017-04-09 17:01:44 | [diff] [blame] | 110 | }; |
| 111 | |
| 112 | } // namespace ash |
| 113 | |
| 114 | #endif // ASH_SHELL_DELEGATE_H_ |