test_shell_delegate.cc 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  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. #include "ash/test_shell_delegate.h"
  5. #include <memory>
  6. #include <string>
  7. #include "ash/accessibility/default_accessibility_delegate.h"
  8. #include "ash/capture_mode/test_capture_mode_delegate.h"
  9. #include "ash/public/cpp/test/test_desks_templates_delegate.h"
  10. #include "ash/public/cpp/test/test_nearby_share_delegate.h"
  11. #include "ash/system/geolocation/test_geolocation_url_loader_factory.h"
  12. #include "ash/system/tray/system_tray_notifier.h"
  13. #include "ash/wm/gestures/back_gesture/test_back_gesture_contextual_nudge_delegate.h"
  14. #include "ui/gfx/image/image.h"
  15. #include "url/gurl.h"
  16. namespace ash {
  17. TestShellDelegate::TestShellDelegate() = default;
  18. TestShellDelegate::~TestShellDelegate() = default;
  19. bool TestShellDelegate::CanShowWindowForUser(const aura::Window* window) const {
  20. return true;
  21. }
  22. std::unique_ptr<CaptureModeDelegate>
  23. TestShellDelegate::CreateCaptureModeDelegate() const {
  24. return std::make_unique<TestCaptureModeDelegate>();
  25. }
  26. AccessibilityDelegate* TestShellDelegate::CreateAccessibilityDelegate() {
  27. return new DefaultAccessibilityDelegate;
  28. }
  29. std::unique_ptr<BackGestureContextualNudgeDelegate>
  30. TestShellDelegate::CreateBackGestureContextualNudgeDelegate(
  31. BackGestureContextualNudgeController* controller) {
  32. return std::make_unique<TestBackGestureContextualNudgeDelegate>(controller);
  33. }
  34. std::unique_ptr<NearbyShareDelegate>
  35. TestShellDelegate::CreateNearbyShareDelegate(
  36. NearbyShareController* controller) const {
  37. return std::make_unique<TestNearbyShareDelegate>();
  38. }
  39. std::unique_ptr<DesksTemplatesDelegate>
  40. TestShellDelegate::CreateDesksTemplatesDelegate() const {
  41. return std::make_unique<TestDesksTemplatesDelegate>();
  42. }
  43. scoped_refptr<network::SharedURLLoaderFactory>
  44. TestShellDelegate::GetGeolocationUrlLoaderFactory() const {
  45. return static_cast<scoped_refptr<network::SharedURLLoaderFactory>>(
  46. base::MakeRefCounted<TestGeolocationUrlLoaderFactory>());
  47. }
  48. bool TestShellDelegate::CanGoBack(gfx::NativeWindow window) const {
  49. return can_go_back_;
  50. }
  51. void TestShellDelegate::SetTabScrubberChromeOSEnabled(bool enabled) {
  52. tab_scrubber_enabled_ = enabled;
  53. }
  54. void TestShellDelegate::ShouldExitFullscreenBeforeLock(
  55. ShouldExitFullscreenCallback callback) {
  56. std::move(callback).Run(should_exit_fullscreen_before_lock_);
  57. }
  58. bool TestShellDelegate::ShouldWaitForTouchPressAck(gfx::NativeWindow window) {
  59. return should_wait_for_touch_ack_;
  60. }
  61. int TestShellDelegate::GetBrowserWebUITabStripHeight() {
  62. return 0;
  63. }
  64. void TestShellDelegate::BindMultiDeviceSetup(
  65. mojo::PendingReceiver<multidevice_setup::mojom::MultiDeviceSetup>
  66. receiver) {
  67. if (multidevice_setup_binder_)
  68. multidevice_setup_binder_.Run(std::move(receiver));
  69. }
  70. void TestShellDelegate::BindMultiCaptureService(
  71. mojo::PendingReceiver<video_capture::mojom::MultiCaptureService> receiver) {
  72. }
  73. void TestShellDelegate::SetCanGoBack(bool can_go_back) {
  74. can_go_back_ = can_go_back;
  75. }
  76. void TestShellDelegate::SetShouldExitFullscreenBeforeLock(
  77. bool should_exit_fullscreen_before_lock) {
  78. should_exit_fullscreen_before_lock_ = should_exit_fullscreen_before_lock;
  79. }
  80. void TestShellDelegate::SetShouldWaitForTouchAck(
  81. bool should_wait_for_touch_ack) {
  82. should_wait_for_touch_ack_ = should_wait_for_touch_ack;
  83. }
  84. bool TestShellDelegate::IsSessionRestoreInProgress() const {
  85. return session_restore_in_progress_;
  86. }
  87. void TestShellDelegate::SetSessionRestoreInProgress(bool in_progress) {
  88. session_restore_in_progress_ = in_progress;
  89. }
  90. bool TestShellDelegate::IsLoggingRedirectDisabled() const {
  91. return false;
  92. }
  93. base::FilePath TestShellDelegate::GetPrimaryUserDownloadsFolder() const {
  94. return base::FilePath();
  95. }
  96. const GURL& TestShellDelegate::GetLastCommittedURLForWindowIfAny(
  97. aura::Window* window) {
  98. return last_committed_url_;
  99. }
  100. void TestShellDelegate::SetLastCommittedURLForWindow(const GURL& url) {
  101. last_committed_url_ = url;
  102. }
  103. version_info::Channel TestShellDelegate::GetChannel() {
  104. return channel_;
  105. }
  106. std::string TestShellDelegate::GetVersionString() {
  107. return version_string_;
  108. }
  109. } // namespace ash