Chromium Code Reviews| Index: ash/shell.cc |
| diff --git a/ash/shell.cc b/ash/shell.cc |
| index 6e03f8ecc972d36648cb701c5cd542155a18d90c..b430f12e045e359fd78e67bc50ee38020b43f185 100644 |
| --- a/ash/shell.cc |
| +++ b/ash/shell.cc |
| @@ -246,7 +246,8 @@ aura::Window* Shell::GetPrimaryRootWindow() { |
| // static |
| aura::Window* Shell::GetTargetRootWindow() { |
|
James Cook
2017/03/08 03:04:15
Hrm, though now it's confusing that we have both.
sky
2017/03/08 17:01:38
Indeed. I renamed this to GetRootWindowForNewWindo
|
| CHECK(WmShell::HasInstance()); |
| - return WmWindow::GetAuraWindow(WmShell::Get()->GetRootWindowForNewWindows()); |
| + return WmWindow::GetAuraWindow( |
| + Shell::GetInstance()->GetRootWindowForNewWindows()); |
| } |
| // static |
| @@ -376,6 +377,12 @@ void Shell::SetTouchHudProjectionEnabled(bool enabled) { |
| observer.OnTouchHudProjectionToggled(enabled); |
| } |
| +WmWindow* Shell::GetRootWindowForNewWindows() { |
| + if (scoped_root_window_for_new_windows_) |
| + return scoped_root_window_for_new_windows_; |
| + return root_window_for_new_windows_; |
| +} |
| + |
| FirstRunHelper* Shell::CreateFirstRunHelper() { |
| return new FirstRunHelperImpl; |
| } |
| @@ -680,14 +687,12 @@ void Shell::Init(const ShellInitParams& init_params) { |
| new ::wm::FocusController(focus_rules); |
| focus_client_.reset(focus_controller); |
| activation_client_ = focus_controller; |
| - // TODO(sky): Shell should implement ActivationChangeObserver, not WmShell. |
| - activation_client_->AddObserver(wm_shell_.get()); |
| + activation_client_->AddObserver(this); |
|
James Cook
2017/03/08 03:04:15
Where is this observer removed?
sky
2017/03/08 17:01:38
Looking back at the history AFAICT the code never
|
| screen_position_controller_.reset(new ScreenPositionController); |
| wm_shell_->CreatePrimaryHost(); |
| - wm_shell_->set_root_window_for_new_windows( |
| - WmWindow::Get(GetPrimaryRootWindow())); |
| + root_window_for_new_windows_ = WmWindow::Get(GetPrimaryRootWindow()); |
| if (!is_mash) { |
| resolution_notification_controller_.reset( |
| @@ -959,4 +964,14 @@ ui::EventTargeter* Shell::GetEventTargeter() { |
| return nullptr; |
| } |
| +void Shell::OnWindowActivated( |
| + aura::client::ActivationChangeObserver::ActivationReason reason, |
| + aura::Window* gained_active, |
| + aura::Window* lost_active) { |
| + // TODO(sky): Shell should implement ActivationChangeObserver, not WmShell. |
|
James Cook
2017/03/08 03:04:15
This TODO looks TODONE.
sky
2017/03/08 17:01:38
Done.
|
| + WmWindow* gained_active_wm = WmWindow::Get(gained_active); |
| + if (gained_active_wm) |
| + root_window_for_new_windows_ = gained_active_wm->GetRootWindow(); |
| +} |
| + |
| } // namespace ash |