| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/test/test_shell_delegate.h" | 5 #include "ash/test/test_shell_delegate.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "ash/app_list/app_list_shower_delegate.h" | |
| 10 #include "ash/app_list/app_list_shower_delegate_factory.h" | |
| 11 #include "ash/app_list/app_list_view_delegate_factory.h" | |
| 12 #include "ash/default_accessibility_delegate.h" | 9 #include "ash/default_accessibility_delegate.h" |
| 13 #include "ash/gpu_support_stub.h" | 10 #include "ash/gpu_support_stub.h" |
| 14 #include "ash/media_delegate.h" | 11 #include "ash/media_delegate.h" |
| 15 #include "ash/new_window_delegate.h" | 12 #include "ash/new_window_delegate.h" |
| 16 #include "ash/session/session_state_delegate.h" | 13 #include "ash/session/session_state_delegate.h" |
| 17 #include "ash/shell.h" | 14 #include "ash/shell.h" |
| 18 #include "ash/shell_window_ids.h" | 15 #include "ash/shell_window_ids.h" |
| 19 #include "ash/test/test_keyboard_ui.h" | 16 #include "ash/test/test_keyboard_ui.h" |
| 20 #include "ash/test/test_session_state_delegate.h" | 17 #include "ash/test/test_session_state_delegate.h" |
| 21 #include "ash/test/test_shelf_delegate.h" | 18 #include "ash/test/test_shelf_delegate.h" |
| 22 #include "ash/test/test_system_tray_delegate.h" | 19 #include "ash/test/test_system_tray_delegate.h" |
| 23 #include "ash/test/test_user_wallpaper_delegate.h" | 20 #include "ash/test/test_user_wallpaper_delegate.h" |
| 24 #include "ash/wm/window_state.h" | 21 #include "ash/wm/window_state.h" |
| 25 #include "ash/wm/window_util.h" | 22 #include "ash/wm/window_util.h" |
| 26 #include "base/logging.h" | 23 #include "base/logging.h" |
| 27 #include "base/memory/ptr_util.h" | 24 #include "ui/app_list/app_list_model.h" |
| 28 #include "ui/app_list/shower/app_list_shower_impl.h" | 25 #include "ui/app_list/app_list_view_delegate.h" |
| 29 #include "ui/app_list/test/app_list_test_view_delegate.h" | 26 #include "ui/app_list/test/app_list_test_view_delegate.h" |
| 30 #include "ui/aura/window.h" | 27 #include "ui/aura/window.h" |
| 31 #include "ui/gfx/image/image.h" | 28 #include "ui/gfx/image/image.h" |
| 32 | 29 |
| 33 #if defined(OS_CHROMEOS) | 30 #if defined(OS_CHROMEOS) |
| 34 #include "ash/system/tray/system_tray_notifier.h" | 31 #include "ash/system/tray/system_tray_notifier.h" |
| 35 #endif | 32 #endif |
| 36 | 33 |
| 37 namespace ash { | 34 namespace ash { |
| 38 namespace test { | 35 namespace test { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 void HandleMediaPrevTrack() override {} | 69 void HandleMediaPrevTrack() override {} |
| 73 MediaCaptureState GetMediaCaptureState(UserIndex index) override { | 70 MediaCaptureState GetMediaCaptureState(UserIndex index) override { |
| 74 return state_; | 71 return state_; |
| 75 } | 72 } |
| 76 | 73 |
| 77 MediaCaptureState state_; | 74 MediaCaptureState state_; |
| 78 | 75 |
| 79 DISALLOW_COPY_AND_ASSIGN(MediaDelegateImpl); | 76 DISALLOW_COPY_AND_ASSIGN(MediaDelegateImpl); |
| 80 }; | 77 }; |
| 81 | 78 |
| 82 class AppListViewDelegateFactoryImpl : public ash::AppListViewDelegateFactory { | |
| 83 public: | |
| 84 AppListViewDelegateFactoryImpl() {} | |
| 85 ~AppListViewDelegateFactoryImpl() override {} | |
| 86 | |
| 87 // app_list::AppListViewDelegateFactory: | |
| 88 app_list::AppListViewDelegate* GetDelegate() override { | |
| 89 if (!app_list_view_delegate_.get()) { | |
| 90 app_list_view_delegate_.reset( | |
| 91 new app_list::test::AppListTestViewDelegate); | |
| 92 } | |
| 93 return app_list_view_delegate_.get(); | |
| 94 } | |
| 95 | |
| 96 private: | |
| 97 std::unique_ptr<app_list::AppListViewDelegate> app_list_view_delegate_; | |
| 98 | |
| 99 DISALLOW_COPY_AND_ASSIGN(AppListViewDelegateFactoryImpl); | |
| 100 }; | |
| 101 | |
| 102 } // namespace | 79 } // namespace |
| 103 | 80 |
| 104 TestShellDelegate::TestShellDelegate() | 81 TestShellDelegate::TestShellDelegate() |
| 105 : num_exit_requests_(0), | 82 : num_exit_requests_(0), |
| 106 multi_profiles_enabled_(false), | 83 multi_profiles_enabled_(false), |
| 107 force_maximize_on_first_run_(false), | 84 force_maximize_on_first_run_(false) {} |
| 108 app_list_shower_delegate_factory_(new AppListShowerDelegateFactory( | |
| 109 base::WrapUnique(new AppListViewDelegateFactoryImpl))) {} | |
| 110 | 85 |
| 111 TestShellDelegate::~TestShellDelegate() { | 86 TestShellDelegate::~TestShellDelegate() { |
| 112 } | 87 } |
| 113 | 88 |
| 114 bool TestShellDelegate::IsFirstRunAfterBoot() const { | 89 bool TestShellDelegate::IsFirstRunAfterBoot() const { |
| 115 return false; | 90 return false; |
| 116 } | 91 } |
| 117 | 92 |
| 118 bool TestShellDelegate::IsIncognitoAllowed() const { | 93 bool TestShellDelegate::IsIncognitoAllowed() const { |
| 119 return true; | 94 return true; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 keyboard_state_observer_list_.AddObserver(observer); | 135 keyboard_state_observer_list_.AddObserver(observer); |
| 161 } | 136 } |
| 162 | 137 |
| 163 void TestShellDelegate::RemoveVirtualKeyboardStateObserver( | 138 void TestShellDelegate::RemoveVirtualKeyboardStateObserver( |
| 164 VirtualKeyboardStateObserver* observer) { | 139 VirtualKeyboardStateObserver* observer) { |
| 165 keyboard_state_observer_list_.RemoveObserver(observer); | 140 keyboard_state_observer_list_.RemoveObserver(observer); |
| 166 } | 141 } |
| 167 | 142 |
| 168 void TestShellDelegate::OpenUrl(const GURL& url) {} | 143 void TestShellDelegate::OpenUrl(const GURL& url) {} |
| 169 | 144 |
| 170 app_list::AppListShower* TestShellDelegate::GetAppListShower() { | 145 app_list::AppListViewDelegate* TestShellDelegate::GetAppListViewDelegate() { |
| 171 if (!app_list_shower_) { | 146 if (!app_list_view_delegate_) |
| 172 app_list_shower_.reset(new app_list::AppListShowerImpl( | 147 app_list_view_delegate_.reset(new app_list::test::AppListTestViewDelegate); |
| 173 app_list_shower_delegate_factory_.get())); | 148 return app_list_view_delegate_.get(); |
| 174 } | |
| 175 return app_list_shower_.get(); | |
| 176 } | 149 } |
| 177 | 150 |
| 178 ShelfDelegate* TestShellDelegate::CreateShelfDelegate(ShelfModel* model) { | 151 ShelfDelegate* TestShellDelegate::CreateShelfDelegate(ShelfModel* model) { |
| 179 return new TestShelfDelegate(model); | 152 return new TestShelfDelegate(model); |
| 180 } | 153 } |
| 181 | 154 |
| 182 SystemTrayDelegate* TestShellDelegate::CreateSystemTrayDelegate() { | 155 SystemTrayDelegate* TestShellDelegate::CreateSystemTrayDelegate() { |
| 183 return new TestSystemTrayDelegate; | 156 return new TestSystemTrayDelegate; |
| 184 } | 157 } |
| 185 | 158 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 #if defined(OS_CHROMEOS) | 199 #if defined(OS_CHROMEOS) |
| 227 Shell* shell = Shell::GetInstance(); | 200 Shell* shell = Shell::GetInstance(); |
| 228 static_cast<MediaDelegateImpl*>(shell->media_delegate()) | 201 static_cast<MediaDelegateImpl*>(shell->media_delegate()) |
| 229 ->set_media_capture_state(state); | 202 ->set_media_capture_state(state); |
| 230 shell->system_tray_notifier()->NotifyMediaCaptureChanged(); | 203 shell->system_tray_notifier()->NotifyMediaCaptureChanged(); |
| 231 #endif | 204 #endif |
| 232 } | 205 } |
| 233 | 206 |
| 234 } // namespace test | 207 } // namespace test |
| 235 } // namespace ash | 208 } // namespace ash |
| OLD | NEW |