| 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 <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 class ShelfLayoutController; | 32 class ShelfLayoutController; |
| 33 class WorkspaceController; | 33 class WorkspaceController; |
| 34 } | 34 } |
| 35 | 35 |
| 36 // Shell is a singleton object that presents the Shell API and implements the | 36 // Shell is a singleton object that presents the Shell API and implements the |
| 37 // Desktop's delegate interface. | 37 // Desktop's delegate interface. |
| 38 class AURA_SHELL_EXPORT Shell { | 38 class AURA_SHELL_EXPORT Shell { |
| 39 public: | 39 public: |
| 40 // Upon creation, the Shell sets itself as the Desktop's delegate, which takes | 40 // Upon creation, the Shell sets itself as the Desktop's delegate, which takes |
| 41 // ownership of the Shell. | 41 // ownership of the Shell. |
| 42 Shell(); | |
| 43 virtual ~Shell(); | |
| 44 | 42 |
| 43 // A shell must be explicitly created so that it can call |Init()| with the |
| 44 // delegate set. |delegate| can be NULL (if not required for initialization). |
| 45 static Shell* CreateInstance(ShellDelegate* delegate); |
| 46 |
| 47 // Should never be called before |CreateInstance()|. |
| 45 static Shell* GetInstance(); | 48 static Shell* GetInstance(); |
| 49 |
| 46 static void DeleteInstanceForTesting(); | 50 static void DeleteInstanceForTesting(); |
| 47 | 51 |
| 48 void Init(); | |
| 49 | |
| 50 // Sets the delegate. Shell owns its delegate. | |
| 51 void SetDelegate(ShellDelegate* delegate); | |
| 52 ShellDelegate* delegate() { return delegate_.get(); } | |
| 53 | |
| 54 aura::Window* GetContainer(int container_id); | 52 aura::Window* GetContainer(int container_id); |
| 55 const aura::Window* GetContainer(int container_id) const; | 53 const aura::Window* GetContainer(int container_id) const; |
| 56 | 54 |
| 57 // Toggles between overview mode and normal mode. | 55 // Toggles between overview mode and normal mode. |
| 58 void ToggleOverview(); | 56 void ToggleOverview(); |
| 59 | 57 |
| 58 ShellDelegate* delegate() { return delegate_.get(); } |
| 60 Launcher* launcher() { return launcher_.get(); } | 59 Launcher* launcher() { return launcher_.get(); } |
| 61 | 60 |
| 62 private: | 61 private: |
| 63 typedef std::pair<aura::Window*, gfx::Rect> WindowAndBoundsPair; | 62 typedef std::pair<aura::Window*, gfx::Rect> WindowAndBoundsPair; |
| 64 | 63 |
| 64 explicit Shell(ShellDelegate* delegate); |
| 65 virtual ~Shell(); |
| 66 |
| 67 void Init(); |
| 68 |
| 65 // Enables WorkspaceManager. | 69 // Enables WorkspaceManager. |
| 66 void EnableWorkspaceManager(); | 70 void EnableWorkspaceManager(); |
| 67 | 71 |
| 68 static Shell* instance_; | 72 static Shell* instance_; |
| 69 | 73 |
| 70 std::vector<WindowAndBoundsPair> to_restore_; | 74 std::vector<WindowAndBoundsPair> to_restore_; |
| 71 | 75 |
| 72 base::WeakPtrFactory<Shell> method_factory_; | 76 base::WeakPtrFactory<Shell> method_factory_; |
| 73 | 77 |
| 74 scoped_ptr<ShellDelegate> delegate_; | 78 scoped_ptr<ShellDelegate> delegate_; |
| 75 | 79 |
| 76 scoped_ptr<Launcher> launcher_; | 80 scoped_ptr<Launcher> launcher_; |
| 77 | 81 |
| 78 scoped_ptr<internal::WorkspaceController> workspace_controller_; | 82 scoped_ptr<internal::WorkspaceController> workspace_controller_; |
| 79 scoped_ptr<internal::ShelfLayoutController> shelf_layout_controller_; | 83 scoped_ptr<internal::ShelfLayoutController> shelf_layout_controller_; |
| 80 | 84 |
| 81 DISALLOW_COPY_AND_ASSIGN(Shell); | 85 DISALLOW_COPY_AND_ASSIGN(Shell); |
| 82 }; | 86 }; |
| 83 | 87 |
| 84 } // namespace aura_shell | 88 } // namespace aura_shell |
| 85 | 89 |
| 86 #endif // UI_AURA_SHELL_SHELL_H_ | 90 #endif // UI_AURA_SHELL_SHELL_H_ |
| OLD | NEW |