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/shell/shell_delegate_impl.h" | 5 #include "ash/shell/shell_delegate_impl.h" |
6 | 6 |
7 #include "ash/app_list/app_list_presenter_delegate_factory.h" | |
8 #include "ash/common/accessibility_delegate.h" | 7 #include "ash/common/accessibility_delegate.h" |
9 #include "ash/common/default_accessibility_delegate.h" | 8 #include "ash/common/default_accessibility_delegate.h" |
10 #include "ash/common/gpu_support_stub.h" | 9 #include "ash/common/gpu_support_stub.h" |
11 #include "ash/common/palette_delegate.h" | 10 #include "ash/common/palette_delegate.h" |
12 #include "ash/common/session/session_state_delegate.h" | 11 #include "ash/common/session/session_state_delegate.h" |
13 #include "ash/common/system/tray/default_system_tray_delegate.h" | 12 #include "ash/common/system/tray/default_system_tray_delegate.h" |
14 #include "ash/common/test/test_shelf_delegate.h" | 13 #include "ash/common/test/test_shelf_delegate.h" |
15 #include "ash/common/wm/window_state.h" | 14 #include "ash/common/wm/window_state.h" |
16 #include "ash/default_wallpaper_delegate.h" | 15 #include "ash/default_wallpaper_delegate.h" |
17 #include "ash/public/cpp/shell_window_ids.h" | 16 #include "ash/public/cpp/shell_window_ids.h" |
18 #include "ash/shell.h" | 17 #include "ash/shell.h" |
19 #include "ash/shell/context_menu.h" | 18 #include "ash/shell/context_menu.h" |
20 #include "ash/shell/example_factory.h" | 19 #include "ash/shell/example_factory.h" |
21 #include "ash/shell/toplevel_window.h" | 20 #include "ash/shell/toplevel_window.h" |
22 #include "ash/test/test_keyboard_ui.h" | 21 #include "ash/test/test_keyboard_ui.h" |
23 #include "base/memory/ptr_util.h" | 22 #include "base/memory/ptr_util.h" |
24 #include "base/message_loop/message_loop.h" | 23 #include "base/message_loop/message_loop.h" |
25 #include "base/strings/utf_string_conversions.h" | 24 #include "base/strings/utf_string_conversions.h" |
26 #include "components/user_manager/user_info_impl.h" | 25 #include "components/user_manager/user_info_impl.h" |
27 #include "ui/app_list/app_list_view_delegate.h" | |
28 #include "ui/app_list/presenter/app_list_presenter_impl.h" | |
29 #include "ui/app_list/presenter/app_list_view_delegate_factory.h" | |
30 #include "ui/aura/window.h" | 26 #include "ui/aura/window.h" |
31 #include "ui/gfx/image/image.h" | 27 #include "ui/gfx/image/image.h" |
32 #include "ui/gfx/image/image_skia.h" | 28 #include "ui/gfx/image/image_skia.h" |
33 | 29 |
34 namespace ash { | 30 namespace ash { |
35 namespace shell { | 31 namespace shell { |
36 namespace { | 32 namespace { |
37 | 33 |
38 class PaletteDelegateImpl : public PaletteDelegate { | 34 class PaletteDelegateImpl : public PaletteDelegate { |
39 public: | 35 public: |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 114 |
119 private: | 115 private: |
120 bool screen_locked_; | 116 bool screen_locked_; |
121 | 117 |
122 // A pseudo user info. | 118 // A pseudo user info. |
123 std::unique_ptr<user_manager::UserInfo> user_info_; | 119 std::unique_ptr<user_manager::UserInfo> user_info_; |
124 | 120 |
125 DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateImpl); | 121 DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateImpl); |
126 }; | 122 }; |
127 | 123 |
128 class AppListViewDelegateFactoryImpl | |
129 : public app_list::AppListViewDelegateFactory { | |
130 public: | |
131 AppListViewDelegateFactoryImpl() {} | |
132 ~AppListViewDelegateFactoryImpl() override {} | |
133 | |
134 // app_list::AppListViewDelegateFactory: | |
135 app_list::AppListViewDelegate* GetDelegate() override { | |
136 if (!app_list_view_delegate_.get()) | |
137 app_list_view_delegate_.reset(CreateAppListViewDelegate()); | |
138 return app_list_view_delegate_.get(); | |
139 } | |
140 | |
141 private: | |
142 std::unique_ptr<app_list::AppListViewDelegate> app_list_view_delegate_; | |
143 | |
144 DISALLOW_COPY_AND_ASSIGN(AppListViewDelegateFactoryImpl); | |
145 }; | |
146 | |
147 } // namespace | 124 } // namespace |
148 | 125 |
149 ShellDelegateImpl::ShellDelegateImpl() | 126 ShellDelegateImpl::ShellDelegateImpl() {} |
150 : shelf_delegate_(nullptr), | |
151 app_list_presenter_delegate_factory_(new AppListPresenterDelegateFactory( | |
152 base::WrapUnique(new AppListViewDelegateFactoryImpl))) {} | |
153 | 127 |
154 ShellDelegateImpl::~ShellDelegateImpl() {} | 128 ShellDelegateImpl::~ShellDelegateImpl() {} |
155 | 129 |
156 ::service_manager::Connector* ShellDelegateImpl::GetShellConnector() const { | 130 ::service_manager::Connector* ShellDelegateImpl::GetShellConnector() const { |
157 return nullptr; | 131 return nullptr; |
158 } | 132 } |
159 | 133 |
160 bool ShellDelegateImpl::IsIncognitoAllowed() const { | 134 bool ShellDelegateImpl::IsIncognitoAllowed() const { |
161 return true; | 135 return true; |
162 } | 136 } |
(...skipping 21 matching lines...) Expand all Loading... |
184 void ShellDelegateImpl::Exit() { | 158 void ShellDelegateImpl::Exit() { |
185 base::MessageLoop::current()->QuitWhenIdle(); | 159 base::MessageLoop::current()->QuitWhenIdle(); |
186 } | 160 } |
187 | 161 |
188 keyboard::KeyboardUI* ShellDelegateImpl::CreateKeyboardUI() { | 162 keyboard::KeyboardUI* ShellDelegateImpl::CreateKeyboardUI() { |
189 return new TestKeyboardUI; | 163 return new TestKeyboardUI; |
190 } | 164 } |
191 | 165 |
192 void ShellDelegateImpl::OpenUrlFromArc(const GURL& url) {} | 166 void ShellDelegateImpl::OpenUrlFromArc(const GURL& url) {} |
193 | 167 |
194 app_list::AppListPresenter* ShellDelegateImpl::GetAppListPresenter() { | |
195 if (!app_list_presenter_) { | |
196 app_list_presenter_.reset(new app_list::AppListPresenterImpl( | |
197 app_list_presenter_delegate_factory_.get())); | |
198 } | |
199 return app_list_presenter_.get(); | |
200 } | |
201 | |
202 ShelfDelegate* ShellDelegateImpl::CreateShelfDelegate(ShelfModel* model) { | 168 ShelfDelegate* ShellDelegateImpl::CreateShelfDelegate(ShelfModel* model) { |
203 shelf_delegate_ = new test::TestShelfDelegate(model); | 169 shelf_delegate_ = new test::TestShelfDelegate(model); |
204 return shelf_delegate_; | 170 return shelf_delegate_; |
205 } | 171 } |
206 | 172 |
207 SystemTrayDelegate* ShellDelegateImpl::CreateSystemTrayDelegate() { | 173 SystemTrayDelegate* ShellDelegateImpl::CreateSystemTrayDelegate() { |
208 return new DefaultSystemTrayDelegate; | 174 return new DefaultSystemTrayDelegate; |
209 } | 175 } |
210 | 176 |
211 std::unique_ptr<WallpaperDelegate> | 177 std::unique_ptr<WallpaperDelegate> |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 return true; | 214 return true; |
249 } | 215 } |
250 | 216 |
251 void ShellDelegateImpl::SetTouchscreenEnabledInPrefs(bool enabled, | 217 void ShellDelegateImpl::SetTouchscreenEnabledInPrefs(bool enabled, |
252 bool use_local_state) {} | 218 bool use_local_state) {} |
253 | 219 |
254 void ShellDelegateImpl::UpdateTouchscreenStatusFromPrefs() {} | 220 void ShellDelegateImpl::UpdateTouchscreenStatusFromPrefs() {} |
255 | 221 |
256 } // namespace shell | 222 } // namespace shell |
257 } // namespace ash | 223 } // namespace ash |
OLD | NEW |