blob: 50300954f042eddc2570f74261e58a129d46ec20 [file] [log] [blame]
James Cookb0bf8e82017-04-09 17:01:441// 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>
Xiaoqian Daie26ad8502021-06-17 00:33:459#include <vector>
James Cookb0bf8e82017-04-09 17:01:4410
11#include "ash/ash_export.h"
Alexander Alekseev2b4c9592021-05-04 22:26:4412#include "base/files/file_path.h"
Ken Rockot6b5017e2019-12-05 20:39:4113#include "chromeos/services/multidevice_setup/public/mojom/multidevice_setup.mojom-forward.h"
Stefan Kuhne39a41102021-09-28 18:50:1714#include "chromeos/ui/base/window_pin_type.h"
Ken Rockot3f90e70e02019-12-04 23:27:2315#include "mojo/public/cpp/bindings/pending_receiver.h"
Ken Rockotb9bab542019-12-12 00:53:3016#include "services/device/public/mojom/bluetooth_system.mojom-forward.h"
17#include "services/device/public/mojom/fingerprint.mojom-forward.h"
Becca Hughesc7427842020-11-04 23:27:3818#include "services/media_session/public/cpp/media_session_service.h"
minch64f3b43b2019-10-21 21:59:2619#include "ui/gfx/native_widget_types.h"
anina koehler3b058222022-01-12 16:30:1720#include "url/gurl.h"
James Cookb0bf8e82017-04-09 17:01:4421
varkhad43f55242017-05-26 20:55:5822namespace aura {
23class Window;
24}
25
Collin Baker1ca0b7a32020-04-14 18:33:0026namespace ui {
27class OSExchangeData;
28}
29
James Cookb0bf8e82017-04-09 17:01:4430namespace ash {
31
32class AccessibilityDelegate;
Xiaoqian Daic9f06c792020-02-19 20:52:3533class BackGestureContextualNudgeController;
Richard Chui7f2b9b02021-10-27 01:25:4434class BackGestureContextualNudgeDelegate;
35class CaptureModeDelegate;
Sammie Quon143922902021-11-12 00:02:0136class DesksTemplatesDelegate;
Curt Clemens1def3a32020-09-21 20:10:2437class NearbyShareController;
Curt Clemensc6659632020-09-16 18:32:1538class NearbyShareDelegate;
James Cookb0bf8e82017-04-09 17:01:4439
40// Delegate of the Shell.
41class ASH_EXPORT ShellDelegate {
42 public:
43 // The Shell owns the delegate.
Ahmed Fakhry0c6efef2020-07-30 21:51:1944 virtual ~ShellDelegate() = default;
James Cookb0bf8e82017-04-09 17:01:4445
James Cookb0bf8e82017-04-09 17:01:4446 // Returns true if |window| can be shown for the delegate's concept of current
47 // user.
Andrew Xu048f24b2019-01-16 21:21:2348 virtual bool CanShowWindowForUser(const aura::Window* window) const = 0;
James Cookb0bf8e82017-04-09 17:01:4449
Ahmed Fakhry0c6efef2020-07-30 21:51:1950 // Creates and returns the delegate of the Capture Mode feature.
51 virtual std::unique_ptr<CaptureModeDelegate> CreateCaptureModeDelegate()
52 const = 0;
53
James Cookb0bf8e82017-04-09 17:01:4454 // Creates a accessibility delegate. Shell takes ownership of the delegate.
55 virtual AccessibilityDelegate* CreateAccessibilityDelegate() = 0;
56
Xiaoqian Daic9f06c792020-02-19 20:52:3557 // Creates a back gesture contextual nudge delegate for |controller|.
58 virtual std::unique_ptr<BackGestureContextualNudgeDelegate>
59 CreateBackGestureContextualNudgeDelegate(
60 BackGestureContextualNudgeController* controller) = 0;
61
Curt Clemens1def3a32020-09-21 20:10:2462 virtual std::unique_ptr<NearbyShareDelegate> CreateNearbyShareDelegate(
63 NearbyShareController* controller) const = 0;
Curt Clemensc6659632020-09-16 18:32:1564
Sammie Quon143922902021-11-12 00:02:0165 virtual std::unique_ptr<DesksTemplatesDelegate> CreateDesksTemplatesDelegate()
66 const = 0;
67
minch64f3b43b2019-10-21 21:59:2668 // Check whether the current tab of the browser window can go back.
69 virtual bool CanGoBack(gfx::NativeWindow window) const = 0;
70
chinsenjade910fd2020-09-30 20:28:1671 // Sets the tab scrubber |enabled_| field to |enabled|.
Antonio Gomesdeb475f52021-12-07 16:21:0072 virtual void SetTabScrubberChromeOSEnabled(bool enabled) = 0;
chinsenjade910fd2020-09-30 20:28:1673
Xiaoqian Dai1067eab2020-06-03 22:20:3374 // Returns true if |window| allows default touch behaviors. If false, it means
75 // no default touch behavior is allowed (i.e., the touch action of window is
76 // cc::TouchAction::kNone). This function is used by BackGestureEventHandler
77 // to decide if we can perform the system default back gesture.
78 virtual bool AllowDefaultTouchActions(gfx::NativeWindow window);
79
80 // Returns true if we should wait for touch press ack when deciding if back
81 // gesture can be performed.
82 virtual bool ShouldWaitForTouchPressAck(gfx::NativeWindow window);
83
Collin Bakere5fb2f692020-05-14 01:24:4484 // Checks whether a drag-drop operation is a tab drag.
85 virtual bool IsTabDrag(const ui::OSExchangeData& drop_data);
86
Yuheng Huange141ef22021-07-07 18:03:5187 // Return the height of WebUI tab strip used to determine if a tab has
88 // dragged out of it.
89 virtual int GetBrowserWebUITabStripHeight() = 0;
90
Ken Rockotb9bab542019-12-12 00:53:3091 // Binds a BluetoothSystemFactory receiver if possible.
92 virtual void BindBluetoothSystemFactory(
93 mojo::PendingReceiver<device::mojom::BluetoothSystemFactory> receiver) {}
94
95 // Binds a fingerprint receiver in the Device Service if possible.
96 virtual void BindFingerprint(
97 mojo::PendingReceiver<device::mojom::Fingerprint> receiver) {}
98
Ken Rockot6b5017e2019-12-05 20:39:4199 // Binds a MultiDeviceSetup receiver for the primary profile.
100 virtual void BindMultiDeviceSetup(
101 mojo::PendingReceiver<
102 chromeos::multidevice_setup::mojom::MultiDeviceSetup> receiver) = 0;
103
Ken Rockotb2ac2f12019-12-06 18:33:54104 // Returns an interface to the Media Session service, or null if not
105 // available.
Becca Hughesc7427842020-11-04 23:27:38106 virtual media_session::MediaSessionService* GetMediaSessionService();
Ken Rockotb2ac2f12019-12-06 18:33:54107
James Cookb0bf8e82017-04-09 17:01:44108 virtual void OpenKeyboardShortcutHelpPage() const {}
Cattalyya Nuengsigkapian8c45e302021-01-06 21:48:08109
110 // Returns if window browser sessions are restoring.
111 virtual bool IsSessionRestoreInProgress() const = 0;
Alexander Alekseev494b2d32021-01-20 06:16:43112
Sean Kau8542a122021-10-15 22:46:06113 // Adjust system configuration for a Locked Fullscreen window.
114 virtual void SetUpEnvironmentForLockedFullscreen(bool locked) = 0;
Stefan Kuhne39a41102021-09-28 18:50:17115
Alexander Alekseev494b2d32021-01-20 06:16:43116 // Ui Dev Tools control.
117 virtual bool IsUiDevToolsStarted() const;
118 virtual void StartUiDevTools() {}
119 virtual void StopUiDevTools() {}
120 virtual int GetUiDevToolsPort() const;
Alexander Alekseev2b4c9592021-05-04 22:26:44121
122 // Returns true if Chrome was started with --disable-logging-redirect option.
123 virtual bool IsLoggingRedirectDisabled() const = 0;
124
Xiaoqian Daie26ad8502021-06-17 00:33:45125 // Returns empty path if user session has not started yet, or path to the
Alexander Alekseev2b4c9592021-05-04 22:26:44126 // primary user Downloads folder if user has already logged in.
127 virtual base::FilePath GetPrimaryUserDownloadsFolder() const = 0;
Xiaoqian Daie26ad8502021-06-17 00:33:45128
minch3453ad12021-06-21 18:25:11129 // Opens the feedback page with pre-populated description #BentoBar for
130 // persistent desks bar. Note, this will be removed once the feature is fully
131 // launched or removed.
132 virtual void OpenFeedbackPageForPersistentDesksBar() = 0;
anina koehler3b058222022-01-12 16:30:17133
134 // Returns the last committed URL from the web contents if the given |window|
135 // contains a browser frame, otherwise returns GURL::EmptyURL().
136 virtual const GURL& GetLastCommittedURLForWindowIfAny(aura::Window* window);
James Cookb0bf8e82017-04-09 17:01:44137};
138
139} // namespace ash
140
141#endif // ASH_SHELL_DELEGATE_H_