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

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

Issue 1770993002: wip: Refactoring Ash's AppListController, moving the bulk of the logic to chrome/browser/ui/ash/app… Base URL: https://chromium.googlesource.com/chromium/src.git@small_5_apps
Patch Set: AppListShower to new component: //ui/app_list/shower, GetViewDelegate() in GetViewDelegate(), test … 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/default_accessibility_delegate.h" 9 #include "ash/default_accessibility_delegate.h"
10 #include "ash/gpu_support_stub.h" 10 #include "ash/gpu_support_stub.h"
11 #include "ash/media_delegate.h" 11 #include "ash/media_delegate.h"
12 #include "ash/new_window_delegate.h" 12 #include "ash/new_window_delegate.h"
13 #include "ash/session/session_state_delegate.h" 13 #include "ash/session/session_state_delegate.h"
14 #include "ash/shell.h" 14 #include "ash/shell.h"
15 #include "ash/shell_window_ids.h" 15 #include "ash/shell_window_ids.h"
16 #include "ash/test/test_keyboard_ui.h" 16 #include "ash/test/test_keyboard_ui.h"
17 #include "ash/test/test_session_state_delegate.h" 17 #include "ash/test/test_session_state_delegate.h"
18 #include "ash/test/test_shelf_delegate.h" 18 #include "ash/test/test_shelf_delegate.h"
19 #include "ash/test/test_system_tray_delegate.h" 19 #include "ash/test/test_system_tray_delegate.h"
20 #include "ash/test/test_user_wallpaper_delegate.h" 20 #include "ash/test/test_user_wallpaper_delegate.h"
21 #include "ash/wm/app_list_shower_delegate.h"
22 #include "ash/wm/app_list_shower_delegate_factory.h"
23 #include "ash/wm/app_list_view_delegate_factory.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 "ui/app_list/shower/app_list_shower_impl.h"
25 #include "ui/app_list/app_list_view_delegate.h"
26 #include "ui/app_list/test/app_list_test_view_delegate.h" 28 #include "ui/app_list/test/app_list_test_view_delegate.h"
27 #include "ui/aura/window.h" 29 #include "ui/aura/window.h"
28 #include "ui/gfx/image/image.h" 30 #include "ui/gfx/image/image.h"
29 31
30 #if defined(OS_CHROMEOS) 32 #if defined(OS_CHROMEOS)
31 #include "ash/system/tray/system_tray_notifier.h" 33 #include "ash/system/tray/system_tray_notifier.h"
32 #endif 34 #endif
33 35
34 namespace ash { 36 namespace ash {
35 namespace test { 37 namespace test {
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 void HandleMediaPrevTrack() override {} 71 void HandleMediaPrevTrack() override {}
70 MediaCaptureState GetMediaCaptureState(UserIndex index) override { 72 MediaCaptureState GetMediaCaptureState(UserIndex index) override {
71 return state_; 73 return state_;
72 } 74 }
73 75
74 MediaCaptureState state_; 76 MediaCaptureState state_;
75 77
76 DISALLOW_COPY_AND_ASSIGN(MediaDelegateImpl); 78 DISALLOW_COPY_AND_ASSIGN(MediaDelegateImpl);
77 }; 79 };
78 80
81 class AppListViewDelegateFactoryImpl : public ash::AppListViewDelegateFactory {
82 public:
83 AppListViewDelegateFactoryImpl() {}
84 ~AppListViewDelegateFactoryImpl() override {}
85
86 // app_list::AppListViewDelegateFactory:
87 app_list::AppListViewDelegate* GetDelegate() override {
88 if (!app_list_view_delegate_.get()) {
89 app_list_view_delegate_.reset(
90 new app_list::test::AppListTestViewDelegate);
91 }
92 return app_list_view_delegate_.get();
93 }
94
95 private:
96 scoped_ptr<app_list::AppListViewDelegate> app_list_view_delegate_;
97
98 DISALLOW_COPY_AND_ASSIGN(AppListViewDelegateFactoryImpl);
99 };
100
79 } // namespace 101 } // namespace
80 102
81 TestShellDelegate::TestShellDelegate() 103 TestShellDelegate::TestShellDelegate()
82 : num_exit_requests_(0), 104 : num_exit_requests_(0),
83 multi_profiles_enabled_(false), 105 multi_profiles_enabled_(false),
84 force_maximize_on_first_run_(false) {} 106 force_maximize_on_first_run_(false),
107 app_list_shower_delegate_factory_(new AppListShowerDelegateFactory(
108 make_scoped_ptr(new AppListViewDelegateFactoryImpl))) {}
85 109
86 TestShellDelegate::~TestShellDelegate() { 110 TestShellDelegate::~TestShellDelegate() {
87 } 111 }
88 112
89 bool TestShellDelegate::IsFirstRunAfterBoot() const { 113 bool TestShellDelegate::IsFirstRunAfterBoot() const {
90 return false; 114 return false;
91 } 115 }
92 116
93 bool TestShellDelegate::IsIncognitoAllowed() const { 117 bool TestShellDelegate::IsIncognitoAllowed() const {
94 return true; 118 return true;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 keyboard_state_observer_list_.AddObserver(observer); 159 keyboard_state_observer_list_.AddObserver(observer);
136 } 160 }
137 161
138 void TestShellDelegate::RemoveVirtualKeyboardStateObserver( 162 void TestShellDelegate::RemoveVirtualKeyboardStateObserver(
139 VirtualKeyboardStateObserver* observer) { 163 VirtualKeyboardStateObserver* observer) {
140 keyboard_state_observer_list_.RemoveObserver(observer); 164 keyboard_state_observer_list_.RemoveObserver(observer);
141 } 165 }
142 166
143 void TestShellDelegate::OpenUrl(const GURL& url) {} 167 void TestShellDelegate::OpenUrl(const GURL& url) {}
144 168
145 app_list::AppListViewDelegate* TestShellDelegate::GetAppListViewDelegate() { 169 app_list::AppListShower* TestShellDelegate::GetAppListShower() {
146 if (!app_list_view_delegate_) 170 if (!app_list_shower_) {
147 app_list_view_delegate_.reset(new app_list::test::AppListTestViewDelegate); 171 app_list_shower_.reset(new app_list::AppListShowerImpl(
148 return app_list_view_delegate_.get(); 172 app_list_shower_delegate_factory_.get()));
173 }
174 return app_list_shower_.get();
149 } 175 }
150 176
151 ShelfDelegate* TestShellDelegate::CreateShelfDelegate(ShelfModel* model) { 177 ShelfDelegate* TestShellDelegate::CreateShelfDelegate(ShelfModel* model) {
152 return new TestShelfDelegate(model); 178 return new TestShelfDelegate(model);
153 } 179 }
154 180
155 SystemTrayDelegate* TestShellDelegate::CreateSystemTrayDelegate() { 181 SystemTrayDelegate* TestShellDelegate::CreateSystemTrayDelegate() {
156 return new TestSystemTrayDelegate; 182 return new TestSystemTrayDelegate;
157 } 183 }
158 184
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 #if defined(OS_CHROMEOS) 225 #if defined(OS_CHROMEOS)
200 Shell* shell = Shell::GetInstance(); 226 Shell* shell = Shell::GetInstance();
201 static_cast<MediaDelegateImpl*>(shell->media_delegate()) 227 static_cast<MediaDelegateImpl*>(shell->media_delegate())
202 ->set_media_capture_state(state); 228 ->set_media_capture_state(state);
203 shell->system_tray_notifier()->NotifyMediaCaptureChanged(); 229 shell->system_tray_notifier()->NotifyMediaCaptureChanged();
204 #endif 230 #endif
205 } 231 }
206 232
207 } // namespace test 233 } // namespace test
208 } // namespace ash 234 } // 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