Chromium Code Reviews| Index: ash/shelf/shelf_window_watcher.cc |
| diff --git a/ash/shelf/shelf_window_watcher.cc b/ash/shelf/shelf_window_watcher.cc |
| index 6ca0240b2685a16c6b4e0ac0767717cbb30da19a..e9e73e83e4962561fc084bd5c8ee605161b160cf 100644 |
| --- a/ash/shelf/shelf_window_watcher.cc |
| +++ b/ash/shelf/shelf_window_watcher.cc |
| @@ -105,10 +105,8 @@ ShelfWindowWatcher::ShelfWindowWatcher(ShelfModel* model) |
| removed_window_observer_(this), |
| observed_windows_(this), |
| observed_root_windows_(&root_window_observer_), |
| - observed_removed_windows_(&removed_window_observer_), |
| - observed_activation_clients_(this) { |
| - // We can't assume all RootWindows have the same ActivationClient. |
| - // Add a RootWindow and its ActivationClient to the observed list. |
| + observed_removed_windows_(&removed_window_observer_) { |
| + Shell::GetInstance()->activation_client()->AddObserver(this); |
|
James Cook
2016/07/26 17:48:31
This will get converted to WmShell in my next CL.
|
| for (aura::Window* root : Shell::GetAllRootWindows()) |
| OnRootWindowAdded(WmWindowAura::Get(root)); |
| @@ -117,6 +115,7 @@ ShelfWindowWatcher::ShelfWindowWatcher(ShelfModel* model) |
| ShelfWindowWatcher::~ShelfWindowWatcher() { |
| display::Screen::GetScreen()->RemoveObserver(this); |
| + Shell::GetInstance()->activation_client()->RemoveObserver(this); |
| } |
| void ShelfWindowWatcher::AddShelfItem(aura::Window* window) { |
| @@ -139,10 +138,6 @@ void ShelfWindowWatcher::RemoveShelfItem(aura::Window* window) { |
| void ShelfWindowWatcher::OnRootWindowAdded(WmWindow* root_window_wm) { |
| aura::Window* root_window = WmWindowAura::GetAuraWindow(root_window_wm); |
| - // |observed_activation_clients_| can have the same ActivationClient multiple |
| - // times - which would be handled by the |observed_activation_clients_|. |
| - observed_activation_clients_.Add( |
| - aura::client::GetActivationClient(root_window)); |
| observed_root_windows_.Add(root_window); |
| aura::Window* default_container = |
| @@ -154,8 +149,6 @@ void ShelfWindowWatcher::OnRootWindowAdded(WmWindow* root_window_wm) { |
| void ShelfWindowWatcher::OnRootWindowRemoved(aura::Window* root_window) { |
| observed_root_windows_.Remove(root_window); |
| - observed_activation_clients_.Remove( |
| - aura::client::GetActivationClient(root_window)); |
| } |
| void ShelfWindowWatcher::UpdateShelfItemStatus(aura::Window* window, |