shell_delegate.h 5.5 KB

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