| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/mus/bridge/shell_port_mash.h" | 5 #include "ash/mus/bridge/shell_port_mash.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "ash/accelerators/accelerator_controller.h" | 9 #include "ash/accelerators/accelerator_controller.h" |
| 10 #include "ash/accelerators/accelerator_controller_delegate_aura.h" | 10 #include "ash/accelerators/accelerator_controller_delegate_aura.h" |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "ash/mus/display_synchronizer.h" | 23 #include "ash/mus/display_synchronizer.h" |
| 24 #include "ash/mus/drag_window_resizer.h" | 24 #include "ash/mus/drag_window_resizer.h" |
| 25 #include "ash/mus/keyboard_ui_mus.h" | 25 #include "ash/mus/keyboard_ui_mus.h" |
| 26 #include "ash/mus/screen_mus.h" | 26 #include "ash/mus/screen_mus.h" |
| 27 #include "ash/mus/touch_transform_setter_mus.h" | 27 #include "ash/mus/touch_transform_setter_mus.h" |
| 28 #include "ash/mus/window_manager.h" | 28 #include "ash/mus/window_manager.h" |
| 29 #include "ash/public/cpp/config.h" | 29 #include "ash/public/cpp/config.h" |
| 30 #include "ash/public/cpp/shell_window_ids.h" | 30 #include "ash/public/cpp/shell_window_ids.h" |
| 31 #include "ash/root_window_controller.h" | 31 #include "ash/root_window_controller.h" |
| 32 #include "ash/root_window_settings.h" | 32 #include "ash/root_window_settings.h" |
| 33 #include "ash/session/session_state_delegate.h" | |
| 34 #include "ash/shared/immersive_fullscreen_controller.h" | 33 #include "ash/shared/immersive_fullscreen_controller.h" |
| 35 #include "ash/shell.h" | 34 #include "ash/shell.h" |
| 36 #include "ash/shell_delegate.h" | 35 #include "ash/shell_delegate.h" |
| 37 #include "ash/shell_init_params.h" | 36 #include "ash/shell_init_params.h" |
| 38 #include "ash/shell_observer.h" | 37 #include "ash/shell_observer.h" |
| 39 #include "ash/system/tray/system_tray_delegate.h" | 38 #include "ash/system/tray/system_tray_delegate.h" |
| 40 #include "ash/touch/touch_uma.h" | 39 #include "ash/touch/touch_uma.h" |
| 41 #include "ash/virtual_keyboard_controller.h" | 40 #include "ash/virtual_keyboard_controller.h" |
| 42 #include "ash/wallpaper/wallpaper_delegate.h" | 41 #include "ash/wallpaper/wallpaper_delegate.h" |
| 43 #include "ash/wm/drag_window_resizer.h" | 42 #include "ash/wm/drag_window_resizer.h" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 69 #include "ui/display/types/native_display_delegate.h" | 68 #include "ui/display/types/native_display_delegate.h" |
| 70 #include "ui/views/mus/pointer_watcher_event_router.h" | 69 #include "ui/views/mus/pointer_watcher_event_router.h" |
| 71 | 70 |
| 72 #if defined(USE_OZONE) | 71 #if defined(USE_OZONE) |
| 73 #include "ui/display/manager/forwarding_display_delegate.h" | 72 #include "ui/display/manager/forwarding_display_delegate.h" |
| 74 #endif | 73 #endif |
| 75 | 74 |
| 76 namespace ash { | 75 namespace ash { |
| 77 namespace mus { | 76 namespace mus { |
| 78 | 77 |
| 79 namespace { | |
| 80 | |
| 81 // TODO(jamescook): After ShellDelegate is ported to ash/common use | |
| 82 // ShellDelegate::CreateSessionStateDelegate() to construct the mus version | |
| 83 // of SessionStateDelegate. | |
| 84 class SessionStateDelegateStub : public SessionStateDelegate { | |
| 85 public: | |
| 86 SessionStateDelegateStub() : user_info_(new user_manager::UserInfoImpl()) {} | |
| 87 | |
| 88 ~SessionStateDelegateStub() override {} | |
| 89 | |
| 90 // SessionStateDelegate: | |
| 91 bool ShouldShowAvatar(WmWindow* window) const override { | |
| 92 NOTIMPLEMENTED(); | |
| 93 return !user_info_->GetImage().isNull(); | |
| 94 } | |
| 95 gfx::ImageSkia GetAvatarImageForWindow(WmWindow* window) const override { | |
| 96 NOTIMPLEMENTED(); | |
| 97 return gfx::ImageSkia(); | |
| 98 } | |
| 99 | |
| 100 private: | |
| 101 // A pseudo user info. | |
| 102 std::unique_ptr<user_manager::UserInfo> user_info_; | |
| 103 | |
| 104 DISALLOW_COPY_AND_ASSIGN(SessionStateDelegateStub); | |
| 105 }; | |
| 106 | |
| 107 } // namespace | |
| 108 | |
| 109 ShellPortMash::MashSpecificState::MashSpecificState() = default; | 78 ShellPortMash::MashSpecificState::MashSpecificState() = default; |
| 110 | 79 |
| 111 ShellPortMash::MashSpecificState::~MashSpecificState() = default; | 80 ShellPortMash::MashSpecificState::~MashSpecificState() = default; |
| 112 | 81 |
| 113 ShellPortMash::MusSpecificState::MusSpecificState() = default; | 82 ShellPortMash::MusSpecificState::MusSpecificState() = default; |
| 114 | 83 |
| 115 ShellPortMash::MusSpecificState::~MusSpecificState() = default; | 84 ShellPortMash::MusSpecificState::~MusSpecificState() = default; |
| 116 | 85 |
| 117 ShellPortMash::ShellPortMash( | 86 ShellPortMash::ShellPortMash( |
| 118 aura::Window* primary_root_window, | 87 aura::Window* primary_root_window, |
| 119 WindowManager* window_manager, | 88 WindowManager* window_manager, |
| 120 views::PointerWatcherEventRouter* pointer_watcher_event_router, | 89 views::PointerWatcherEventRouter* pointer_watcher_event_router) |
| 121 bool create_session_state_delegate_stub) | |
| 122 : window_manager_(window_manager), | 90 : window_manager_(window_manager), |
| 123 primary_root_window_(primary_root_window) { | 91 primary_root_window_(primary_root_window) { |
| 124 if (create_session_state_delegate_stub) | |
| 125 session_state_delegate_ = base::MakeUnique<SessionStateDelegateStub>(); | |
| 126 | |
| 127 if (GetAshConfig() == Config::MASH) { | 92 if (GetAshConfig() == Config::MASH) { |
| 128 mash_state_ = base::MakeUnique<MashSpecificState>(); | 93 mash_state_ = base::MakeUnique<MashSpecificState>(); |
| 129 mash_state_->pointer_watcher_event_router = pointer_watcher_event_router; | 94 mash_state_->pointer_watcher_event_router = pointer_watcher_event_router; |
| 130 mash_state_->immersive_handler_factory = | 95 mash_state_->immersive_handler_factory = |
| 131 base::MakeUnique<ImmersiveHandlerFactoryMus>(); | 96 base::MakeUnique<ImmersiveHandlerFactoryMus>(); |
| 132 } else { | 97 } else { |
| 133 DCHECK_EQ(Config::MUS, GetAshConfig()); | 98 DCHECK_EQ(Config::MUS, GetAshConfig()); |
| 134 mus_state_ = base::MakeUnique<MusSpecificState>(); | 99 mus_state_ = base::MakeUnique<MusSpecificState>(); |
| 135 } | 100 } |
| 136 } | 101 } |
| (...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 422 | 387 |
| 423 std::unique_ptr<KeyEventWatcher> ShellPortMash::CreateKeyEventWatcher() { | 388 std::unique_ptr<KeyEventWatcher> ShellPortMash::CreateKeyEventWatcher() { |
| 424 if (GetAshConfig() == Config::MUS) | 389 if (GetAshConfig() == Config::MUS) |
| 425 return base::MakeUnique<KeyEventWatcherAura>(); | 390 return base::MakeUnique<KeyEventWatcherAura>(); |
| 426 | 391 |
| 427 // TODO: needs implementation for mus, http://crbug.com/649600. | 392 // TODO: needs implementation for mus, http://crbug.com/649600. |
| 428 NOTIMPLEMENTED(); | 393 NOTIMPLEMENTED(); |
| 429 return std::unique_ptr<KeyEventWatcher>(); | 394 return std::unique_ptr<KeyEventWatcher>(); |
| 430 } | 395 } |
| 431 | 396 |
| 432 SessionStateDelegate* ShellPortMash::GetSessionStateDelegate() { | |
| 433 return session_state_delegate_ ? session_state_delegate_.get() | |
| 434 : Shell::Get()->session_state_delegate(); | |
| 435 } | |
| 436 | |
| 437 void ShellPortMash::AddDisplayObserver(WmDisplayObserver* observer) { | 397 void ShellPortMash::AddDisplayObserver(WmDisplayObserver* observer) { |
| 438 // TODO(sky): mash should use the same code as mus/classic and | 398 // TODO(sky): mash should use the same code as mus/classic and |
| 439 // WmDisplayObserver should be removed; http://crbug.com/718860. | 399 // WmDisplayObserver should be removed; http://crbug.com/718860. |
| 440 if (GetAshConfig() == Config::MASH) { | 400 if (GetAshConfig() == Config::MASH) { |
| 441 NOTIMPLEMENTED(); | 401 NOTIMPLEMENTED(); |
| 442 return; | 402 return; |
| 443 } | 403 } |
| 444 if (!added_display_observer_) { | 404 if (!added_display_observer_) { |
| 445 added_display_observer_ = true; | 405 added_display_observer_ = true; |
| 446 Shell::Get()->window_tree_host_manager()->AddObserver(this); | 406 Shell::Get()->window_tree_host_manager()->AddObserver(this); |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 observer.OnDisplayConfigurationChanging(); | 597 observer.OnDisplayConfigurationChanging(); |
| 638 } | 598 } |
| 639 | 599 |
| 640 void ShellPortMash::OnDisplayConfigurationChanged() { | 600 void ShellPortMash::OnDisplayConfigurationChanged() { |
| 641 for (auto& observer : display_observers_) | 601 for (auto& observer : display_observers_) |
| 642 observer.OnDisplayConfigurationChanged(); | 602 observer.OnDisplayConfigurationChanged(); |
| 643 } | 603 } |
| 644 | 604 |
| 645 } // namespace mus | 605 } // namespace mus |
| 646 } // namespace ash | 606 } // namespace ash |
| OLD | NEW |