| 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" | 7 #include "ash/app_list/app_list_presenter_delegate_factory.h" |
| 8 #include "ash/common/accessibility_delegate.h" | 8 #include "ash/common/accessibility_delegate.h" |
| 9 #include "ash/common/default_accessibility_delegate.h" | 9 #include "ash/common/default_accessibility_delegate.h" |
| 10 #include "ash/common/gpu_support_stub.h" | 10 #include "ash/common/gpu_support_stub.h" |
| 11 #include "ash/common/media_delegate.h" | 11 #include "ash/common/media_delegate.h" |
| 12 #include "ash/common/new_window_delegate.h" | 12 #include "ash/common/new_window_delegate.h" |
| 13 #include "ash/common/palette_delegate.h" | 13 #include "ash/common/palette_delegate.h" |
| 14 #include "ash/common/session/session_state_delegate.h" | 14 #include "ash/common/session/session_state_delegate.h" |
| 15 #include "ash/common/shell_window_ids.h" | 15 #include "ash/common/shell_window_ids.h" |
| 16 #include "ash/common/system/tray/default_system_tray_delegate.h" | 16 #include "ash/common/system/tray/default_system_tray_delegate.h" |
| 17 #include "ash/common/wm/window_state.h" | 17 #include "ash/common/wm/window_state.h" |
| 18 #include "ash/default_user_wallpaper_delegate.h" | 18 #include "ash/default_wallpaper_delegate.h" |
| 19 #include "ash/shell.h" | 19 #include "ash/shell.h" |
| 20 #include "ash/shell/context_menu.h" | 20 #include "ash/shell/context_menu.h" |
| 21 #include "ash/shell/example_factory.h" | 21 #include "ash/shell/example_factory.h" |
| 22 #include "ash/shell/toplevel_window.h" | 22 #include "ash/shell/toplevel_window.h" |
| 23 #include "ash/test/test_keyboard_ui.h" | 23 #include "ash/test/test_keyboard_ui.h" |
| 24 #include "ash/test/test_shelf_delegate.h" | 24 #include "ash/test/test_shelf_delegate.h" |
| 25 #include "base/memory/ptr_util.h" | 25 #include "base/memory/ptr_util.h" |
| 26 #include "base/message_loop/message_loop.h" | 26 #include "base/message_loop/message_loop.h" |
| 27 #include "base/strings/utf_string_conversions.h" | 27 #include "base/strings/utf_string_conversions.h" |
| 28 #include "components/user_manager/user_info_impl.h" | 28 #include "components/user_manager/user_info_impl.h" |
| 29 #include "ui/app_list/app_list_view_delegate.h" | 29 #include "ui/app_list/app_list_view_delegate.h" |
| 30 #include "ui/app_list/presenter/app_list_presenter_impl.h" | 30 #include "ui/app_list/presenter/app_list_presenter_impl.h" |
| 31 #include "ui/app_list/presenter/app_list_view_delegate_factory.h" | 31 #include "ui/app_list/presenter/app_list_view_delegate_factory.h" |
| 32 #include "ui/aura/window.h" | 32 #include "ui/aura/window.h" |
| 33 #include "ui/gfx/image/image.h" | 33 #include "ui/gfx/image/image.h" |
| 34 #include "ui/gfx/image/image_skia.h" | 34 #include "ui/gfx/image/image_skia.h" |
| 35 | 35 |
| 36 namespace ash { | 36 namespace ash { |
| 37 namespace shell { | 37 namespace shell { |
| 38 namespace { | 38 namespace { |
| 39 | 39 |
| 40 class NewWindowDelegateImpl : public NewWindowDelegate { | 40 class NewWindowDelegateImpl : public NewWindowDelegate { |
| 41 public: | 41 public: |
| 42 NewWindowDelegateImpl() {} | 42 NewWindowDelegateImpl() {} |
| 43 ~NewWindowDelegateImpl() override {} | 43 ~NewWindowDelegateImpl() override {} |
| 44 | 44 |
| 45 // NewWindowDelegate: | 45 // NewWindowDelegate: |
| 46 void NewTab() override {} | 46 void NewTab() override {} |
| 47 void NewWindow(bool incognito) override { | 47 void NewWindow(bool incognito) override { |
| 48 ash::shell::ToplevelWindow::CreateParams create_params; | 48 ToplevelWindow::CreateParams create_params; |
| 49 create_params.can_resize = true; | 49 create_params.can_resize = true; |
| 50 create_params.can_maximize = true; | 50 create_params.can_maximize = true; |
| 51 ash::shell::ToplevelWindow::CreateToplevelWindow(create_params); | 51 ToplevelWindow::CreateToplevelWindow(create_params); |
| 52 } | 52 } |
| 53 void OpenFileManager() override {} | 53 void OpenFileManager() override {} |
| 54 void OpenCrosh() override {} | 54 void OpenCrosh() override {} |
| 55 void OpenGetHelp() override {} | 55 void OpenGetHelp() override {} |
| 56 void RestoreTab() override {} | 56 void RestoreTab() override {} |
| 57 void ShowKeyboardOverlay() override {} | 57 void ShowKeyboardOverlay() override {} |
| 58 void ShowTaskManager() override {} | 58 void ShowTaskManager() override {} |
| 59 void OpenFeedbackPage() override {} | 59 void OpenFeedbackPage() override {} |
| 60 | 60 |
| 61 private: | 61 private: |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 return !user_info_->GetImage().isNull(); | 136 return !user_info_->GetImage().isNull(); |
| 137 } | 137 } |
| 138 gfx::ImageSkia GetAvatarImageForWindow(WmWindow* window) const override { | 138 gfx::ImageSkia GetAvatarImageForWindow(WmWindow* window) const override { |
| 139 return gfx::ImageSkia(); | 139 return gfx::ImageSkia(); |
| 140 } | 140 } |
| 141 void SwitchActiveUser(const AccountId& account_id) override {} | 141 void SwitchActiveUser(const AccountId& account_id) override {} |
| 142 void CycleActiveUser(CycleUser cycle_user) override {} | 142 void CycleActiveUser(CycleUser cycle_user) override {} |
| 143 bool IsMultiProfileAllowedByPrimaryUserPolicy() const override { | 143 bool IsMultiProfileAllowedByPrimaryUserPolicy() const override { |
| 144 return true; | 144 return true; |
| 145 } | 145 } |
| 146 void AddSessionStateObserver(ash::SessionStateObserver* observer) override {} | 146 void AddSessionStateObserver(SessionStateObserver* observer) override {} |
| 147 void RemoveSessionStateObserver( | 147 void RemoveSessionStateObserver(SessionStateObserver* observer) override {} |
| 148 ash::SessionStateObserver* observer) override {} | |
| 149 | 148 |
| 150 private: | 149 private: |
| 151 bool screen_locked_; | 150 bool screen_locked_; |
| 152 | 151 |
| 153 // A pseudo user info. | 152 // A pseudo user info. |
| 154 std::unique_ptr<user_manager::UserInfo> user_info_; | 153 std::unique_ptr<user_manager::UserInfo> user_info_; |
| 155 | 154 |
| 156 DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateImpl); | 155 DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateImpl); |
| 157 }; | 156 }; |
| 158 | 157 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 228 app_list_presenter_delegate_factory_.get())); | 227 app_list_presenter_delegate_factory_.get())); |
| 229 } | 228 } |
| 230 return app_list_presenter_.get(); | 229 return app_list_presenter_.get(); |
| 231 } | 230 } |
| 232 | 231 |
| 233 ShelfDelegate* ShellDelegateImpl::CreateShelfDelegate(ShelfModel* model) { | 232 ShelfDelegate* ShellDelegateImpl::CreateShelfDelegate(ShelfModel* model) { |
| 234 shelf_delegate_ = new test::TestShelfDelegate(model); | 233 shelf_delegate_ = new test::TestShelfDelegate(model); |
| 235 return shelf_delegate_; | 234 return shelf_delegate_; |
| 236 } | 235 } |
| 237 | 236 |
| 238 ash::SystemTrayDelegate* ShellDelegateImpl::CreateSystemTrayDelegate() { | 237 SystemTrayDelegate* ShellDelegateImpl::CreateSystemTrayDelegate() { |
| 239 return new DefaultSystemTrayDelegate; | 238 return new DefaultSystemTrayDelegate; |
| 240 } | 239 } |
| 241 | 240 |
| 242 ash::UserWallpaperDelegate* ShellDelegateImpl::CreateUserWallpaperDelegate() { | 241 std::unique_ptr<WallpaperDelegate> |
| 243 return new DefaultUserWallpaperDelegate(); | 242 ShellDelegateImpl::CreateWallpaperDelegate() { |
| 243 return base::MakeUnique<DefaultWallpaperDelegate>(); |
| 244 } | 244 } |
| 245 | 245 |
| 246 ash::SessionStateDelegate* ShellDelegateImpl::CreateSessionStateDelegate() { | 246 SessionStateDelegate* ShellDelegateImpl::CreateSessionStateDelegate() { |
| 247 return new SessionStateDelegateImpl; | 247 return new SessionStateDelegateImpl; |
| 248 } | 248 } |
| 249 | 249 |
| 250 ash::AccessibilityDelegate* ShellDelegateImpl::CreateAccessibilityDelegate() { | 250 AccessibilityDelegate* ShellDelegateImpl::CreateAccessibilityDelegate() { |
| 251 return new DefaultAccessibilityDelegate; | 251 return new DefaultAccessibilityDelegate; |
| 252 } | 252 } |
| 253 | 253 |
| 254 ash::NewWindowDelegate* ShellDelegateImpl::CreateNewWindowDelegate() { | 254 NewWindowDelegate* ShellDelegateImpl::CreateNewWindowDelegate() { |
| 255 return new NewWindowDelegateImpl; | 255 return new NewWindowDelegateImpl; |
| 256 } | 256 } |
| 257 | 257 |
| 258 ash::MediaDelegate* ShellDelegateImpl::CreateMediaDelegate() { | 258 MediaDelegate* ShellDelegateImpl::CreateMediaDelegate() { |
| 259 return new MediaDelegateImpl; | 259 return new MediaDelegateImpl; |
| 260 } | 260 } |
| 261 | 261 |
| 262 std::unique_ptr<PaletteDelegate> ShellDelegateImpl::CreatePaletteDelegate() { | 262 std::unique_ptr<PaletteDelegate> ShellDelegateImpl::CreatePaletteDelegate() { |
| 263 return base::MakeUnique<PaletteDelegateImpl>(); | 263 return base::MakeUnique<PaletteDelegateImpl>(); |
| 264 } | 264 } |
| 265 | 265 |
| 266 ui::MenuModel* ShellDelegateImpl::CreateContextMenu(WmShelf* wm_shelf, | 266 ui::MenuModel* ShellDelegateImpl::CreateContextMenu(WmShelf* wm_shelf, |
| 267 const ShelfItem* item) { | 267 const ShelfItem* item) { |
| 268 return new ContextMenu(wm_shelf); | 268 return new ContextMenu(wm_shelf); |
| 269 } | 269 } |
| 270 | 270 |
| 271 GPUSupport* ShellDelegateImpl::CreateGPUSupport() { | 271 GPUSupport* ShellDelegateImpl::CreateGPUSupport() { |
| 272 // Real GPU support depends on src/content, so just use a stub. | 272 // Real GPU support depends on src/content, so just use a stub. |
| 273 return new GPUSupportStub; | 273 return new GPUSupportStub; |
| 274 } | 274 } |
| 275 | 275 |
| 276 base::string16 ShellDelegateImpl::GetProductName() const { | 276 base::string16 ShellDelegateImpl::GetProductName() const { |
| 277 return base::string16(); | 277 return base::string16(); |
| 278 } | 278 } |
| 279 | 279 |
| 280 gfx::Image ShellDelegateImpl::GetDeprecatedAcceleratorImage() const { | 280 gfx::Image ShellDelegateImpl::GetDeprecatedAcceleratorImage() const { |
| 281 return gfx::Image(); | 281 return gfx::Image(); |
| 282 } | 282 } |
| 283 | 283 |
| 284 } // namespace shell | 284 } // namespace shell |
| 285 } // namespace ash | 285 } // namespace ash |
| OLD | NEW |