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/shelf/shelf.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" |
11 #include "ash/shelf/shelf_util.h" | 11 #include "ash/shelf/shelf_util.h" |
12 #include "ash/shelf/shelf_widget.h" | 12 #include "ash/shelf/shelf_widget.h" |
13 #include "ash/shell.h" | 13 #include "ash/shell.h" |
14 #include "ash/shell/window_watcher_shelf_item_delegate.h" | 14 #include "ash/shell/window_watcher_shelf_item_delegate.h" |
15 #include "ash/shell_window_ids.h" | 15 #include "ash/shell_window_ids.h" |
16 #include "ui/aura/root_window.h" | 16 #include "ui/aura/root_window.h" |
17 #include "ui/aura/window.h" | 17 #include "ui/aura/window.h" |
18 #include "ui/gfx/display.h" | 18 #include "ui/gfx/display.h" |
(...skipping 18 matching lines...) Expand all Loading... |
37 window->RemoveObserver(watcher_); | 37 window->RemoveObserver(watcher_); |
38 } | 38 } |
39 | 39 |
40 void RootWindowAdded(aura::Window* root) { | 40 void RootWindowAdded(aura::Window* root) { |
41 aura::Window* panel_container = ash::Shell::GetContainer( | 41 aura::Window* panel_container = ash::Shell::GetContainer( |
42 root, | 42 root, |
43 internal::kShellWindowId_PanelContainer); | 43 internal::kShellWindowId_PanelContainer); |
44 panel_container->AddObserver(watcher_); | 44 panel_container->AddObserver(watcher_); |
45 | 45 |
46 aura::Window* container = | 46 aura::Window* container = |
47 Launcher::ForWindow(root)->shelf_widget()->window_container(); | 47 Shelf::ForWindow(root)->shelf_widget()->window_container(); |
48 container->AddObserver(this); | 48 container->AddObserver(this); |
49 for (size_t i = 0; i < container->children().size(); ++i) | 49 for (size_t i = 0; i < container->children().size(); ++i) |
50 container->children()[i]->AddObserver(watcher_); | 50 container->children()[i]->AddObserver(watcher_); |
51 } | 51 } |
52 | 52 |
53 void RootWindowRemoved(aura::Window* root) { | 53 void RootWindowRemoved(aura::Window* root) { |
54 aura::Window* panel_container = ash::Shell::GetContainer( | 54 aura::Window* panel_container = ash::Shell::GetContainer( |
55 root, | 55 root, |
56 internal::kShellWindowId_PanelContainer); | 56 internal::kShellWindowId_PanelContainer); |
57 panel_container->RemoveObserver(watcher_); | 57 panel_container->RemoveObserver(watcher_); |
58 | 58 |
59 aura::Window* container = | 59 aura::Window* container = |
60 Launcher::ForWindow(root)->shelf_widget()->window_container(); | 60 Shelf::ForWindow(root)->shelf_widget()->window_container(); |
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 workspace_window_watcher_->RootWindowAdded(root); | 148 workspace_window_watcher_->RootWindowAdded(root); |
149 } | 149 } |
150 | 150 |
151 void WindowWatcher::OnDisplayRemoved(const gfx::Display& old_display) { | 151 void WindowWatcher::OnDisplayRemoved(const gfx::Display& old_display) { |
152 // All windows in the display has already been removed, so no need to | 152 // All windows in the display has already been removed, so no need to |
153 // remove observers. | 153 // remove observers. |
154 } | 154 } |
155 | 155 |
156 } // namespace shell | 156 } // namespace shell |
157 } // namespace ash | 157 } // namespace ash |
OLD | NEW |