Fix FullScreen crash in Webapp
[platform/framework/web/chromium-efl.git] / ash / shell_delegate.h
1 // Copyright 2012 The Chromium Authors
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 <vector>
10
11 #include "ash/ash_export.h"
12 #include "base/files/file_path.h"
13 #include "chromeos/ash/services/multidevice_setup/public/mojom/multidevice_setup.mojom-forward.h"
14 #include "chromeos/ui/base/window_pin_type.h"
15 #include "components/version_info/channel.h"
16 #include "mojo/public/cpp/bindings/pending_receiver.h"
17 #include "services/device/public/mojom/fingerprint.mojom-forward.h"
18 #include "services/media_session/public/cpp/media_session_service.h"
19 #include "services/network/public/cpp/shared_url_loader_factory.h"
20 #include "services/video_capture/public/mojom/multi_capture_service.mojom-forward.h"
21 #include "ui/gfx/native_widget_types.h"
22 #include "url/gurl.h"
23
24 namespace aura {
25 class Window;
26 }
27
28 namespace ui {
29 class OSExchangeData;
30 }
31
32 namespace ash {
33
34 class AcceleratorPrefsDelegate;
35 class AccessibilityDelegate;
36 class BackGestureContextualNudgeController;
37 class BackGestureContextualNudgeDelegate;
38 class CaptureModeDelegate;
39 class ClipboardHistoryControllerDelegate;
40 class GameDashboardDelegate;
41 class MediaNotificationProvider;
42 class NearbyShareController;
43 class NearbyShareDelegate;
44 class SavedDeskDelegate;
45 class SystemSoundsDelegate;
46 class UserEducationDelegate;
47 class WindowState;
48
49 // Delegate of the Shell.
50 class ASH_EXPORT ShellDelegate {
51  public:
52   enum class FeedbackSource {
53     kGameDashboard,
54     kWindowLayoutMenu,
55   };
56
57   // The Shell owns the delegate.
58   virtual ~ShellDelegate() = default;
59
60   // Returns true if |window| can be shown for the delegate's concept of current
61   // user.
62   virtual bool CanShowWindowForUser(const aura::Window* window) const = 0;
63
64   // Creates and returns the delegate of the Capture Mode feature.
65   virtual std::unique_ptr<CaptureModeDelegate> CreateCaptureModeDelegate()
66       const = 0;
67
68   // Creates and returns the delegate of the clipboard history feature.
69   virtual std::unique_ptr<ClipboardHistoryControllerDelegate>
70   CreateClipboardHistoryControllerDelegate() const = 0;
71
72   // Creates and returns the delegate of the Game Dashboard feature.
73   virtual std::unique_ptr<GameDashboardDelegate> CreateGameDashboardDelegate()
74       const = 0;
75
76   // Creates a accelerator_prefs_delegate.
77   virtual std::unique_ptr<AcceleratorPrefsDelegate>
78   CreateAcceleratorPrefsDelegate() const = 0;
79
80   // Creates a accessibility delegate. Shell takes ownership of the delegate.
81   virtual AccessibilityDelegate* CreateAccessibilityDelegate() = 0;
82
83   // Creates a back gesture contextual nudge delegate for |controller|.
84   virtual std::unique_ptr<BackGestureContextualNudgeDelegate>
85   CreateBackGestureContextualNudgeDelegate(
86       BackGestureContextualNudgeController* controller) = 0;
87
88   virtual std::unique_ptr<MediaNotificationProvider>
89   CreateMediaNotificationProvider() = 0;
90
91   virtual std::unique_ptr<NearbyShareDelegate> CreateNearbyShareDelegate(
92       NearbyShareController* controller) const = 0;
93
94   virtual std::unique_ptr<SavedDeskDelegate> CreateSavedDeskDelegate()
95       const = 0;
96
97   // Creates and returns the delegate of the System Sounds feature.
98   virtual std::unique_ptr<SystemSoundsDelegate> CreateSystemSoundsDelegate()
99       const = 0;
100
101   // Creates and returns the delegate for user education features.
102   virtual std::unique_ptr<UserEducationDelegate> CreateUserEducationDelegate()
103       const = 0;
104
105   // Returns the geolocation loader factory used to initialize geolocation
106   // provider.
107   virtual scoped_refptr<network::SharedURLLoaderFactory>
108   GetGeolocationUrlLoaderFactory() const = 0;
109
110   // Check whether the current tab of the browser window can go back.
111   virtual bool CanGoBack(gfx::NativeWindow window) const = 0;
112
113   // Sets the tab scrubber |enabled_| field to |enabled|.
114   virtual void SetTabScrubberChromeOSEnabled(bool enabled) = 0;
115
116   // Returns true if |window| allows default touch behaviors. If false, it means
117   // no default touch behavior is allowed (i.e., the touch action of window is
118   // cc::TouchAction::kNone). This function is used by BackGestureEventHandler
119   // to decide if we can perform the system default back gesture.
120   virtual bool AllowDefaultTouchActions(gfx::NativeWindow window);
121
122   // Returns true if we should wait for touch press ack when deciding if back
123   // gesture can be performed.
124   virtual bool ShouldWaitForTouchPressAck(gfx::NativeWindow window);
125
126   // Checks whether a drag-drop operation is a tab drag.
127   virtual bool IsTabDrag(const ui::OSExchangeData& drop_data);
128
129   // Return the height of WebUI tab strip used to determine if a tab has
130   // dragged out of it.
131   virtual int GetBrowserWebUITabStripHeight() = 0;
132
133   // Binds a fingerprint receiver in the Device Service if possible.
134   virtual void BindFingerprint(
135       mojo::PendingReceiver<device::mojom::Fingerprint> receiver) {}
136
137   // Binds a MultiDeviceSetup receiver for the primary profile.
138   virtual void BindMultiDeviceSetup(
139       mojo::PendingReceiver<multidevice_setup::mojom::MultiDeviceSetup>
140           receiver) = 0;
141
142   // Binds a MultiCaptureService receiver to start observing
143   // MultiCaptureStarted() and MultiCaptureStopped() events.
144   virtual void BindMultiCaptureService(
145       mojo::PendingReceiver<video_capture::mojom::MultiCaptureService>
146           receiver) = 0;
147
148   // Returns an interface to the Media Session service, or null if not
149   // available.
150   virtual media_session::MediaSessionService* GetMediaSessionService();
151
152   virtual void OpenKeyboardShortcutHelpPage() const {}
153
154   // Returns if window browser sessions are restoring.
155   virtual bool IsSessionRestoreInProgress() const = 0;
156
157   // Adjust system configuration for a Locked Fullscreen window.
158   virtual void SetUpEnvironmentForLockedFullscreen(
159       const WindowState& window_state) = 0;
160
161   // Ui Dev Tools control.
162   virtual bool IsUiDevToolsStarted() const;
163   virtual void StartUiDevTools() {}
164   virtual void StopUiDevTools() {}
165   virtual int GetUiDevToolsPort() const;
166
167   // Returns true if Chrome was started with --disable-logging-redirect option.
168   virtual bool IsLoggingRedirectDisabled() const = 0;
169
170   // Returns empty path if user session has not started yet, or path to the
171   // primary user Downloads folder if user has already logged in.
172   virtual base::FilePath GetPrimaryUserDownloadsFolder() const = 0;
173
174   // Opens the feedback page with pre-populated `source` and
175   // `description_template` fields. Note, this will only be used by features
176   // before they are fully launched or removed.
177   virtual void OpenFeedbackDialog(FeedbackSource source,
178                                   const std::string& description_template) = 0;
179
180   // Returns the last committed URL from the web contents if the given |window|
181   // contains a browser frame, otherwise returns GURL::EmptyURL().
182   virtual const GURL& GetLastCommittedURLForWindowIfAny(aura::Window* window);
183
184   // Retrieves the release track on which the device resides.
185   virtual version_info::Channel GetChannel() = 0;
186
187   // Tells browsers not to ask the user to confirm that they want to close a
188   // window when that window is closed.
189   virtual void ForceSkipWarningUserOnClose(
190       const std::vector<aura::Window*>& windows) = 0;
191
192   // Retrieves the official Chrome version string e.g. 105.0.5178.0.
193   virtual std::string GetVersionString() = 0;
194
195   // Forwards the ShouldExitFullscreenBeforeLock() call to the crosapi browser
196   // manager.
197   using ShouldExitFullscreenCallback = base::OnceCallback<void(bool)>;
198   virtual void ShouldExitFullscreenBeforeLock(
199       ShouldExitFullscreenCallback callback);
200 };
201
202 }  // namespace ash
203
204 #endif  // ASH_SHELL_DELEGATE_H_