| 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/window_watcher.h" | 5 #include "ash/shell/window_watcher.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "ash/display/window_tree_host_manager.h" | 9 #include "ash/display/window_tree_host_manager.h" |
| 10 #include "ash/shelf/shelf.h" | 10 #include "ash/shelf/shelf.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 DCHECK(window->children().empty()); | 38 DCHECK(window->children().empty()); |
| 39 window->RemoveObserver(watcher_); | 39 window->RemoveObserver(watcher_); |
| 40 } | 40 } |
| 41 | 41 |
| 42 void RootWindowAdded(aura::Window* root) { | 42 void RootWindowAdded(aura::Window* root) { |
| 43 aura::Window* panel_container = | 43 aura::Window* panel_container = |
| 44 ash::Shell::GetContainer(root, kShellWindowId_PanelContainer); | 44 ash::Shell::GetContainer(root, kShellWindowId_PanelContainer); |
| 45 panel_container->AddObserver(watcher_); | 45 panel_container->AddObserver(watcher_); |
| 46 | 46 |
| 47 aura::Window* container = | 47 aura::Window* container = |
| 48 Shelf::ForWindow(root)->shelf_widget()->window_container(); | 48 ash::Shell::GetContainer(root, kShellWindowId_ShelfContainer); |
| 49 container->AddObserver(this); | 49 container->AddObserver(this); |
| 50 for (size_t i = 0; i < container->children().size(); ++i) | 50 for (size_t i = 0; i < container->children().size(); ++i) |
| 51 container->children()[i]->AddObserver(watcher_); | 51 container->children()[i]->AddObserver(watcher_); |
| 52 } | 52 } |
| 53 | 53 |
| 54 void RootWindowRemoved(aura::Window* root) { | 54 void RootWindowRemoved(aura::Window* root) { |
| 55 aura::Window* panel_container = | 55 aura::Window* panel_container = |
| 56 ash::Shell::GetContainer(root, kShellWindowId_PanelContainer); | 56 ash::Shell::GetContainer(root, kShellWindowId_PanelContainer); |
| 57 panel_container->RemoveObserver(watcher_); | 57 panel_container->RemoveObserver(watcher_); |
| 58 | 58 |
| 59 aura::Window* container = | 59 aura::Window* container = |
| 60 Shelf::ForWindow(root)->shelf_widget()->window_container(); | 60 ash::Shell::GetContainer(root, kShellWindowId_ShelfContainer); |
| 61 container->RemoveObserver(this); | 61 container->RemoveObserver(this); |
| 62 for (size_t i = 0; i < container->children().size(); ++i) | 62 for (size_t i = 0; i < container->children().size(); ++i) |
| 63 container->children()[i]->RemoveObserver(watcher_); | 63 container->children()[i]->RemoveObserver(watcher_); |
| 64 } | 64 } |
| 65 | 65 |
| 66 private: | 66 private: |
| 67 WindowWatcher* watcher_; | 67 WindowWatcher* watcher_; |
| 68 | 68 |
| 69 DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowWatcher); | 69 DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowWatcher); |
| 70 }; | 70 }; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 void WindowWatcher::OnDisplayRemoved(const display::Display& old_display) { | 148 void WindowWatcher::OnDisplayRemoved(const display::Display& old_display) { |
| 149 // All windows in the display has already been removed, so no need to | 149 // All windows in the display has already been removed, so no need to |
| 150 // remove observers. | 150 // remove observers. |
| 151 } | 151 } |
| 152 | 152 |
| 153 void WindowWatcher::OnDisplayMetricsChanged(const display::Display&, uint32_t) { | 153 void WindowWatcher::OnDisplayMetricsChanged(const display::Display&, uint32_t) { |
| 154 } | 154 } |
| 155 | 155 |
| 156 } // namespace shell | 156 } // namespace shell |
| 157 } // namespace ash | 157 } // namespace ash |
| OLD | NEW |