| 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_SHELL_H_ | 5 #ifndef UI_AURA_SHELL_SHELL_H_ |
| 6 #define UI_AURA_SHELL_SHELL_H_ | 6 #define UI_AURA_SHELL_SHELL_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <map> |
| 9 #include <utility> | 10 #include <utility> |
| 10 #include <vector> | 11 #include <vector> |
| 11 | 12 |
| 12 #include "base/basictypes.h" | 13 #include "base/basictypes.h" |
| 13 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/task.h" | 15 #include "base/task.h" |
| 15 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
| 16 #include "base/memory/weak_ptr.h" | 17 #include "base/memory/weak_ptr.h" |
| 17 #include "ui/aura/desktop_delegate.h" | 18 #include "ui/aura/desktop_delegate.h" |
| 18 #include "ui/aura_shell/aura_shell_export.h" | 19 #include "ui/aura_shell/aura_shell_export.h" |
| 19 #include "views/controls/button/button.h" | |
| 20 | 20 |
| 21 namespace aura { | 21 namespace aura { |
| 22 class Window; | 22 class Window; |
| 23 } | 23 } |
| 24 namespace gfx { | 24 namespace gfx { |
| 25 class Rect; | 25 class Rect; |
| 26 } | 26 } |
| 27 namespace views { | |
| 28 class ImageButton; | |
| 29 } | |
| 30 | 27 |
| 31 namespace aura_shell { | 28 namespace aura_shell { |
| 32 | 29 |
| 33 class LauncherModel; | |
| 34 class ShellDelegate; | 30 class ShellDelegate; |
| 35 | 31 |
| 36 // Shell is a singleton object that presents the Shell API and implements the | 32 // Shell is a singleton object that presents the Shell API and implements the |
| 37 // Desktop's delegate interface. | 33 // Desktop's delegate interface. |
| 38 class AURA_SHELL_EXPORT Shell : public aura::DesktopDelegate, | 34 class AURA_SHELL_EXPORT Shell : public aura::DesktopDelegate { |
| 39 public views::ButtonListener { | |
| 40 public: | 35 public: |
| 41 // Upon creation, the Shell sets itself as the Desktop's delegate, which takes | 36 // Upon creation, the Shell sets itself as the Desktop's delegate, which takes |
| 42 // ownership of the Shell. | 37 // ownership of the Shell. |
| 43 Shell(); | 38 Shell(); |
| 44 virtual ~Shell(); | 39 virtual ~Shell(); |
| 45 | 40 |
| 46 static Shell* GetInstance(); | 41 static Shell* GetInstance(); |
| 47 | 42 |
| 48 void Init(); | 43 void Init(); |
| 49 | 44 |
| 50 // Sets the delegate. Shell owns its delegate. | 45 // Sets the delegate. Shell owns its delegate. |
| 51 void SetDelegate(ShellDelegate* delegate); | 46 void SetDelegate(ShellDelegate* delegate); |
| 47 ShellDelegate* delegate() { return delegate_.get(); } |
| 52 | 48 |
| 53 aura::Window* GetContainer(int container_id); | 49 aura::Window* GetContainer(int container_id); |
| 54 const aura::Window* GetContainer(int container_id) const; | 50 const aura::Window* GetContainer(int container_id) const; |
| 55 | 51 |
| 56 void TileWindows(); | 52 void TileWindows(); |
| 57 void RestoreTiledWindows(); | 53 void RestoreTiledWindows(); |
| 58 | 54 |
| 59 private: | 55 private: |
| 60 typedef std::pair<aura::Window*, gfx::Rect> WindowAndBoundsPair; | 56 typedef std::pair<aura::Window*, gfx::Rect> WindowAndBoundsPair; |
| 61 | 57 |
| 62 void InitLauncherModel(); | |
| 63 | |
| 64 // Overridden from aura::DesktopDelegate: | 58 // Overridden from aura::DesktopDelegate: |
| 65 virtual void AddChildToDefaultParent(aura::Window* window) OVERRIDE; | 59 virtual void AddChildToDefaultParent(aura::Window* window) OVERRIDE; |
| 66 virtual aura::Window* GetTopmostWindowToActivate( | 60 virtual aura::Window* GetTopmostWindowToActivate( |
| 67 aura::Window* ignore) const OVERRIDE; | 61 aura::Window* ignore) const OVERRIDE; |
| 68 | 62 virtual void WindowAdded(aura::Window* window) OVERRIDE; |
| 69 // Overriden from views::ButtonListener: | 63 virtual void WillRemoveWindow(aura::Window* window) OVERRIDE; |
| 70 virtual void ButtonPressed(views::Button* sender, | |
| 71 const views::Event& event) OVERRIDE; | |
| 72 | 64 |
| 73 static Shell* instance_; | 65 static Shell* instance_; |
| 74 | 66 |
| 75 std::vector<WindowAndBoundsPair> to_restore_; | 67 std::vector<WindowAndBoundsPair> to_restore_; |
| 76 | 68 |
| 77 base::WeakPtrFactory<Shell> method_factory_; | 69 base::WeakPtrFactory<Shell> method_factory_; |
| 78 | 70 |
| 79 scoped_ptr<LauncherModel> launcher_model_; | |
| 80 views::ImageButton* new_browser_button_; | |
| 81 views::ImageButton* show_apps_button_; | |
| 82 | |
| 83 scoped_ptr<ShellDelegate> delegate_; | 71 scoped_ptr<ShellDelegate> delegate_; |
| 84 | 72 |
| 85 DISALLOW_COPY_AND_ASSIGN(Shell); | 73 DISALLOW_COPY_AND_ASSIGN(Shell); |
| 86 }; | 74 }; |
| 87 | 75 |
| 88 } // namespace aura_shell | 76 } // namespace aura_shell |
| 89 | 77 |
| 90 #endif // UI_AURA_SHELL_SHELL_H_ | 78 #endif // UI_AURA_SHELL_SHELL_H_ |
| OLD | NEW |