blob: f383d2d704621458d6241972e21f70adf2b11de6 [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"
Yeunjoo Choi49b30472022-02-22 02:54:5312#include "ash/services/multidevice_setup/public/mojom/multidevice_setup.mojom-forward.h"
Alexander Alekseev2b4c9592021-05-04 22:26:4413#include "base/files/file_path.h"
Stefan Kuhne39a41102021-09-28 18:50:1714#include "chromeos/ui/base/window_pin_type.h"
Roger Tinkofff01d8732022-07-07 23:59:4015#include "components/version_info/channel.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"
Cattalyya Nuengsigkapian3c4480a2022-03-17 20:28:1920#include "services/network/public/cpp/shared_url_loader_factory.h"
minch64f3b43b2019-10-21 21:59:2621#include "ui/gfx/native_widget_types.h"
anina koehler3b058222022-01-12 16:30:1722#include "url/gurl.h"
James Cookb0bf8e82017-04-09 17:01:4423
varkhad43f55242017-05-26 20:55:5824namespace aura {
25class Window;
26}
27
Collin Baker1ca0b7a32020-04-14 18:33:0028namespace ui {
29class OSExchangeData;
30}
31
James Cookb0bf8e82017-04-09 17:01:4432namespace ash {
33
34class AccessibilityDelegate;
Xiaoqian Daic9f06c792020-02-19 20:52:3535class BackGestureContextualNudgeController;
Richard Chui7f2b9b02021-10-27 01:25:4436class BackGestureContextualNudgeDelegate;
37class CaptureModeDelegate;
Sammie Quon143922902021-11-12 00:02:0138class DesksTemplatesDelegate;
Curt Clemens1def3a32020-09-21 20:10:2439class NearbyShareController;
Curt Clemensc6659632020-09-16 18:32:1540class NearbyShareDelegate;
James Cookb0bf8e82017-04-09 17:01:4441
42// Delegate of the Shell.
43class ASH_EXPORT ShellDelegate {
44 public:
45 // The Shell owns the delegate.
Ahmed Fakhry0c6efef2020-07-30 21:51:1946 virtual ~ShellDelegate() = default;
James Cookb0bf8e82017-04-09 17:01:4447
James Cookb0bf8e82017-04-09 17:01:4448 // Returns true if |window| can be shown for the delegate's concept of current
49 // user.
Andrew Xu048f24b2019-01-16 21:21:2350 virtual bool CanShowWindowForUser(const aura::Window* window) const = 0;
James Cookb0bf8e82017-04-09 17:01:4451
Ahmed Fakhry0c6efef2020-07-30 21:51:1952 // Creates and returns the delegate of the Capture Mode feature.
53 virtual std::unique_ptr<CaptureModeDelegate> CreateCaptureModeDelegate()
54 const = 0;
55
James Cookb0bf8e82017-04-09 17:01:4456 // Creates a accessibility delegate. Shell takes ownership of the delegate.
57 virtual AccessibilityDelegate* CreateAccessibilityDelegate() = 0;
58
Xiaoqian Daic9f06c792020-02-19 20:52:3559 // Creates a back gesture contextual nudge delegate for |controller|.
60 virtual std::unique_ptr<BackGestureContextualNudgeDelegate>
61 CreateBackGestureContextualNudgeDelegate(
62 BackGestureContextualNudgeController* controller) = 0;
63
Curt Clemens1def3a32020-09-21 20:10:2464 virtual std::unique_ptr<NearbyShareDelegate> CreateNearbyShareDelegate(
65 NearbyShareController* controller) const = 0;
Curt Clemensc6659632020-09-16 18:32:1566
Sammie Quon143922902021-11-12 00:02:0167 virtual std::unique_ptr<DesksTemplatesDelegate> CreateDesksTemplatesDelegate()
68 const = 0;
69
Cattalyya Nuengsigkapian3c4480a2022-03-17 20:28:1970 // Returns the geolocation loader factory used to initialize geolocation
71 // provider.
72 virtual scoped_refptr<network::SharedURLLoaderFactory>
Cattalyya Nuengsigkapian2e703a82022-03-26 00:29:5973 GetGeolocationUrlLoaderFactory() const = 0;
Cattalyya Nuengsigkapian3c4480a2022-03-17 20:28:1974
minch64f3b43b2019-10-21 21:59:2675 // Check whether the current tab of the browser window can go back.
76 virtual bool CanGoBack(gfx::NativeWindow window) const = 0;
77
chinsenjade910fd2020-09-30 20:28:1678 // Sets the tab scrubber |enabled_| field to |enabled|.
Antonio Gomesdeb475f52021-12-07 16:21:0079 virtual void SetTabScrubberChromeOSEnabled(bool enabled) = 0;
chinsenjade910fd2020-09-30 20:28:1680
Xiaoqian Dai1067eab2020-06-03 22:20:3381 // Returns true if |window| allows default touch behaviors. If false, it means
82 // no default touch behavior is allowed (i.e., the touch action of window is
83 // cc::TouchAction::kNone). This function is used by BackGestureEventHandler
84 // to decide if we can perform the system default back gesture.
85 virtual bool AllowDefaultTouchActions(gfx::NativeWindow window);
86
87 // Returns true if we should wait for touch press ack when deciding if back
88 // gesture can be performed.
89 virtual bool ShouldWaitForTouchPressAck(gfx::NativeWindow window);
90
Collin Bakere5fb2f692020-05-14 01:24:4491 // Checks whether a drag-drop operation is a tab drag.
92 virtual bool IsTabDrag(const ui::OSExchangeData& drop_data);
93
Yuheng Huange141ef22021-07-07 18:03:5194 // Return the height of WebUI tab strip used to determine if a tab has
95 // dragged out of it.
96 virtual int GetBrowserWebUITabStripHeight() = 0;
97
Ken Rockotb9bab542019-12-12 00:53:3098 // Binds a BluetoothSystemFactory receiver if possible.
99 virtual void BindBluetoothSystemFactory(
100 mojo::PendingReceiver<device::mojom::BluetoothSystemFactory> receiver) {}
101
102 // Binds a fingerprint receiver in the Device Service if possible.
103 virtual void BindFingerprint(
104 mojo::PendingReceiver<device::mojom::Fingerprint> receiver) {}
105
Ken Rockot6b5017e2019-12-05 20:39:41106 // Binds a MultiDeviceSetup receiver for the primary profile.
107 virtual void BindMultiDeviceSetup(
Yeunjoo Choi98f3ec562022-03-04 04:26:00108 mojo::PendingReceiver<multidevice_setup::mojom::MultiDeviceSetup>
109 receiver) = 0;
Ken Rockot6b5017e2019-12-05 20:39:41110
Ken Rockotb2ac2f12019-12-06 18:33:54111 // Returns an interface to the Media Session service, or null if not
112 // available.
Becca Hughesc7427842020-11-04 23:27:38113 virtual media_session::MediaSessionService* GetMediaSessionService();
Ken Rockotb2ac2f12019-12-06 18:33:54114
James Cookb0bf8e82017-04-09 17:01:44115 virtual void OpenKeyboardShortcutHelpPage() const {}
Cattalyya Nuengsigkapian8c45e302021-01-06 21:48:08116
117 // Returns if window browser sessions are restoring.
118 virtual bool IsSessionRestoreInProgress() const = 0;
Alexander Alekseev494b2d32021-01-20 06:16:43119
Sean Kau8542a122021-10-15 22:46:06120 // Adjust system configuration for a Locked Fullscreen window.
121 virtual void SetUpEnvironmentForLockedFullscreen(bool locked) = 0;
Stefan Kuhne39a41102021-09-28 18:50:17122
Alexander Alekseev494b2d32021-01-20 06:16:43123 // Ui Dev Tools control.
124 virtual bool IsUiDevToolsStarted() const;
125 virtual void StartUiDevTools() {}
126 virtual void StopUiDevTools() {}
127 virtual int GetUiDevToolsPort() const;
Alexander Alekseev2b4c9592021-05-04 22:26:44128
129 // Returns true if Chrome was started with --disable-logging-redirect option.
130 virtual bool IsLoggingRedirectDisabled() const = 0;
131
Xiaoqian Daie26ad8502021-06-17 00:33:45132 // Returns empty path if user session has not started yet, or path to the
Alexander Alekseev2b4c9592021-05-04 22:26:44133 // primary user Downloads folder if user has already logged in.
134 virtual base::FilePath GetPrimaryUserDownloadsFolder() const = 0;
Xiaoqian Daie26ad8502021-06-17 00:33:45135
minch3453ad12021-06-21 18:25:11136 // Opens the feedback page with pre-populated description #BentoBar for
137 // persistent desks bar. Note, this will be removed once the feature is fully
138 // launched or removed.
139 virtual void OpenFeedbackPageForPersistentDesksBar() = 0;
anina koehler3b058222022-01-12 16:30:17140
141 // Returns the last committed URL from the web contents if the given |window|
142 // contains a browser frame, otherwise returns GURL::EmptyURL().
143 virtual const GURL& GetLastCommittedURLForWindowIfAny(aura::Window* window);
Roger Tinkofff01d8732022-07-07 23:59:40144
145 // Retrieves the release track on which the device resides.
146 virtual version_info::Channel GetChannel() = 0;
Ben Becker6a2af1b2022-07-20 22:41:11147
148 // Tells browsers not to ask the user to confirm that they want to close a
149 // window when that window is closed.
150 virtual void ForceSkipWarningUserOnClose(
151 const std::vector<aura::Window*>& windows) = 0;
Roger Tinkoffbc55d7692022-07-22 23:58:27152
153 // Retrieves the official Chrome version string e.g. 105.0.5178.0.
154 virtual std::string GetVersionString() = 0;
James Cookb0bf8e82017-04-09 17:01:44155};
156
157} // namespace ash
158
159#endif // ASH_SHELL_DELEGATE_H_