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 5 #include "ash/test_shell_delegate.h" 6 7 #include <memory> 8 9 #include "ash/accessibility/default_accessibility_delegate.h" 10 #include "ash/capture_mode/test_capture_mode_delegate.h" 11 #include "ash/public/cpp/test/test_nearby_share_delegate.h" 12 #include "ash/system/tray/system_tray_notifier.h" 13 #include "ash/test_screenshot_delegate.h" 14 #include "ash/wm/gestures/back_gesture/test_back_gesture_contextual_nudge_delegate.h" 15 #include "ui/gfx/image/image.h" 16 17 namespace ash { 18 19 TestShellDelegate::TestShellDelegate() = default; 20 21 TestShellDelegate::~TestShellDelegate() = default; 22 CanShowWindowForUser(const aura::Window * window) const23bool TestShellDelegate::CanShowWindowForUser(const aura::Window* window) const { 24 return true; 25 } 26 27 std::unique_ptr<CaptureModeDelegate> CreateCaptureModeDelegate() const28TestShellDelegate::CreateCaptureModeDelegate() const { 29 return std::make_unique<TestCaptureModeDelegate>(); 30 } 31 32 std::unique_ptr<ScreenshotDelegate> CreateScreenshotDelegate()33TestShellDelegate::CreateScreenshotDelegate() { 34 return std::make_unique<TestScreenshotDelegate>(); 35 } 36 CreateAccessibilityDelegate()37AccessibilityDelegate* TestShellDelegate::CreateAccessibilityDelegate() { 38 return new DefaultAccessibilityDelegate; 39 } 40 41 std::unique_ptr<BackGestureContextualNudgeDelegate> CreateBackGestureContextualNudgeDelegate(BackGestureContextualNudgeController * controller)42TestShellDelegate::CreateBackGestureContextualNudgeDelegate( 43 BackGestureContextualNudgeController* controller) { 44 return std::make_unique<TestBackGestureContextualNudgeDelegate>(controller); 45 } 46 CanGoBack(gfx::NativeWindow window) const47bool TestShellDelegate::CanGoBack(gfx::NativeWindow window) const { 48 return can_go_back_; 49 } 50 SetTabScrubberEnabled(bool enabled)51void TestShellDelegate::SetTabScrubberEnabled(bool enabled) { 52 tab_scrubber_enabled_ = enabled; 53 } 54 ShouldWaitForTouchPressAck(gfx::NativeWindow window)55bool TestShellDelegate::ShouldWaitForTouchPressAck(gfx::NativeWindow window) { 56 return should_wait_for_touch_ack_; 57 } 58 BindMultiDeviceSetup(mojo::PendingReceiver<chromeos::multidevice_setup::mojom::MultiDeviceSetup> receiver)59void TestShellDelegate::BindMultiDeviceSetup( 60 mojo::PendingReceiver<chromeos::multidevice_setup::mojom::MultiDeviceSetup> 61 receiver) { 62 if (multidevice_setup_binder_) 63 multidevice_setup_binder_.Run(std::move(receiver)); 64 } 65 SetCanGoBack(bool can_go_back)66void TestShellDelegate::SetCanGoBack(bool can_go_back) { 67 can_go_back_ = can_go_back; 68 } 69 SetShouldWaitForTouchAck(bool should_wait_for_touch_ack)70void TestShellDelegate::SetShouldWaitForTouchAck( 71 bool should_wait_for_touch_ack) { 72 should_wait_for_touch_ack_ = should_wait_for_touch_ack; 73 } 74 75 std::unique_ptr<NearbyShareDelegate> CreateNearbyShareDelegate(NearbyShareController * controller) const76TestShellDelegate::CreateNearbyShareDelegate( 77 NearbyShareController* controller) const { 78 return std::make_unique<TestNearbyShareDelegate>(); 79 } 80 81 } // namespace ash 82