Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(443)

Side by Side Diff: ash/shell/window_watcher.cc

Issue 12313118: Refactor: Shelf Widget (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_model.h" 9 #include "ash/launcher/launcher_model.h"
10 #include "ash/shelf/shelf_widget.h"
10 #include "ash/shell.h" 11 #include "ash/shell.h"
11 #include "ash/shell_window_ids.h" 12 #include "ash/shell_window_ids.h"
12 #include "ui/aura/root_window.h" 13 #include "ui/aura/root_window.h"
13 #include "ui/aura/window.h" 14 #include "ui/aura/window.h"
14 #include "ui/gfx/display.h" 15 #include "ui/gfx/display.h"
15 16
16 namespace ash { 17 namespace ash {
17 namespace shell { 18 namespace shell {
18 19
19 class WindowWatcher::WorkspaceWindowWatcher : public aura::WindowObserver { 20 class WindowWatcher::WorkspaceWindowWatcher : public aura::WindowObserver {
(...skipping 12 matching lines...) Expand all
32 DCHECK(window->children().empty()); 33 DCHECK(window->children().empty());
33 window->RemoveObserver(watcher_); 34 window->RemoveObserver(watcher_);
34 } 35 }
35 36
36 void RootWindowAdded(aura::RootWindow* root) { 37 void RootWindowAdded(aura::RootWindow* root) {
37 aura::Window* panel_container = ash::Shell::GetContainer( 38 aura::Window* panel_container = ash::Shell::GetContainer(
38 root, 39 root,
39 internal::kShellWindowId_PanelContainer); 40 internal::kShellWindowId_PanelContainer);
40 panel_container->AddObserver(watcher_); 41 panel_container->AddObserver(watcher_);
41 42
42 aura::Window* container = Launcher::ForWindow(root)->window_container(); 43 aura::Window* container =
44 Launcher::ForWindow(root)->shelf_widget()->window_container();
43 container->AddObserver(this); 45 container->AddObserver(this);
44 for (size_t i = 0; i < container->children().size(); ++i) 46 for (size_t i = 0; i < container->children().size(); ++i)
45 container->children()[i]->AddObserver(watcher_); 47 container->children()[i]->AddObserver(watcher_);
46 } 48 }
47 49
48 void RootWindowRemoved(aura::RootWindow* root) { 50 void RootWindowRemoved(aura::RootWindow* root) {
49 aura::Window* panel_container = ash::Shell::GetContainer( 51 aura::Window* panel_container = ash::Shell::GetContainer(
50 root, 52 root,
51 internal::kShellWindowId_PanelContainer); 53 internal::kShellWindowId_PanelContainer);
52 panel_container->RemoveObserver(watcher_); 54 panel_container->RemoveObserver(watcher_);
53 55
54 aura::Window* container = Launcher::ForWindow(root)->window_container(); 56 aura::Window* container =
57 Launcher::ForWindow(root)->shelf_widget()->window_container();
55 container->RemoveObserver(this); 58 container->RemoveObserver(this);
56 for (size_t i = 0; i < container->children().size(); ++i) 59 for (size_t i = 0; i < container->children().size(); ++i)
57 container->children()[i]->RemoveObserver(watcher_); 60 container->children()[i]->RemoveObserver(watcher_);
58 } 61 }
59 62
60 private: 63 private:
61 WindowWatcher* watcher_; 64 WindowWatcher* watcher_;
62 65
63 DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowWatcher); 66 DISALLOW_COPY_AND_ASSIGN(WorkspaceWindowWatcher);
64 }; 67 };
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
144 workspace_window_watcher_->RootWindowAdded(root); 147 workspace_window_watcher_->RootWindowAdded(root);
145 } 148 }
146 149
147 void WindowWatcher::OnDisplayRemoved(const gfx::Display& old_display) { 150 void WindowWatcher::OnDisplayRemoved(const gfx::Display& old_display) {
148 // All windows in the display has already been removed, so no need to 151 // All windows in the display has already been removed, so no need to
149 // remove observers. 152 // remove observers.
150 } 153 }
151 154
152 } // namespace shell 155 } // namespace shell
153 } // namespace ash 156 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698