| 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/shelf/shelf.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/window.h" | 16 #include "ui/aura/window.h" |
| 17 #include "ui/aura/window_event_dispatcher.h" | 17 #include "ui/aura/window_event_dispatcher.h" |
| 18 #include "ui/gfx/display.h" | 18 #include "ui/gfx/display.h" |
| 19 | 19 |
| 20 namespace ash { | 20 namespace ash { |
| 21 namespace shell { | 21 namespace shell { |
| 22 | 22 |
| 23 class WindowWatcher::WorkspaceWindowWatcher : public aura::WindowObserver { | 23 class WindowWatcher::WorkspaceWindowWatcher : public aura::WindowObserver { |
| 24 public: | 24 public: |
| 25 explicit WorkspaceWindowWatcher(WindowWatcher* watcher) : watcher_(watcher) { | 25 explicit WorkspaceWindowWatcher(WindowWatcher* watcher) : watcher_(watcher) { |
| 26 } | 26 } |
| 27 | 27 |
| 28 virtual ~WorkspaceWindowWatcher() { | 28 ~WorkspaceWindowWatcher() override {} |
| 29 } | |
| 30 | 29 |
| 31 virtual void OnWindowAdded(aura::Window* new_window) override { | 30 void OnWindowAdded(aura::Window* new_window) override { |
| 32 new_window->AddObserver(watcher_); | 31 new_window->AddObserver(watcher_); |
| 33 } | 32 } |
| 34 | 33 |
| 35 virtual void OnWillRemoveWindow(aura::Window* window) override { | 34 void OnWillRemoveWindow(aura::Window* window) override { |
| 36 DCHECK(window->children().empty()); | 35 DCHECK(window->children().empty()); |
| 37 window->RemoveObserver(watcher_); | 36 window->RemoveObserver(watcher_); |
| 38 } | 37 } |
| 39 | 38 |
| 40 void RootWindowAdded(aura::Window* root) { | 39 void RootWindowAdded(aura::Window* root) { |
| 41 aura::Window* panel_container = | 40 aura::Window* panel_container = |
| 42 ash::Shell::GetContainer(root, kShellWindowId_PanelContainer); | 41 ash::Shell::GetContainer(root, kShellWindowId_PanelContainer); |
| 43 panel_container->AddObserver(watcher_); | 42 panel_container->AddObserver(watcher_); |
| 44 | 43 |
| 45 aura::Window* container = | 44 aura::Window* container = |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 void WindowWatcher::OnDisplayRemoved(const gfx::Display& old_display) { | 145 void WindowWatcher::OnDisplayRemoved(const gfx::Display& old_display) { |
| 147 // All windows in the display has already been removed, so no need to | 146 // All windows in the display has already been removed, so no need to |
| 148 // remove observers. | 147 // remove observers. |
| 149 } | 148 } |
| 150 | 149 |
| 151 void WindowWatcher::OnDisplayMetricsChanged(const gfx::Display&, uint32_t) { | 150 void WindowWatcher::OnDisplayMetricsChanged(const gfx::Display&, uint32_t) { |
| 152 } | 151 } |
| 153 | 152 |
| 154 } // namespace shell | 153 } // namespace shell |
| 155 } // namespace ash | 154 } // namespace ash |
| OLD | NEW |