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_presenter_delegate.h" | |
10 #include "ash/app_list/app_list_presenter_delegate_factory.h" | |
11 #include "ash/common/default_accessibility_delegate.h" | 9 #include "ash/common/default_accessibility_delegate.h" |
12 #include "ash/common/gpu_support_stub.h" | 10 #include "ash/common/gpu_support_stub.h" |
13 #include "ash/common/palette_delegate.h" | 11 #include "ash/common/palette_delegate.h" |
14 #include "ash/common/session/session_state_delegate.h" | 12 #include "ash/common/session/session_state_delegate.h" |
15 #include "ash/common/test/test_session_state_delegate.h" | 13 #include "ash/common/test/test_session_state_delegate.h" |
16 #include "ash/common/test/test_shelf_delegate.h" | 14 #include "ash/common/test/test_shelf_delegate.h" |
17 #include "ash/common/test/test_system_tray_delegate.h" | 15 #include "ash/common/test/test_system_tray_delegate.h" |
18 #include "ash/common/wm/window_state.h" | 16 #include "ash/common/wm/window_state.h" |
19 #include "ash/common/wm_shell.h" | 17 #include "ash/common/wm_shell.h" |
20 #include "ash/public/cpp/shell_window_ids.h" | 18 #include "ash/public/cpp/shell_window_ids.h" |
21 #include "ash/test/test_keyboard_ui.h" | 19 #include "ash/test/test_keyboard_ui.h" |
22 #include "ash/test/test_wallpaper_delegate.h" | 20 #include "ash/test/test_wallpaper_delegate.h" |
23 #include "ash/wm/window_util.h" | 21 #include "ash/wm/window_util.h" |
24 #include "base/logging.h" | 22 #include "base/logging.h" |
25 #include "base/memory/ptr_util.h" | 23 #include "base/memory/ptr_util.h" |
26 #include "ui/app_list/presenter/app_list_presenter_impl.h" | |
27 #include "ui/app_list/presenter/app_list_view_delegate_factory.h" | |
28 #include "ui/app_list/test/app_list_test_view_delegate.h" | |
29 #include "ui/aura/window.h" | 24 #include "ui/aura/window.h" |
30 #include "ui/gfx/image/image.h" | 25 #include "ui/gfx/image/image.h" |
31 | 26 |
32 #if defined(OS_CHROMEOS) | 27 #if defined(OS_CHROMEOS) |
33 #include "ash/common/system/tray/system_tray_notifier.h" | 28 #include "ash/common/system/tray/system_tray_notifier.h" |
34 #endif | 29 #endif |
35 | 30 |
36 namespace ash { | 31 namespace ash { |
37 namespace test { | 32 namespace test { |
38 namespace { | |
39 | |
40 class AppListViewDelegateFactoryImpl | |
41 : public app_list::AppListViewDelegateFactory { | |
42 public: | |
43 AppListViewDelegateFactoryImpl() {} | |
44 ~AppListViewDelegateFactoryImpl() override {} | |
45 | |
46 // app_list::AppListViewDelegateFactory: | |
47 app_list::AppListViewDelegate* GetDelegate() override { | |
48 if (!app_list_view_delegate_.get()) { | |
49 app_list_view_delegate_.reset( | |
50 new app_list::test::AppListTestViewDelegate); | |
51 } | |
52 return app_list_view_delegate_.get(); | |
53 } | |
54 | |
55 private: | |
56 std::unique_ptr<app_list::AppListViewDelegate> app_list_view_delegate_; | |
57 | |
58 DISALLOW_COPY_AND_ASSIGN(AppListViewDelegateFactoryImpl); | |
59 }; | |
60 | |
61 } // namespace | |
62 | 33 |
63 TestShellDelegate::TestShellDelegate() | 34 TestShellDelegate::TestShellDelegate() |
64 : num_exit_requests_(0), | 35 : num_exit_requests_(0), |
65 multi_profiles_enabled_(false), | 36 multi_profiles_enabled_(false), |
66 force_maximize_on_first_run_(false), | 37 force_maximize_on_first_run_(false), |
67 touchscreen_enabled_in_local_pref_(true), | 38 touchscreen_enabled_in_local_pref_(true) {} |
68 app_list_presenter_delegate_factory_(new AppListPresenterDelegateFactory( | |
69 base::WrapUnique(new AppListViewDelegateFactoryImpl))) {} | |
70 | 39 |
71 TestShellDelegate::~TestShellDelegate() {} | 40 TestShellDelegate::~TestShellDelegate() {} |
72 | 41 |
73 ::service_manager::Connector* TestShellDelegate::GetShellConnector() const { | 42 ::service_manager::Connector* TestShellDelegate::GetShellConnector() const { |
74 return nullptr; | 43 return nullptr; |
75 } | 44 } |
76 | 45 |
77 bool TestShellDelegate::IsIncognitoAllowed() const { | 46 bool TestShellDelegate::IsIncognitoAllowed() const { |
78 return true; | 47 return true; |
79 } | 48 } |
(...skipping 21 matching lines...) Expand all Loading... |
101 void TestShellDelegate::Exit() { | 70 void TestShellDelegate::Exit() { |
102 num_exit_requests_++; | 71 num_exit_requests_++; |
103 } | 72 } |
104 | 73 |
105 keyboard::KeyboardUI* TestShellDelegate::CreateKeyboardUI() { | 74 keyboard::KeyboardUI* TestShellDelegate::CreateKeyboardUI() { |
106 return new TestKeyboardUI; | 75 return new TestKeyboardUI; |
107 } | 76 } |
108 | 77 |
109 void TestShellDelegate::OpenUrlFromArc(const GURL& url) {} | 78 void TestShellDelegate::OpenUrlFromArc(const GURL& url) {} |
110 | 79 |
111 app_list::AppListPresenter* TestShellDelegate::GetAppListPresenter() { | |
112 if (!app_list_presenter_) { | |
113 app_list_presenter_.reset(new app_list::AppListPresenterImpl( | |
114 app_list_presenter_delegate_factory_.get())); | |
115 } | |
116 return app_list_presenter_.get(); | |
117 } | |
118 | |
119 ShelfDelegate* TestShellDelegate::CreateShelfDelegate(ShelfModel* model) { | 80 ShelfDelegate* TestShellDelegate::CreateShelfDelegate(ShelfModel* model) { |
120 return new TestShelfDelegate(model); | 81 return new TestShelfDelegate(model); |
121 } | 82 } |
122 | 83 |
123 SystemTrayDelegate* TestShellDelegate::CreateSystemTrayDelegate() { | 84 SystemTrayDelegate* TestShellDelegate::CreateSystemTrayDelegate() { |
124 return new TestSystemTrayDelegate; | 85 return new TestSystemTrayDelegate; |
125 } | 86 } |
126 | 87 |
127 std::unique_ptr<WallpaperDelegate> | 88 std::unique_ptr<WallpaperDelegate> |
128 TestShellDelegate::CreateWallpaperDelegate() { | 89 TestShellDelegate::CreateWallpaperDelegate() { |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 void TestShellDelegate::SetTouchscreenEnabledInPrefs(bool enabled, | 128 void TestShellDelegate::SetTouchscreenEnabledInPrefs(bool enabled, |
168 bool use_local_state) { | 129 bool use_local_state) { |
169 if (use_local_state) | 130 if (use_local_state) |
170 touchscreen_enabled_in_local_pref_ = enabled; | 131 touchscreen_enabled_in_local_pref_ = enabled; |
171 } | 132 } |
172 | 133 |
173 void TestShellDelegate::UpdateTouchscreenStatusFromPrefs() {} | 134 void TestShellDelegate::UpdateTouchscreenStatusFromPrefs() {} |
174 | 135 |
175 } // namespace test | 136 } // namespace test |
176 } // namespace ash | 137 } // namespace ash |
OLD | NEW |