Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(759)

Side by Side Diff: ash/test/test_shell_delegate.cc

Issue 1861013004: AppListController refactoring part 3: Switching over to use AppListShower in Ash. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mus_chrome_delegates_ash_impl
Patch Set: Rebase. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/test/test_shell_delegate.h ('k') | ash/wm/app_list_controller.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
9 #include "ash/default_accessibility_delegate.h" 12 #include "ash/default_accessibility_delegate.h"
10 #include "ash/gpu_support_stub.h" 13 #include "ash/gpu_support_stub.h"
11 #include "ash/media_delegate.h" 14 #include "ash/media_delegate.h"
12 #include "ash/new_window_delegate.h" 15 #include "ash/new_window_delegate.h"
13 #include "ash/session/session_state_delegate.h" 16 #include "ash/session/session_state_delegate.h"
14 #include "ash/shell.h" 17 #include "ash/shell.h"
15 #include "ash/shell_window_ids.h" 18 #include "ash/shell_window_ids.h"
16 #include "ash/test/test_keyboard_ui.h" 19 #include "ash/test/test_keyboard_ui.h"
17 #include "ash/test/test_session_state_delegate.h" 20 #include "ash/test/test_session_state_delegate.h"
18 #include "ash/test/test_shelf_delegate.h" 21 #include "ash/test/test_shelf_delegate.h"
19 #include "ash/test/test_system_tray_delegate.h" 22 #include "ash/test/test_system_tray_delegate.h"
20 #include "ash/test/test_user_wallpaper_delegate.h" 23 #include "ash/test/test_user_wallpaper_delegate.h"
21 #include "ash/wm/window_state.h" 24 #include "ash/wm/window_state.h"
22 #include "ash/wm/window_util.h" 25 #include "ash/wm/window_util.h"
23 #include "base/logging.h" 26 #include "base/logging.h"
24 #include "ui/app_list/app_list_model.h" 27 #include "base/memory/ptr_util.h"
25 #include "ui/app_list/app_list_view_delegate.h" 28 #include "ui/app_list/shower/app_list_shower_impl.h"
26 #include "ui/app_list/test/app_list_test_view_delegate.h" 29 #include "ui/app_list/test/app_list_test_view_delegate.h"
27 #include "ui/aura/window.h" 30 #include "ui/aura/window.h"
28 #include "ui/gfx/image/image.h" 31 #include "ui/gfx/image/image.h"
29 32
30 #if defined(OS_CHROMEOS) 33 #if defined(OS_CHROMEOS)
31 #include "ash/system/tray/system_tray_notifier.h" 34 #include "ash/system/tray/system_tray_notifier.h"
32 #endif 35 #endif
33 36
34 namespace ash { 37 namespace ash {
35 namespace test { 38 namespace test {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 void HandleMediaPrevTrack() override {} 72 void HandleMediaPrevTrack() override {}
70 MediaCaptureState GetMediaCaptureState(UserIndex index) override { 73 MediaCaptureState GetMediaCaptureState(UserIndex index) override {
71 return state_; 74 return state_;
72 } 75 }
73 76
74 MediaCaptureState state_; 77 MediaCaptureState state_;
75 78
76 DISALLOW_COPY_AND_ASSIGN(MediaDelegateImpl); 79 DISALLOW_COPY_AND_ASSIGN(MediaDelegateImpl);
77 }; 80 };
78 81
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
79 } // namespace 102 } // namespace
80 103
81 TestShellDelegate::TestShellDelegate() 104 TestShellDelegate::TestShellDelegate()
82 : num_exit_requests_(0), 105 : num_exit_requests_(0),
83 multi_profiles_enabled_(false), 106 multi_profiles_enabled_(false),
84 force_maximize_on_first_run_(false) {} 107 force_maximize_on_first_run_(false),
108 app_list_shower_delegate_factory_(new AppListShowerDelegateFactory(
109 base::WrapUnique(new AppListViewDelegateFactoryImpl))) {}
85 110
86 TestShellDelegate::~TestShellDelegate() { 111 TestShellDelegate::~TestShellDelegate() {
87 } 112 }
88 113
89 bool TestShellDelegate::IsFirstRunAfterBoot() const { 114 bool TestShellDelegate::IsFirstRunAfterBoot() const {
90 return false; 115 return false;
91 } 116 }
92 117
93 bool TestShellDelegate::IsIncognitoAllowed() const { 118 bool TestShellDelegate::IsIncognitoAllowed() const {
94 return true; 119 return true;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 keyboard_state_observer_list_.AddObserver(observer); 160 keyboard_state_observer_list_.AddObserver(observer);
136 } 161 }
137 162
138 void TestShellDelegate::RemoveVirtualKeyboardStateObserver( 163 void TestShellDelegate::RemoveVirtualKeyboardStateObserver(
139 VirtualKeyboardStateObserver* observer) { 164 VirtualKeyboardStateObserver* observer) {
140 keyboard_state_observer_list_.RemoveObserver(observer); 165 keyboard_state_observer_list_.RemoveObserver(observer);
141 } 166 }
142 167
143 void TestShellDelegate::OpenUrl(const GURL& url) {} 168 void TestShellDelegate::OpenUrl(const GURL& url) {}
144 169
145 app_list::AppListViewDelegate* TestShellDelegate::GetAppListViewDelegate() { 170 app_list::AppListShower* TestShellDelegate::GetAppListShower() {
146 if (!app_list_view_delegate_) 171 if (!app_list_shower_) {
147 app_list_view_delegate_.reset(new app_list::test::AppListTestViewDelegate); 172 app_list_shower_.reset(new app_list::AppListShowerImpl(
148 return app_list_view_delegate_.get(); 173 app_list_shower_delegate_factory_.get()));
174 }
175 return app_list_shower_.get();
149 } 176 }
150 177
151 ShelfDelegate* TestShellDelegate::CreateShelfDelegate(ShelfModel* model) { 178 ShelfDelegate* TestShellDelegate::CreateShelfDelegate(ShelfModel* model) {
152 return new TestShelfDelegate(model); 179 return new TestShelfDelegate(model);
153 } 180 }
154 181
155 SystemTrayDelegate* TestShellDelegate::CreateSystemTrayDelegate() { 182 SystemTrayDelegate* TestShellDelegate::CreateSystemTrayDelegate() {
156 return new TestSystemTrayDelegate; 183 return new TestSystemTrayDelegate;
157 } 184 }
158 185
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 #if defined(OS_CHROMEOS) 226 #if defined(OS_CHROMEOS)
200 Shell* shell = Shell::GetInstance(); 227 Shell* shell = Shell::GetInstance();
201 static_cast<MediaDelegateImpl*>(shell->media_delegate()) 228 static_cast<MediaDelegateImpl*>(shell->media_delegate())
202 ->set_media_capture_state(state); 229 ->set_media_capture_state(state);
203 shell->system_tray_notifier()->NotifyMediaCaptureChanged(); 230 shell->system_tray_notifier()->NotifyMediaCaptureChanged();
204 #endif 231 #endif
205 } 232 }
206 233
207 } // namespace test 234 } // namespace test
208 } // namespace ash 235 } // namespace ash
OLDNEW
« no previous file with comments | « ash/test/test_shell_delegate.h ('k') | ash/wm/app_list_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698