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 ShellAcceleratorController; | 33 class ShellAcceleratorController; |
31 class ShellDelegate; | 34 class ShellDelegate; |
32 | 35 |
33 namespace internal { | 36 namespace internal { |
34 class DragDropController; | 37 class DragDropController; |
35 class ShelfLayoutController; | 38 class ShelfLayoutController; |
36 class WorkspaceController; | 39 class WorkspaceController; |
37 } | 40 } |
38 | 41 |
39 // Shell is a singleton object that presents the Shell API and implements the | 42 // Shell is a singleton object that presents the Shell API and implements the |
40 // Desktop's delegate interface. | 43 // Desktop's delegate interface. |
41 class AURA_SHELL_EXPORT Shell { | 44 class AURA_SHELL_EXPORT Shell { |
42 public: | 45 public: |
43 // Upon creation, the Shell sets itself as the Desktop's delegate, which takes | 46 // Upon creation, the Shell sets itself as the Desktop's delegate, which takes |
44 // ownership of the Shell. | 47 // ownership of the Shell. |
45 | 48 |
46 // A shell must be explicitly created so that it can call |Init()| with the | 49 // A shell must be explicitly created so that it can call |Init()| with the |
47 // delegate set. |delegate| can be NULL (if not required for initialization). | 50 // delegate set. |delegate| can be NULL (if not required for initialization). |
48 static Shell* CreateInstance(ShellDelegate* delegate); | 51 static Shell* CreateInstance(ShellDelegate* delegate); |
49 | 52 |
50 // Should never be called before |CreateInstance()|. | 53 // Should never be called before |CreateInstance()|. |
51 static Shell* GetInstance(); | 54 static Shell* GetInstance(); |
52 | 55 |
53 static void DeleteInstanceForTesting(); | 56 static void DeleteInstanceForTesting(); |
54 | 57 |
58 ShellAcceleratorController* accelerator_controller() { | |
59 return accelerator_controller_.get(); | |
60 } | |
61 ShellDelegate* delegate() { return delegate_.get(); } | |
62 Launcher* launcher() { return launcher_.get(); } | |
63 | |
55 aura::Window* GetContainer(int container_id); | 64 aura::Window* GetContainer(int container_id); |
56 const aura::Window* GetContainer(int container_id) const; | 65 const aura::Window* GetContainer(int container_id) const; |
57 | 66 |
58 // Adds or removes |filter| from the DesktopEventFilter. | 67 // Adds or removes |filter| from the DesktopEventFilter. |
59 void AddDesktopEventFilter(aura::EventFilter* filter); | 68 void AddDesktopEventFilter(aura::EventFilter* filter); |
60 void RemoveDesktopEventFilter(aura::EventFilter* filter); | 69 void RemoveDesktopEventFilter(aura::EventFilter* filter); |
61 | 70 |
62 // Toggles between overview mode and normal mode. | 71 // Toggles between overview mode and normal mode. |
63 void ToggleOverview(); | 72 void ToggleOverview(); |
64 | 73 |
65 ShellAcceleratorController* accelerator_controller() { | 74 views::Widget* GetStatusAreaWidget(); |
Ben Goodger (Google)
2011/11/18 20:31:17
Add ForTesting() to the method name, so that it's
| |
66 return accelerator_controller_.get(); | |
67 } | |
68 ShellDelegate* delegate() { return delegate_.get(); } | |
69 Launcher* launcher() { return launcher_.get(); } | |
70 | 75 |
71 private: | 76 private: |
72 typedef std::pair<aura::Window*, gfx::Rect> WindowAndBoundsPair; | 77 typedef std::pair<aura::Window*, gfx::Rect> WindowAndBoundsPair; |
73 | 78 |
74 explicit Shell(ShellDelegate* delegate); | 79 explicit Shell(ShellDelegate* delegate); |
75 virtual ~Shell(); | 80 virtual ~Shell(); |
76 | 81 |
77 void Init(); | 82 void Init(); |
78 | 83 |
79 // Enables WorkspaceManager. | 84 // Enables WorkspaceManager. |
(...skipping 14 matching lines...) Expand all Loading... | |
94 scoped_ptr<internal::DragDropController> drag_drop_controller_; | 99 scoped_ptr<internal::DragDropController> drag_drop_controller_; |
95 scoped_ptr<internal::WorkspaceController> workspace_controller_; | 100 scoped_ptr<internal::WorkspaceController> workspace_controller_; |
96 scoped_ptr<internal::ShelfLayoutController> shelf_layout_controller_; | 101 scoped_ptr<internal::ShelfLayoutController> shelf_layout_controller_; |
97 | 102 |
98 DISALLOW_COPY_AND_ASSIGN(Shell); | 103 DISALLOW_COPY_AND_ASSIGN(Shell); |
99 }; | 104 }; |
100 | 105 |
101 } // namespace aura_shell | 106 } // namespace aura_shell |
102 | 107 |
103 #endif // UI_AURA_SHELL_SHELL_H_ | 108 #endif // UI_AURA_SHELL_SHELL_H_ |
OLD | NEW |