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> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/task.h" | 14 #include "base/task.h" |
15 #include "base/compiler_specific.h" | 15 #include "base/compiler_specific.h" |
16 #include "base/memory/weak_ptr.h" | 16 #include "base/memory/weak_ptr.h" |
17 #include "ui/aura_shell/aura_shell_export.h" | 17 #include "ui/aura_shell/aura_shell_export.h" |
18 | 18 |
19 namespace aura { | 19 namespace aura { |
20 class EventFilter; | 20 class EventFilter; |
21 class Window; | 21 class Window; |
22 } | 22 } |
23 namespace gfx { | 23 namespace gfx { |
24 class Rect; | 24 class Rect; |
25 } | 25 } |
| 26 namespace views { |
| 27 class Widget; |
| 28 } |
26 | 29 |
27 namespace aura_shell { | 30 namespace aura_shell { |
28 | 31 |
29 class Launcher; | 32 class Launcher; |
30 class ShellDelegate; | 33 class ShellDelegate; |
31 | 34 |
32 namespace internal { | 35 namespace internal { |
33 class ShelfLayoutController; | 36 class ShelfLayoutController; |
34 class WorkspaceController; | 37 class WorkspaceController; |
35 } | 38 } |
36 | 39 |
37 // Shell is a singleton object that presents the Shell API and implements the | 40 // Shell is a singleton object that presents the Shell API and implements the |
38 // Desktop's delegate interface. | 41 // Desktop's delegate interface. |
39 class AURA_SHELL_EXPORT Shell { | 42 class AURA_SHELL_EXPORT Shell { |
40 public: | 43 public: |
41 // Upon creation, the Shell sets itself as the Desktop's delegate, which takes | 44 // Upon creation, the Shell sets itself as the Desktop's delegate, which takes |
42 // ownership of the Shell. | 45 // ownership of the Shell. |
43 | 46 |
44 // A shell must be explicitly created so that it can call |Init()| with the | 47 // A shell must be explicitly created so that it can call |Init()| with the |
45 // delegate set. |delegate| can be NULL (if not required for initialization). | 48 // delegate set. |delegate| can be NULL (if not required for initialization). |
46 static Shell* CreateInstance(ShellDelegate* delegate); | 49 static Shell* CreateInstance(ShellDelegate* delegate); |
47 | 50 |
48 // Should never be called before |CreateInstance()|. | 51 // Should never be called before |CreateInstance()|. |
49 static Shell* GetInstance(); | 52 static Shell* GetInstance(); |
50 | 53 |
51 static void DeleteInstanceForTesting(); | 54 static void DeleteInstanceForTesting(); |
52 | 55 |
| 56 ShellDelegate* delegate() { return delegate_.get(); } |
| 57 Launcher* launcher() { return launcher_.get(); } |
| 58 |
53 aura::Window* GetContainer(int container_id); | 59 aura::Window* GetContainer(int container_id); |
54 const aura::Window* GetContainer(int container_id) const; | 60 const aura::Window* GetContainer(int container_id) const; |
55 | 61 |
56 // Adds or removes |filter| from the DesktopEventFilter. | 62 // Adds or removes |filter| from the DesktopEventFilter. |
57 void AddDesktopEventFilter(aura::EventFilter* filter); | 63 void AddDesktopEventFilter(aura::EventFilter* filter); |
58 void RemoveDesktopEventFilter(aura::EventFilter* filter); | 64 void RemoveDesktopEventFilter(aura::EventFilter* filter); |
59 | 65 |
60 // Toggles between overview mode and normal mode. | 66 // Toggles between overview mode and normal mode. |
61 void ToggleOverview(); | 67 void ToggleOverview(); |
62 | 68 |
63 ShellDelegate* delegate() { return delegate_.get(); } | 69 views::Widget* GetStatusAreaWidget(); |
64 Launcher* launcher() { return launcher_.get(); } | |
65 | 70 |
66 private: | 71 private: |
67 typedef std::pair<aura::Window*, gfx::Rect> WindowAndBoundsPair; | 72 typedef std::pair<aura::Window*, gfx::Rect> WindowAndBoundsPair; |
68 | 73 |
69 explicit Shell(ShellDelegate* delegate); | 74 explicit Shell(ShellDelegate* delegate); |
70 virtual ~Shell(); | 75 virtual ~Shell(); |
71 | 76 |
72 void Init(); | 77 void Init(); |
73 | 78 |
74 // Enables WorkspaceManager. | 79 // Enables WorkspaceManager. |
(...skipping 11 matching lines...) Expand all Loading... |
86 | 91 |
87 scoped_ptr<internal::WorkspaceController> workspace_controller_; | 92 scoped_ptr<internal::WorkspaceController> workspace_controller_; |
88 scoped_ptr<internal::ShelfLayoutController> shelf_layout_controller_; | 93 scoped_ptr<internal::ShelfLayoutController> shelf_layout_controller_; |
89 | 94 |
90 DISALLOW_COPY_AND_ASSIGN(Shell); | 95 DISALLOW_COPY_AND_ASSIGN(Shell); |
91 }; | 96 }; |
92 | 97 |
93 } // namespace aura_shell | 98 } // namespace aura_shell |
94 | 99 |
95 #endif // UI_AURA_SHELL_SHELL_H_ | 100 #endif // UI_AURA_SHELL_SHELL_H_ |
OLD | NEW |