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