test_shell_delegate.h 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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_TEST_SHELL_DELEGATE_H_
  5. #define ASH_TEST_SHELL_DELEGATE_H_
  6. #include <memory>
  7. #include "ash/services/multidevice_setup/public/mojom/multidevice_setup.mojom.h"
  8. #include "ash/shell_delegate.h"
  9. #include "base/callback.h"
  10. #include "mojo/public/cpp/bindings/pending_receiver.h"
  11. #include "url/gurl.h"
  12. namespace ash {
  13. class TestShellDelegate : public ShellDelegate {
  14. public:
  15. TestShellDelegate();
  16. TestShellDelegate(const TestShellDelegate&) = delete;
  17. TestShellDelegate& operator=(const TestShellDelegate&) = delete;
  18. ~TestShellDelegate() override;
  19. // Allows tests to override the MultiDeviceSetup binding behavior for this
  20. // TestShellDelegate.
  21. using MultiDeviceSetupBinder = base::RepeatingCallback<void(
  22. mojo::PendingReceiver<multidevice_setup::mojom::MultiDeviceSetup>)>;
  23. void SetMultiDeviceSetupBinder(MultiDeviceSetupBinder binder) {
  24. multidevice_setup_binder_ = std::move(binder);
  25. }
  26. // Overridden from ShellDelegate:
  27. bool CanShowWindowForUser(const aura::Window* window) const override;
  28. std::unique_ptr<CaptureModeDelegate> CreateCaptureModeDelegate()
  29. const override;
  30. AccessibilityDelegate* CreateAccessibilityDelegate() override;
  31. std::unique_ptr<BackGestureContextualNudgeDelegate>
  32. CreateBackGestureContextualNudgeDelegate(
  33. BackGestureContextualNudgeController* controller) override;
  34. std::unique_ptr<NearbyShareDelegate> CreateNearbyShareDelegate(
  35. NearbyShareController* controller) const override;
  36. std::unique_ptr<DesksTemplatesDelegate> CreateDesksTemplatesDelegate()
  37. const override;
  38. scoped_refptr<network::SharedURLLoaderFactory>
  39. GetGeolocationUrlLoaderFactory() const override;
  40. bool CanGoBack(gfx::NativeWindow window) const override;
  41. void SetTabScrubberChromeOSEnabled(bool enabled) override;
  42. bool ShouldWaitForTouchPressAck(gfx::NativeWindow window) override;
  43. int GetBrowserWebUITabStripHeight() override;
  44. void BindMultiDeviceSetup(
  45. mojo::PendingReceiver<multidevice_setup::mojom::MultiDeviceSetup>
  46. receiver) override;
  47. bool IsSessionRestoreInProgress() const override;
  48. void SetUpEnvironmentForLockedFullscreen(bool locked) override {}
  49. const GURL& GetLastCommittedURLForWindowIfAny(aura::Window* window) override;
  50. void SetCanGoBack(bool can_go_back);
  51. void SetShouldWaitForTouchAck(bool should_wait_for_touch_ack);
  52. void SetSessionRestoreInProgress(bool in_progress);
  53. bool IsLoggingRedirectDisabled() const override;
  54. base::FilePath GetPrimaryUserDownloadsFolder() const override;
  55. void OpenFeedbackPageForPersistentDesksBar() override {}
  56. void SetLastCommittedURLForWindow(const GURL& url);
  57. private:
  58. // True if the current top window can go back.
  59. bool can_go_back_ = true;
  60. // True if the tab scrubber is enabled.
  61. bool tab_scrubber_enabled_ = true;
  62. // True if when performing back gesture on the top window, we should handle
  63. // the event after the touch ack is received. Please refer to
  64. // |BackGestureEventHandler::should_wait_for_touch_ack_| for detailed
  65. // description.
  66. bool should_wait_for_touch_ack_ = false;
  67. // True if window browser sessions are restoring.
  68. bool session_restore_in_progress_ = false;
  69. MultiDeviceSetupBinder multidevice_setup_binder_;
  70. GURL last_committed_url_ = GURL::EmptyGURL();
  71. };
  72. } // namespace ash
  73. #endif // ASH_TEST_SHELL_DELEGATE_H_