blob: f1e55f681f0d346f9040ea7f2da01632af4d88fd [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>
9#include <string>
Xiaoqian Daie26ad8502021-06-17 00:33:4510#include <vector>
James Cookb0bf8e82017-04-09 17:01:4411
12#include "ash/ash_export.h"
13#include "base/callback.h"
Alexander Alekseev2b4c9592021-05-04 22:26:4414#include "base/files/file_path.h"
Ken Rockot6b5017e2019-12-05 20:39:4115#include "chromeos/services/multidevice_setup/public/mojom/multidevice_setup.mojom-forward.h"
Ken Rockot3f90e70e02019-12-04 23:27:2316#include "mojo/public/cpp/bindings/pending_receiver.h"
Ken Rockotb9bab542019-12-12 00:53:3017#include "services/device/public/mojom/bluetooth_system.mojom-forward.h"
18#include "services/device/public/mojom/fingerprint.mojom-forward.h"
Becca Hughesc7427842020-11-04 23:27:3819#include "services/media_session/public/cpp/media_session_service.h"
minch64f3b43b2019-10-21 21:59:2620#include "ui/gfx/native_widget_types.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
Xiaoqian Dai87b325b2021-06-22 02:18:1130namespace full_restore {
31struct AppLaunchInfo;
32}
33
James Cookb0bf8e82017-04-09 17:01:4434namespace ash {
35
36class AccessibilityDelegate;
Ahmed Fakhry0c6efef2020-07-30 21:51:1937class CaptureModeDelegate;
James Cook5e9d3402017-11-01 00:20:1238class ScreenshotDelegate;
Xiaoqian Daic9f06c792020-02-19 20:52:3539class BackGestureContextualNudgeDelegate;
40class BackGestureContextualNudgeController;
Curt Clemens1def3a32020-09-21 20:10:2441class NearbyShareController;
Curt Clemensc6659632020-09-16 18:32:1542class NearbyShareDelegate;
James Cookb0bf8e82017-04-09 17:01:4443
44// Delegate of the Shell.
45class ASH_EXPORT ShellDelegate {
46 public:
47 // The Shell owns the delegate.
Ahmed Fakhry0c6efef2020-07-30 21:51:1948 virtual ~ShellDelegate() = default;
James Cookb0bf8e82017-04-09 17:01:4449
James Cookb0bf8e82017-04-09 17:01:4450 // Returns true if |window| can be shown for the delegate's concept of current
51 // user.
Andrew Xu048f24b2019-01-16 21:21:2352 virtual bool CanShowWindowForUser(const aura::Window* window) const = 0;
James Cookb0bf8e82017-04-09 17:01:4453
Ahmed Fakhry0c6efef2020-07-30 21:51:1954 // Creates and returns the delegate of the Capture Mode feature.
55 virtual std::unique_ptr<CaptureModeDelegate> CreateCaptureModeDelegate()
56 const = 0;
57
James Cookd03127612020-08-28 20:11:0458 // Creates the screenshot delegate, which has dependencies on //chrome.
James Cook5e9d3402017-11-01 00:20:1259 virtual std::unique_ptr<ScreenshotDelegate> CreateScreenshotDelegate() = 0;
60
James Cookb0bf8e82017-04-09 17:01:4461 // Creates a accessibility delegate. Shell takes ownership of the delegate.
62 virtual AccessibilityDelegate* CreateAccessibilityDelegate() = 0;
63
Xiaoqian Daic9f06c792020-02-19 20:52:3564 // Creates a back gesture contextual nudge delegate for |controller|.
65 virtual std::unique_ptr<BackGestureContextualNudgeDelegate>
66 CreateBackGestureContextualNudgeDelegate(
67 BackGestureContextualNudgeController* controller) = 0;
68
Curt Clemens1def3a32020-09-21 20:10:2469 virtual std::unique_ptr<NearbyShareDelegate> CreateNearbyShareDelegate(
70 NearbyShareController* controller) const = 0;
Curt Clemensc6659632020-09-16 18:32:1571
minch64f3b43b2019-10-21 21:59:2672 // Check whether the current tab of the browser window can go back.
73 virtual bool CanGoBack(gfx::NativeWindow window) const = 0;
74
chinsenjade910fd2020-09-30 20:28:1675 // Sets the tab scrubber |enabled_| field to |enabled|.
76 virtual void SetTabScrubberEnabled(bool enabled) = 0;
77
Xiaoqian Dai1067eab2020-06-03 22:20:3378 // Returns true if |window| allows default touch behaviors. If false, it means
79 // no default touch behavior is allowed (i.e., the touch action of window is
80 // cc::TouchAction::kNone). This function is used by BackGestureEventHandler
81 // to decide if we can perform the system default back gesture.
82 virtual bool AllowDefaultTouchActions(gfx::NativeWindow window);
83
84 // Returns true if we should wait for touch press ack when deciding if back
85 // gesture can be performed.
86 virtual bool ShouldWaitForTouchPressAck(gfx::NativeWindow window);
87
Collin Bakere5fb2f692020-05-14 01:24:4488 // Checks whether a drag-drop operation is a tab drag.
89 virtual bool IsTabDrag(const ui::OSExchangeData& drop_data);
90
91 // Drops tab in a new browser window. |drop_data| must be from a tab
92 // drag as determined by IsTabDrag() above.
Collin Bakeraec43872020-05-07 20:28:5793 virtual aura::Window* CreateBrowserForTabDrop(
94 aura::Window* source_window,
95 const ui::OSExchangeData& drop_data);
Collin Baker1ca0b7a32020-04-14 18:33:0096
Ken Rockotb9bab542019-12-12 00:53:3097 // Binds a BluetoothSystemFactory receiver if possible.
98 virtual void BindBluetoothSystemFactory(
99 mojo::PendingReceiver<device::mojom::BluetoothSystemFactory> receiver) {}
100
101 // Binds a fingerprint receiver in the Device Service if possible.
102 virtual void BindFingerprint(
103 mojo::PendingReceiver<device::mojom::Fingerprint> receiver) {}
104
Ken Rockot6b5017e2019-12-05 20:39:41105 // Binds a MultiDeviceSetup receiver for the primary profile.
106 virtual void BindMultiDeviceSetup(
107 mojo::PendingReceiver<
108 chromeos::multidevice_setup::mojom::MultiDeviceSetup> receiver) = 0;
109
Ken Rockotb2ac2f12019-12-06 18:33:54110 // Returns an interface to the Media Session service, or null if not
111 // available.
Becca Hughesc7427842020-11-04 23:27:38112 virtual media_session::MediaSessionService* GetMediaSessionService();
Ken Rockotb2ac2f12019-12-06 18:33:54113
James Cookb0bf8e82017-04-09 17:01:44114 virtual void OpenKeyboardShortcutHelpPage() const {}
Cattalyya Nuengsigkapian8c45e302021-01-06 21:48:08115
116 // Returns if window browser sessions are restoring.
117 virtual bool IsSessionRestoreInProgress() const = 0;
Alexander Alekseev494b2d32021-01-20 06:16:43118
119 // Ui Dev Tools control.
120 virtual bool IsUiDevToolsStarted() const;
121 virtual void StartUiDevTools() {}
122 virtual void StopUiDevTools() {}
123 virtual int GetUiDevToolsPort() const;
Alexander Alekseev2b4c9592021-05-04 22:26:44124
125 // Returns true if Chrome was started with --disable-logging-redirect option.
126 virtual bool IsLoggingRedirectDisabled() const = 0;
127
Xiaoqian Daie26ad8502021-06-17 00:33:45128 // Returns empty path if user session has not started yet, or path to the
Alexander Alekseev2b4c9592021-05-04 22:26:44129 // primary user Downloads folder if user has already logged in.
130 virtual base::FilePath GetPrimaryUserDownloadsFolder() const = 0;
Xiaoqian Daie26ad8502021-06-17 00:33:45131
minch3453ad12021-06-21 18:25:11132 // Opens the feedback page with pre-populated description #BentoBar for
133 // persistent desks bar. Note, this will be removed once the feature is fully
134 // launched or removed.
135 virtual void OpenFeedbackPageForPersistentDesksBar() = 0;
Xiaoqian Dai87b325b2021-06-22 02:18:11136
137 // Returns the app launch data that's associated with a particular |window| in
138 // order to construct a desk template. Return nullptr if no such app launch
139 // data can be constructed, which can happen if the |window| does not have
140 // an app id associated with it, or we're not in the primary active user
141 // session.
142 virtual std::unique_ptr<full_restore::AppLaunchInfo>
143 GetAppLaunchDataForDeskTemplate(aura::Window* window) const = 0;
James Cookb0bf8e82017-04-09 17:01:44144};
145
146} // namespace ash
147
148#endif // ASH_SHELL_DELEGATE_H_