| 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 "ash/display/display_controller.h" | 7 #include "ash/display/display_controller.h" |
| 8 #include "ash/launcher/launcher.h" | 8 #include "ash/launcher/launcher.h" |
| 9 #include "ash/launcher/launcher_item_delegate_manager.h" | 9 #include "ash/launcher/launcher_item_delegate_manager.h" |
| 10 #include "ash/launcher/launcher_model.h" | 10 #include "ash/launcher/launcher_model.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 | 29 |
| 30 virtual void OnWindowAdded(aura::Window* new_window) OVERRIDE { | 30 virtual void OnWindowAdded(aura::Window* new_window) OVERRIDE { |
| 31 new_window->AddObserver(watcher_); | 31 new_window->AddObserver(watcher_); |
| 32 } | 32 } |
| 33 | 33 |
| 34 virtual void OnWillRemoveWindow(aura::Window* window) OVERRIDE { | 34 virtual void OnWillRemoveWindow(aura::Window* window) OVERRIDE { |
| 35 DCHECK(window->children().empty()); | 35 DCHECK(window->children().empty()); |
| 36 window->RemoveObserver(watcher_); | 36 window->RemoveObserver(watcher_); |
| 37 } | 37 } |
| 38 | 38 |
| 39 void RootWindowAdded(aura::RootWindow* root) { | 39 void RootWindowAdded(aura::Window* root) { |
| 40 aura::Window* panel_container = ash::Shell::GetContainer( | 40 aura::Window* panel_container = ash::Shell::GetContainer( |
| 41 root, | 41 root, |
| 42 internal::kShellWindowId_PanelContainer); | 42 internal::kShellWindowId_PanelContainer); |
| 43 panel_container->AddObserver(watcher_); | 43 panel_container->AddObserver(watcher_); |
| 44 | 44 |
| 45 aura::Window* container = | 45 aura::Window* container = |
| 46 Launcher::ForWindow(root)->shelf_widget()->window_container(); | 46 Launcher::ForWindow(root)->shelf_widget()->window_container(); |
| 47 container->AddObserver(this); | 47 container->AddObserver(this); |
| 48 for (size_t i = 0; i < container->children().size(); ++i) | 48 for (size_t i = 0; i < container->children().size(); ++i) |
| 49 container->children()[i]->AddObserver(watcher_); | 49 container->children()[i]->AddObserver(watcher_); |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 id_to_window_.erase(i); | 143 id_to_window_.erase(i); |
| 144 break; | 144 break; |
| 145 } | 145 } |
| 146 } | 146 } |
| 147 } | 147 } |
| 148 | 148 |
| 149 void WindowWatcher::OnDisplayBoundsChanged(const gfx::Display& display) { | 149 void WindowWatcher::OnDisplayBoundsChanged(const gfx::Display& display) { |
| 150 } | 150 } |
| 151 | 151 |
| 152 void WindowWatcher::OnDisplayAdded(const gfx::Display& new_display) { | 152 void WindowWatcher::OnDisplayAdded(const gfx::Display& new_display) { |
| 153 aura::RootWindow* root = Shell::GetInstance()->display_controller()-> | 153 aura::Window* root = Shell::GetInstance()->display_controller()-> |
| 154 GetRootWindowForDisplayId(new_display.id()); | 154 GetRootWindowForDisplayId(new_display.id()); |
| 155 workspace_window_watcher_->RootWindowAdded(root); | 155 workspace_window_watcher_->RootWindowAdded(root); |
| 156 } | 156 } |
| 157 | 157 |
| 158 void WindowWatcher::OnDisplayRemoved(const gfx::Display& old_display) { | 158 void WindowWatcher::OnDisplayRemoved(const gfx::Display& old_display) { |
| 159 // All windows in the display has already been removed, so no need to | 159 // All windows in the display has already been removed, so no need to |
| 160 // remove observers. | 160 // remove observers. |
| 161 } | 161 } |
| 162 | 162 |
| 163 } // namespace shell | 163 } // namespace shell |
| 164 } // namespace ash | 164 } // namespace ash |
| OLD | NEW |