| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/shelf/shelf_window_watcher.h" | 5 #include "ash/shelf/shelf_window_watcher.h" |
| 6 | 6 |
| 7 #include "ash/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
| 8 #include "ash/shelf/shelf_constants.h" | 8 #include "ash/shelf/shelf_constants.h" |
| 9 #include "ash/shelf/shelf_item_delegate_manager.h" | 9 #include "ash/shelf/shelf_item_delegate_manager.h" |
| 10 #include "ash/shelf/shelf_model.h" | 10 #include "ash/shelf/shelf_model.h" |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 183 | 183 |
| 184 void ShelfWindowWatcher::StartObservingRemovedWindow(aura::Window* window) { | 184 void ShelfWindowWatcher::StartObservingRemovedWindow(aura::Window* window) { |
| 185 observed_removed_windows_.Add(window); | 185 observed_removed_windows_.Add(window); |
| 186 } | 186 } |
| 187 | 187 |
| 188 void ShelfWindowWatcher::FinishObservingRemovedWindow(aura::Window* window) { | 188 void ShelfWindowWatcher::FinishObservingRemovedWindow(aura::Window* window) { |
| 189 observed_removed_windows_.Remove(window); | 189 observed_removed_windows_.Remove(window); |
| 190 RemoveShelfItem(window); | 190 RemoveShelfItem(window); |
| 191 } | 191 } |
| 192 | 192 |
| 193 void ShelfWindowWatcher::OnWindowActivated(aura::Window* gained_active, | 193 void ShelfWindowWatcher::OnWindowActivated( |
| 194 aura::Window* lost_active) { | 194 aura::client::ActivationChangeObserver::ActivationReason reason, |
| 195 aura::Window* gained_active, |
| 196 aura::Window* lost_active) { |
| 195 if (gained_active && HasShelfItemForWindow(gained_active)) | 197 if (gained_active && HasShelfItemForWindow(gained_active)) |
| 196 UpdateShelfItemStatus(gained_active, true); | 198 UpdateShelfItemStatus(gained_active, true); |
| 197 if (lost_active && HasShelfItemForWindow(lost_active)) | 199 if (lost_active && HasShelfItemForWindow(lost_active)) |
| 198 UpdateShelfItemStatus(lost_active, false); | 200 UpdateShelfItemStatus(lost_active, false); |
| 199 } | 201 } |
| 200 | 202 |
| 201 void ShelfWindowWatcher::OnWindowAdded(aura::Window* window) { | 203 void ShelfWindowWatcher::OnWindowAdded(aura::Window* window) { |
| 202 observed_windows_.Add(window); | 204 observed_windows_.Add(window); |
| 203 | 205 |
| 204 if (observed_removed_windows_.IsObserving(window)) { | 206 if (observed_removed_windows_.IsObserving(window)) { |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 // Instead, we remove an observer from RootWindow and ActivationClient in the | 282 // Instead, we remove an observer from RootWindow and ActivationClient in the |
| 281 // OnRootWindowDestroyed(). | 283 // OnRootWindowDestroyed(). |
| 282 // Do nothing here. | 284 // Do nothing here. |
| 283 } | 285 } |
| 284 | 286 |
| 285 void ShelfWindowWatcher::OnDisplayMetricsChanged(const gfx::Display&, | 287 void ShelfWindowWatcher::OnDisplayMetricsChanged(const gfx::Display&, |
| 286 uint32_t) { | 288 uint32_t) { |
| 287 } | 289 } |
| 288 | 290 |
| 289 } // namespace ash | 291 } // namespace ash |
| OLD | NEW |