OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ui/aura_shell/launcher/launcher.h" | 5 #include "ui/aura_shell/launcher/launcher.h" |
6 | 6 |
7 #include "ui/aura/toplevel_window_container.h" | 7 #include "ui/aura/toplevel_window_container.h" |
8 #include "ui/aura_shell/launcher/launcher_model.h" | 8 #include "ui/aura_shell/launcher/launcher_model.h" |
9 #include "ui/aura_shell/launcher/launcher_view.h" | 9 #include "ui/aura_shell/launcher/launcher_view.h" |
10 #include "ui/aura_shell/shell.h" | 10 #include "ui/aura_shell/shell.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 widget_->Init(params); | 36 widget_->Init(params); |
37 gfx::Size pref = static_cast<views::View*>(launcher_view)->GetPreferredSize(); | 37 gfx::Size pref = static_cast<views::View*>(launcher_view)->GetPreferredSize(); |
38 widget_->SetBounds(gfx::Rect(0, 0, pref.width(), pref.height())); | 38 widget_->SetBounds(gfx::Rect(0, 0, pref.width(), pref.height())); |
39 widget_->SetContentsView(launcher_view); | 39 widget_->SetContentsView(launcher_view); |
40 widget_->Show(); | 40 widget_->Show(); |
41 widget_->GetNativeView()->set_name("LauncherView"); | 41 widget_->GetNativeView()->set_name("LauncherView"); |
42 } | 42 } |
43 | 43 |
44 Launcher::~Launcher() { | 44 Launcher::~Launcher() { |
45 window_container_->RemoveObserver(this); | 45 window_container_->RemoveObserver(this); |
| 46 for (WindowMap::iterator i = known_windows_.begin(); |
| 47 i != known_windows_.end(); ++i) { |
| 48 i->first->RemoveObserver(this); |
| 49 } |
46 } | 50 } |
47 | 51 |
48 void Launcher::MaybeAdd(aura::Window* window) { | 52 void Launcher::MaybeAdd(aura::Window* window) { |
49 if (known_windows_[window] == true) | 53 if (known_windows_[window] == true) |
50 return; // We already tried to add this window. | 54 return; // We already tried to add this window. |
51 | 55 |
52 known_windows_[window] = true; | 56 known_windows_[window] = true; |
53 ShellDelegate* delegate = Shell::GetInstance()->delegate(); | 57 ShellDelegate* delegate = Shell::GetInstance()->delegate(); |
54 if (!delegate) | 58 if (!delegate) |
55 return; | 59 return; |
(...skipping 29 matching lines...) Expand all Loading... |
85 model_->RemoveItemAt(i - model_->items().begin()); | 89 model_->RemoveItemAt(i - model_->items().begin()); |
86 } | 90 } |
87 | 91 |
88 void Launcher::OnWindowVisibilityChanged(aura::Window* window, | 92 void Launcher::OnWindowVisibilityChanged(aura::Window* window, |
89 bool visibile) { | 93 bool visibile) { |
90 if (visibile && !known_windows_[window]) | 94 if (visibile && !known_windows_[window]) |
91 MaybeAdd(window); | 95 MaybeAdd(window); |
92 } | 96 } |
93 | 97 |
94 } // namespace aura_shell | 98 } // namespace aura_shell |
OLD | NEW |