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/accessibility_delegate.h" | 7 #include "ash/accessibility_delegate.h" |
| 8 #include "ash/app_list/app_list_shower_delegate_factory.h" |
| 9 #include "ash/app_list/app_list_view_delegate_factory.h" |
8 #include "ash/default_accessibility_delegate.h" | 10 #include "ash/default_accessibility_delegate.h" |
9 #include "ash/default_user_wallpaper_delegate.h" | 11 #include "ash/default_user_wallpaper_delegate.h" |
10 #include "ash/gpu_support_stub.h" | 12 #include "ash/gpu_support_stub.h" |
11 #include "ash/media_delegate.h" | 13 #include "ash/media_delegate.h" |
12 #include "ash/new_window_delegate.h" | 14 #include "ash/new_window_delegate.h" |
13 #include "ash/session/session_state_delegate.h" | 15 #include "ash/session/session_state_delegate.h" |
14 #include "ash/shell/context_menu.h" | 16 #include "ash/shell/context_menu.h" |
15 #include "ash/shell/example_factory.h" | 17 #include "ash/shell/example_factory.h" |
16 #include "ash/shell/shelf_delegate_impl.h" | 18 #include "ash/shell/shelf_delegate_impl.h" |
17 #include "ash/shell/toplevel_window.h" | 19 #include "ash/shell/toplevel_window.h" |
18 #include "ash/shell_window_ids.h" | 20 #include "ash/shell_window_ids.h" |
19 #include "ash/system/tray/default_system_tray_delegate.h" | 21 #include "ash/system/tray/default_system_tray_delegate.h" |
20 #include "ash/test/test_keyboard_ui.h" | 22 #include "ash/test/test_keyboard_ui.h" |
21 #include "ash/wm/window_state.h" | 23 #include "ash/wm/window_state.h" |
| 24 #include "base/memory/ptr_util.h" |
22 #include "base/message_loop/message_loop.h" | 25 #include "base/message_loop/message_loop.h" |
23 #include "base/strings/utf_string_conversions.h" | 26 #include "base/strings/utf_string_conversions.h" |
24 #include "components/user_manager/user_info_impl.h" | 27 #include "components/user_manager/user_info_impl.h" |
25 #include "ui/app_list/app_list_view_delegate.h" | 28 #include "ui/app_list/app_list_view_delegate.h" |
| 29 #include "ui/app_list/shower/app_list_shower_impl.h" |
26 #include "ui/aura/window.h" | 30 #include "ui/aura/window.h" |
27 #include "ui/gfx/image/image.h" | 31 #include "ui/gfx/image/image.h" |
28 #include "ui/gfx/image/image_skia.h" | 32 #include "ui/gfx/image/image_skia.h" |
29 | 33 |
30 namespace ash { | 34 namespace ash { |
31 namespace shell { | 35 namespace shell { |
32 namespace { | 36 namespace { |
33 | 37 |
34 class NewWindowDelegateImpl : public NewWindowDelegate { | 38 class NewWindowDelegateImpl : public NewWindowDelegate { |
35 public: | 39 public: |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 | 131 |
128 private: | 132 private: |
129 bool screen_locked_; | 133 bool screen_locked_; |
130 | 134 |
131 // A pseudo user info. | 135 // A pseudo user info. |
132 std::unique_ptr<user_manager::UserInfo> user_info_; | 136 std::unique_ptr<user_manager::UserInfo> user_info_; |
133 | 137 |
134 DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateImpl); | 138 DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateImpl); |
135 }; | 139 }; |
136 | 140 |
| 141 class AppListViewDelegateFactoryImpl : public ash::AppListViewDelegateFactory { |
| 142 public: |
| 143 AppListViewDelegateFactoryImpl() {} |
| 144 ~AppListViewDelegateFactoryImpl() override {} |
| 145 |
| 146 // app_list::AppListViewDelegateFactory: |
| 147 app_list::AppListViewDelegate* GetDelegate() override { |
| 148 if (!app_list_view_delegate_.get()) |
| 149 app_list_view_delegate_.reset(CreateAppListViewDelegate()); |
| 150 return app_list_view_delegate_.get(); |
| 151 } |
| 152 |
| 153 private: |
| 154 std::unique_ptr<app_list::AppListViewDelegate> app_list_view_delegate_; |
| 155 |
| 156 DISALLOW_COPY_AND_ASSIGN(AppListViewDelegateFactoryImpl); |
| 157 }; |
| 158 |
137 } // namespace | 159 } // namespace |
138 | 160 |
139 ShellDelegateImpl::ShellDelegateImpl() : shelf_delegate_(nullptr) {} | 161 ShellDelegateImpl::ShellDelegateImpl() |
| 162 : shelf_delegate_(nullptr), |
| 163 app_list_shower_delegate_factory_(new AppListShowerDelegateFactory( |
| 164 base::WrapUnique(new AppListViewDelegateFactoryImpl))) {} |
140 | 165 |
141 ShellDelegateImpl::~ShellDelegateImpl() {} | 166 ShellDelegateImpl::~ShellDelegateImpl() {} |
142 | 167 |
143 bool ShellDelegateImpl::IsFirstRunAfterBoot() const { | 168 bool ShellDelegateImpl::IsFirstRunAfterBoot() const { |
144 return false; | 169 return false; |
145 } | 170 } |
146 | 171 |
147 bool ShellDelegateImpl::IsIncognitoAllowed() const { | 172 bool ShellDelegateImpl::IsIncognitoAllowed() const { |
148 return true; | 173 return true; |
149 } | 174 } |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 void ShellDelegateImpl::AddVirtualKeyboardStateObserver( | 209 void ShellDelegateImpl::AddVirtualKeyboardStateObserver( |
185 VirtualKeyboardStateObserver* observer) { | 210 VirtualKeyboardStateObserver* observer) { |
186 } | 211 } |
187 | 212 |
188 void ShellDelegateImpl::RemoveVirtualKeyboardStateObserver( | 213 void ShellDelegateImpl::RemoveVirtualKeyboardStateObserver( |
189 VirtualKeyboardStateObserver* observer) { | 214 VirtualKeyboardStateObserver* observer) { |
190 } | 215 } |
191 | 216 |
192 void ShellDelegateImpl::OpenUrl(const GURL& url) {} | 217 void ShellDelegateImpl::OpenUrl(const GURL& url) {} |
193 | 218 |
194 app_list::AppListViewDelegate* ShellDelegateImpl::GetAppListViewDelegate() { | 219 app_list::AppListShower* ShellDelegateImpl::GetAppListShower() { |
195 if (!app_list_view_delegate_) | 220 if (!app_list_shower_) { |
196 app_list_view_delegate_.reset(ash::shell::CreateAppListViewDelegate()); | 221 app_list_shower_.reset(new app_list::AppListShowerImpl( |
197 return app_list_view_delegate_.get(); | 222 app_list_shower_delegate_factory_.get())); |
| 223 } |
| 224 return app_list_shower_.get(); |
198 } | 225 } |
199 | 226 |
200 ShelfDelegate* ShellDelegateImpl::CreateShelfDelegate(ShelfModel* model) { | 227 ShelfDelegate* ShellDelegateImpl::CreateShelfDelegate(ShelfModel* model) { |
201 shelf_delegate_ = new ShelfDelegateImpl(); | 228 shelf_delegate_ = new ShelfDelegateImpl(); |
202 return shelf_delegate_; | 229 return shelf_delegate_; |
203 } | 230 } |
204 | 231 |
205 ash::SystemTrayDelegate* ShellDelegateImpl::CreateSystemTrayDelegate() { | 232 ash::SystemTrayDelegate* ShellDelegateImpl::CreateSystemTrayDelegate() { |
206 return new DefaultSystemTrayDelegate; | 233 return new DefaultSystemTrayDelegate; |
207 } | 234 } |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 base::string16 ShellDelegateImpl::GetProductName() const { | 267 base::string16 ShellDelegateImpl::GetProductName() const { |
241 return base::string16(); | 268 return base::string16(); |
242 } | 269 } |
243 | 270 |
244 gfx::Image ShellDelegateImpl::GetDeprecatedAcceleratorImage() const { | 271 gfx::Image ShellDelegateImpl::GetDeprecatedAcceleratorImage() const { |
245 return gfx::Image(); | 272 return gfx::Image(); |
246 } | 273 } |
247 | 274 |
248 } // namespace shell | 275 } // namespace shell |
249 } // namespace ash | 276 } // namespace ash |
OLD | NEW |