1 // Copyright 2012 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "ash/test_shell_delegate.h"
10 #include "ash/accessibility/default_accessibility_delegate.h"
11 #include "ash/capture_mode/test_capture_mode_delegate.h"
12 #include "ash/glanceables/test_glanceables_delegate.h"
13 #include "ash/public/cpp/test/test_desks_templates_delegate.h"
14 #include "ash/public/cpp/test/test_nearby_share_delegate.h"
15 #include "ash/system/geolocation/test_geolocation_url_loader_factory.h"
16 #include "ash/wm/gestures/back_gesture/test_back_gesture_contextual_nudge_delegate.h"
21 TestShellDelegate::TestShellDelegate() = default;
23 TestShellDelegate::~TestShellDelegate() = default;
25 bool TestShellDelegate::CanShowWindowForUser(const aura::Window* window) const {
29 std::unique_ptr<CaptureModeDelegate>
30 TestShellDelegate::CreateCaptureModeDelegate() const {
31 return std::make_unique<TestCaptureModeDelegate>();
34 std::unique_ptr<GlanceablesDelegate>
35 TestShellDelegate::CreateGlanceablesDelegate(
36 GlanceablesController* controller) const {
37 return std::make_unique<TestGlanceablesDelegate>();
40 AccessibilityDelegate* TestShellDelegate::CreateAccessibilityDelegate() {
41 return new DefaultAccessibilityDelegate;
44 std::unique_ptr<BackGestureContextualNudgeDelegate>
45 TestShellDelegate::CreateBackGestureContextualNudgeDelegate(
46 BackGestureContextualNudgeController* controller) {
47 return std::make_unique<TestBackGestureContextualNudgeDelegate>(controller);
50 std::unique_ptr<NearbyShareDelegate>
51 TestShellDelegate::CreateNearbyShareDelegate(
52 NearbyShareController* controller) const {
53 return std::make_unique<TestNearbyShareDelegate>();
56 std::unique_ptr<DesksTemplatesDelegate>
57 TestShellDelegate::CreateDesksTemplatesDelegate() const {
58 return std::make_unique<TestDesksTemplatesDelegate>();
61 scoped_refptr<network::SharedURLLoaderFactory>
62 TestShellDelegate::GetGeolocationUrlLoaderFactory() const {
63 return static_cast<scoped_refptr<network::SharedURLLoaderFactory>>(
64 base::MakeRefCounted<TestGeolocationUrlLoaderFactory>());
67 bool TestShellDelegate::CanGoBack(gfx::NativeWindow window) const {
71 void TestShellDelegate::SetTabScrubberChromeOSEnabled(bool enabled) {
72 tab_scrubber_enabled_ = enabled;
75 void TestShellDelegate::ShouldExitFullscreenBeforeLock(
76 ShouldExitFullscreenCallback callback) {
77 std::move(callback).Run(should_exit_fullscreen_before_lock_);
80 bool TestShellDelegate::ShouldWaitForTouchPressAck(gfx::NativeWindow window) {
81 return should_wait_for_touch_ack_;
84 int TestShellDelegate::GetBrowserWebUITabStripHeight() {
88 void TestShellDelegate::BindMultiDeviceSetup(
89 mojo::PendingReceiver<multidevice_setup::mojom::MultiDeviceSetup>
91 if (multidevice_setup_binder_)
92 multidevice_setup_binder_.Run(std::move(receiver));
95 void TestShellDelegate::BindMultiCaptureService(
96 mojo::PendingReceiver<video_capture::mojom::MultiCaptureService> receiver) {
99 void TestShellDelegate::SetCanGoBack(bool can_go_back) {
100 can_go_back_ = can_go_back;
103 void TestShellDelegate::SetShouldExitFullscreenBeforeLock(
104 bool should_exit_fullscreen_before_lock) {
105 should_exit_fullscreen_before_lock_ = should_exit_fullscreen_before_lock;
108 void TestShellDelegate::SetShouldWaitForTouchAck(
109 bool should_wait_for_touch_ack) {
110 should_wait_for_touch_ack_ = should_wait_for_touch_ack;
113 bool TestShellDelegate::IsSessionRestoreInProgress() const {
114 return session_restore_in_progress_;
117 void TestShellDelegate::SetSessionRestoreInProgress(bool in_progress) {
118 session_restore_in_progress_ = in_progress;
121 bool TestShellDelegate::IsLoggingRedirectDisabled() const {
125 base::FilePath TestShellDelegate::GetPrimaryUserDownloadsFolder() const {
126 return base::FilePath();
129 const GURL& TestShellDelegate::GetLastCommittedURLForWindowIfAny(
130 aura::Window* window) {
131 return last_committed_url_;
134 void TestShellDelegate::SetLastCommittedURLForWindow(const GURL& url) {
135 last_committed_url_ = url;
138 version_info::Channel TestShellDelegate::GetChannel() {
142 std::string TestShellDelegate::GetVersionString() {
143 return version_string_;