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 | 26 |
27 namespace aura_shell { | 27 namespace aura_shell { |
28 | 28 |
29 class Launcher; | 29 class Launcher; |
| 30 class ShellAcceleratorController; |
30 class ShellDelegate; | 31 class ShellDelegate; |
31 | 32 |
32 namespace internal { | 33 namespace internal { |
33 class AppList; | 34 class AppList; |
34 class DragDropController; | 35 class DragDropController; |
35 class ShadowController; | 36 class ShadowController; |
36 class ShelfLayoutController; | 37 class ShelfLayoutController; |
| 38 class ShellAcceleratorFilter; |
37 class WorkspaceController; | 39 class WorkspaceController; |
38 } | 40 } |
39 | 41 |
40 // 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 |
41 // Desktop's delegate interface. | 43 // Desktop's delegate interface. |
42 class AURA_SHELL_EXPORT Shell { | 44 class AURA_SHELL_EXPORT Shell { |
43 public: | 45 public: |
44 // 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 |
45 // ownership of the Shell. | 47 // ownership of the Shell. |
46 | 48 |
(...skipping 12 matching lines...) Expand all Loading... |
59 // Adds or removes |filter| from the DesktopEventFilter. | 61 // Adds or removes |filter| from the DesktopEventFilter. |
60 void AddDesktopEventFilter(aura::EventFilter* filter); | 62 void AddDesktopEventFilter(aura::EventFilter* filter); |
61 void RemoveDesktopEventFilter(aura::EventFilter* filter); | 63 void RemoveDesktopEventFilter(aura::EventFilter* filter); |
62 | 64 |
63 // Toggles between overview mode and normal mode. | 65 // Toggles between overview mode and normal mode. |
64 void ToggleOverview(); | 66 void ToggleOverview(); |
65 | 67 |
66 // Toggles app list. | 68 // Toggles app list. |
67 void ToggleAppList(); | 69 void ToggleAppList(); |
68 | 70 |
| 71 ShellAcceleratorController* accelerator_controller() { |
| 72 return accelerator_controller_.get(); |
| 73 } |
| 74 |
69 ShellDelegate* delegate() { return delegate_.get(); } | 75 ShellDelegate* delegate() { return delegate_.get(); } |
70 Launcher* launcher() { return launcher_.get(); } | 76 Launcher* launcher() { return launcher_.get(); } |
71 | 77 |
72 // Made available for tests. | 78 // Made available for tests. |
73 internal::ShadowController* shadow_controller() { | 79 internal::ShadowController* shadow_controller() { |
74 return shadow_controller_.get(); | 80 return shadow_controller_.get(); |
75 } | 81 } |
76 | 82 |
77 private: | 83 private: |
78 typedef std::pair<aura::Window*, gfx::Rect> WindowAndBoundsPair; | 84 typedef std::pair<aura::Window*, gfx::Rect> WindowAndBoundsPair; |
79 | 85 |
80 explicit Shell(ShellDelegate* delegate); | 86 explicit Shell(ShellDelegate* delegate); |
81 virtual ~Shell(); | 87 virtual ~Shell(); |
82 | 88 |
83 void Init(); | 89 void Init(); |
84 | 90 |
85 // Enables WorkspaceManager. | 91 // Enables WorkspaceManager. |
86 void EnableWorkspaceManager(); | 92 void EnableWorkspaceManager(); |
87 | 93 |
88 static Shell* instance_; | 94 static Shell* instance_; |
89 | 95 |
90 std::vector<WindowAndBoundsPair> to_restore_; | 96 std::vector<WindowAndBoundsPair> to_restore_; |
91 | 97 |
92 base::WeakPtrFactory<Shell> method_factory_; | 98 base::WeakPtrFactory<Shell> method_factory_; |
93 | 99 |
| 100 scoped_ptr<ShellAcceleratorController> accelerator_controller_; |
| 101 |
94 scoped_ptr<ShellDelegate> delegate_; | 102 scoped_ptr<ShellDelegate> delegate_; |
95 | 103 |
96 scoped_ptr<Launcher> launcher_; | 104 scoped_ptr<Launcher> launcher_; |
97 | 105 |
98 scoped_ptr<internal::AppList> app_list_; | 106 scoped_ptr<internal::AppList> app_list_; |
99 | 107 |
100 scoped_ptr<internal::DragDropController> drag_drop_controller_; | 108 scoped_ptr<internal::DragDropController> drag_drop_controller_; |
101 scoped_ptr<internal::WorkspaceController> workspace_controller_; | 109 scoped_ptr<internal::WorkspaceController> workspace_controller_; |
102 scoped_ptr<internal::ShelfLayoutController> shelf_layout_controller_; | 110 scoped_ptr<internal::ShelfLayoutController> shelf_layout_controller_; |
103 scoped_ptr<internal::ShadowController> shadow_controller_; | 111 scoped_ptr<internal::ShadowController> shadow_controller_; |
104 | 112 |
| 113 // An event filter that pre-handles global accelerators. |
| 114 scoped_ptr<internal::ShellAcceleratorFilter> accelerator_filter_; |
| 115 |
105 DISALLOW_COPY_AND_ASSIGN(Shell); | 116 DISALLOW_COPY_AND_ASSIGN(Shell); |
106 }; | 117 }; |
107 | 118 |
108 } // namespace aura_shell | 119 } // namespace aura_shell |
109 | 120 |
110 #endif // UI_AURA_SHELL_SHELL_H_ | 121 #endif // UI_AURA_SHELL_SHELL_H_ |
OLD | NEW |