| 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 #ifndef UI_AURA_SHELL_LAUNCHER_LAUNCHER_H_ | 5 #ifndef UI_AURA_SHELL_LAUNCHER_LAUNCHER_H_ |
| 6 #define UI_AURA_SHELL_LAUNCHER_LAUNCHER_H_ | 6 #define UI_AURA_SHELL_LAUNCHER_LAUNCHER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> |
| 10 |
| 9 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 10 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 11 #include "ui/aura/window_observer.h" | 13 #include "ui/aura/window_observer.h" |
| 12 #include "ui/aura_shell/aura_shell_export.h" | 14 #include "ui/aura_shell/aura_shell_export.h" |
| 13 | 15 |
| 14 namespace aura { | 16 namespace aura { |
| 15 class ToplevelWindowContainer; | 17 class ToplevelWindowContainer; |
| 16 } | 18 } |
| 17 | 19 |
| 18 namespace views { | 20 namespace views { |
| 19 class Widget; | 21 class Widget; |
| 20 } | 22 } |
| 21 | 23 |
| 22 namespace aura_shell { | 24 namespace aura_shell { |
| 23 | 25 |
| 24 class LauncherModel; | 26 class LauncherModel; |
| 25 | 27 |
| 26 class AURA_SHELL_EXPORT Launcher : public aura::WindowObserver { | 28 class AURA_SHELL_EXPORT Launcher : public aura::WindowObserver { |
| 27 public: | 29 public: |
| 28 explicit Launcher(aura::ToplevelWindowContainer* window_container); | 30 explicit Launcher(aura::ToplevelWindowContainer* window_container); |
| 29 ~Launcher(); | 31 ~Launcher(); |
| 30 | 32 |
| 31 LauncherModel* model() { return model_.get(); } | 33 LauncherModel* model() { return model_.get(); } |
| 32 views::Widget* widget() { return widget_; } | 34 views::Widget* widget() { return widget_; } |
| 33 | 35 |
| 34 private: | 36 private: |
| 37 typedef std::map<aura::Window*, bool> WindowMap; |
| 38 |
| 39 // If necessary asks the delegate if an entry should be created in the |
| 40 // launcher for |window|. This only asks the delegate once for a window. |
| 41 void MaybeAdd(aura::Window* window); |
| 42 |
| 35 // WindowObserver overrides: | 43 // WindowObserver overrides: |
| 36 virtual void OnWindowAdded(aura::Window* new_window) OVERRIDE; | 44 virtual void OnWindowAdded(aura::Window* new_window) OVERRIDE; |
| 37 virtual void OnWillRemoveWindow(aura::Window* window) OVERRIDE; | 45 virtual void OnWillRemoveWindow(aura::Window* window) OVERRIDE; |
| 46 virtual void OnWindowVisibilityChanged(aura::Window* window, |
| 47 bool visibile) OVERRIDE; |
| 38 | 48 |
| 39 scoped_ptr<LauncherModel> model_; | 49 scoped_ptr<LauncherModel> model_; |
| 40 | 50 |
| 41 // Widget hosting the view. | 51 // Widget hosting the view. |
| 42 views::Widget* widget_; | 52 views::Widget* widget_; |
| 43 | 53 |
| 44 aura::ToplevelWindowContainer* window_container_; | 54 aura::ToplevelWindowContainer* window_container_; |
| 45 | 55 |
| 56 // The set of windows we know about. The boolean indicates whether we've asked |
| 57 // the delegate if the window should added to the launcher. |
| 58 WindowMap known_windows_; |
| 59 |
| 46 DISALLOW_COPY_AND_ASSIGN(Launcher); | 60 DISALLOW_COPY_AND_ASSIGN(Launcher); |
| 47 }; | 61 }; |
| 48 | 62 |
| 49 } // namespace aura_shell | 63 } // namespace aura_shell |
| 50 | 64 |
| 51 #endif // UI_AURA_SHELL_LAUNCHER_LAUNCHER_H_ | 65 #endif // UI_AURA_SHELL_LAUNCHER_LAUNCHER_H_ |
| OLD | NEW |