shell_delegate.h 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172
  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. #ifndef ASH_SHELL_DELEGATE_H_
  5. #define ASH_SHELL_DELEGATE_H_
  6. #include <memory>
  7. #include <vector>
  8. #include "ash/ash_export.h"
  9. #include "ash/services/multidevice_setup/public/mojom/multidevice_setup.mojom-forward.h"
  10. #include "base/files/file_path.h"
  11. #include "chromeos/ui/base/window_pin_type.h"
  12. #include "components/version_info/channel.h"
  13. #include "mojo/public/cpp/bindings/pending_receiver.h"
  14. #include "services/device/public/mojom/bluetooth_system.mojom-forward.h"
  15. #include "services/device/public/mojom/fingerprint.mojom-forward.h"
  16. #include "services/media_session/public/cpp/media_session_service.h"
  17. #include "services/network/public/cpp/shared_url_loader_factory.h"
  18. #include "services/video_capture/public/mojom/multi_capture_service.mojom-forward.h"
  19. #include "ui/gfx/native_widget_types.h"
  20. #include "url/gurl.h"
  21. namespace aura {
  22. class Window;
  23. }
  24. namespace ui {
  25. class OSExchangeData;
  26. }
  27. namespace ash {
  28. class AccessibilityDelegate;
  29. class BackGestureContextualNudgeController;
  30. class BackGestureContextualNudgeDelegate;
  31. class CaptureModeDelegate;
  32. class DesksTemplatesDelegate;
  33. class NearbyShareController;
  34. class NearbyShareDelegate;
  35. // Delegate of the Shell.
  36. class ASH_EXPORT ShellDelegate {
  37. public:
  38. // The Shell owns the delegate.
  39. virtual ~ShellDelegate() = default;
  40. // Returns true if |window| can be shown for the delegate's concept of current
  41. // user.
  42. virtual bool CanShowWindowForUser(const aura::Window* window) const = 0;
  43. // Creates and returns the delegate of the Capture Mode feature.
  44. virtual std::unique_ptr<CaptureModeDelegate> CreateCaptureModeDelegate()
  45. const = 0;
  46. // Creates a accessibility delegate. Shell takes ownership of the delegate.
  47. virtual AccessibilityDelegate* CreateAccessibilityDelegate() = 0;
  48. // Creates a back gesture contextual nudge delegate for |controller|.
  49. virtual std::unique_ptr<BackGestureContextualNudgeDelegate>
  50. CreateBackGestureContextualNudgeDelegate(
  51. BackGestureContextualNudgeController* controller) = 0;
  52. virtual std::unique_ptr<NearbyShareDelegate> CreateNearbyShareDelegate(
  53. NearbyShareController* controller) const = 0;
  54. virtual std::unique_ptr<DesksTemplatesDelegate> CreateDesksTemplatesDelegate()
  55. const = 0;
  56. // Returns the geolocation loader factory used to initialize geolocation
  57. // provider.
  58. virtual scoped_refptr<network::SharedURLLoaderFactory>
  59. GetGeolocationUrlLoaderFactory() const = 0;
  60. // Check whether the current tab of the browser window can go back.
  61. virtual bool CanGoBack(gfx::NativeWindow window) const = 0;
  62. // Sets the tab scrubber |enabled_| field to |enabled|.
  63. virtual void SetTabScrubberChromeOSEnabled(bool enabled) = 0;
  64. // Returns true if |window| allows default touch behaviors. If false, it means
  65. // no default touch behavior is allowed (i.e., the touch action of window is
  66. // cc::TouchAction::kNone). This function is used by BackGestureEventHandler
  67. // to decide if we can perform the system default back gesture.
  68. virtual bool AllowDefaultTouchActions(gfx::NativeWindow window);
  69. // Returns true if we should wait for touch press ack when deciding if back
  70. // gesture can be performed.
  71. virtual bool ShouldWaitForTouchPressAck(gfx::NativeWindow window);
  72. // Checks whether a drag-drop operation is a tab drag.
  73. virtual bool IsTabDrag(const ui::OSExchangeData& drop_data);
  74. // Return the height of WebUI tab strip used to determine if a tab has
  75. // dragged out of it.
  76. virtual int GetBrowserWebUITabStripHeight() = 0;
  77. // Binds a BluetoothSystemFactory receiver if possible.
  78. virtual void BindBluetoothSystemFactory(
  79. mojo::PendingReceiver<device::mojom::BluetoothSystemFactory> receiver) {}
  80. // Binds a fingerprint receiver in the Device Service if possible.
  81. virtual void BindFingerprint(
  82. mojo::PendingReceiver<device::mojom::Fingerprint> receiver) {}
  83. // Binds a MultiDeviceSetup receiver for the primary profile.
  84. virtual void BindMultiDeviceSetup(
  85. mojo::PendingReceiver<multidevice_setup::mojom::MultiDeviceSetup>
  86. receiver) = 0;
  87. // Binds a MultiCaptureService receiver to start observing
  88. // MultiCaptureStarted() and MultiCaptureStopped() events.
  89. virtual void BindMultiCaptureService(
  90. mojo::PendingReceiver<video_capture::mojom::MultiCaptureService>
  91. receiver) = 0;
  92. // Returns an interface to the Media Session service, or null if not
  93. // available.
  94. virtual media_session::MediaSessionService* GetMediaSessionService();
  95. virtual void OpenKeyboardShortcutHelpPage() const {}
  96. // Returns if window browser sessions are restoring.
  97. virtual bool IsSessionRestoreInProgress() const = 0;
  98. // Adjust system configuration for a Locked Fullscreen window.
  99. virtual void SetUpEnvironmentForLockedFullscreen(bool locked) = 0;
  100. // Ui Dev Tools control.
  101. virtual bool IsUiDevToolsStarted() const;
  102. virtual void StartUiDevTools() {}
  103. virtual void StopUiDevTools() {}
  104. virtual int GetUiDevToolsPort() const;
  105. // Returns true if Chrome was started with --disable-logging-redirect option.
  106. virtual bool IsLoggingRedirectDisabled() const = 0;
  107. // Returns empty path if user session has not started yet, or path to the
  108. // primary user Downloads folder if user has already logged in.
  109. virtual base::FilePath GetPrimaryUserDownloadsFolder() const = 0;
  110. // Opens the feedback page with pre-populated description #BentoBar for
  111. // persistent desks bar. Note, this will be removed once the feature is fully
  112. // launched or removed.
  113. virtual void OpenFeedbackPageForPersistentDesksBar() = 0;
  114. // Returns the last committed URL from the web contents if the given |window|
  115. // contains a browser frame, otherwise returns GURL::EmptyURL().
  116. virtual const GURL& GetLastCommittedURLForWindowIfAny(aura::Window* window);
  117. // Retrieves the release track on which the device resides.
  118. virtual version_info::Channel GetChannel() = 0;
  119. // Tells browsers not to ask the user to confirm that they want to close a
  120. // window when that window is closed.
  121. virtual void ForceSkipWarningUserOnClose(
  122. const std::vector<aura::Window*>& windows) = 0;
  123. // Retrieves the official Chrome version string e.g. 105.0.5178.0.
  124. virtual std::string GetVersionString() = 0;
  125. // Forwards the ShouldExitFullscreenBeforeLock() call to the crosapi browser
  126. // manager.
  127. using ShouldExitFullscreenCallback = base::OnceCallback<void(bool)>;
  128. virtual void ShouldExitFullscreenBeforeLock(
  129. ShouldExitFullscreenCallback callback);
  130. };
  131. } // namespace ash
  132. #endif // ASH_SHELL_DELEGATE_H_