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