Re-enable these tests as they are no longer failing.
[chromium-blink-merge.git] / ash / shell.h
blobb1467543d158c29c05002928cc3f89b84d5c33d3
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
3 // found in the LICENSE file.
5 #ifndef ASH_SHELL_H_
6 #define ASH_SHELL_H_
7 #pragma once
9 #include <utility>
10 #include <vector>
12 #include "ash/ash_export.h"
13 #include "base/basictypes.h"
14 #include "base/gtest_prod_util.h"
15 #include "base/memory/scoped_ptr.h"
16 #include "base/task.h"
17 #include "base/compiler_specific.h"
18 #include "base/memory/weak_ptr.h"
20 class CommandLine;
22 namespace aura {
23 class EventFilter;
24 class RootWindow;
25 class Window;
27 namespace gfx {
28 class Rect;
29 class Size;
32 namespace ash {
34 class AcceleratorController;
35 class Launcher;
36 class ShellDelegate;
38 namespace internal {
39 class ActivationController;
40 class AcceleratorFilter;
41 class AppList;
42 class DragDropController;
43 class InputMethodEventFilter;
44 class ShadowController;
45 class StackingController;
46 class TooltipController;
47 class WorkspaceController;
50 // Shell is a singleton object that presents the Shell API and implements the
51 // RootWindow's delegate interface.
52 class ASH_EXPORT Shell {
53 public:
54 // Upon creation, the Shell sets itself as the RootWindow's delegate, which
55 // takes ownership of the Shell.
57 // A shell must be explicitly created so that it can call |Init()| with the
58 // delegate set. |delegate| can be NULL (if not required for initialization).
59 static Shell* CreateInstance(ShellDelegate* delegate);
61 // Should never be called before |CreateInstance()|.
62 static Shell* GetInstance();
64 static void DeleteInstance();
66 aura::Window* GetContainer(int container_id);
67 const aura::Window* GetContainer(int container_id) const;
69 // Adds or removes |filter| from the RootWindowEventFilter.
70 void AddRootWindowEventFilter(aura::EventFilter* filter);
71 void RemoveRootWindowEventFilter(aura::EventFilter* filter);
72 size_t GetRootWindowEventFilterCount() const;
74 // Toggles between overview mode and normal mode.
75 void ToggleOverview();
77 // Toggles app list.
78 void ToggleAppList();
80 // Returns true if the screen is locked.
81 bool IsScreenLocked() const;
83 AcceleratorController* accelerator_controller() {
84 return accelerator_controller_.get();
87 internal::TooltipController* tooltip_controller() {
88 return tooltip_controller_.get();
91 ShellDelegate* delegate() { return delegate_.get(); }
93 // May return NULL if we're not using a launcher (e.g. laptop-mode).
94 Launcher* launcher() { return launcher_.get(); }
96 // Made available for tests.
97 internal::ShadowController* shadow_controller() {
98 return shadow_controller_.get();
101 private:
102 FRIEND_TEST_ALL_PREFIXES(ShellTest, DefaultToCompactWindowMode);
104 typedef std::pair<aura::Window*, gfx::Rect> WindowAndBoundsPair;
106 explicit Shell(ShellDelegate* delegate);
107 virtual ~Shell();
109 void Init();
111 // Returns true if the |monitor_size| is narrow and the user has not set
112 // an explicit window mode flag on the |command_line|.
113 bool DefaultToCompactWindowMode(const gfx::Size& monitor_size,
114 CommandLine* command_line) const;
116 void InitLayoutManagers(aura::RootWindow* root_window);
118 // Enables WorkspaceManager.
119 void EnableWorkspaceManager();
121 static Shell* instance_;
123 std::vector<WindowAndBoundsPair> to_restore_;
125 base::WeakPtrFactory<Shell> method_factory_;
127 scoped_ptr<AcceleratorController> accelerator_controller_;
129 scoped_ptr<ShellDelegate> delegate_;
131 scoped_ptr<Launcher> launcher_;
133 scoped_ptr<internal::AppList> app_list_;
135 scoped_ptr<internal::StackingController> stacking_controller_;
136 scoped_ptr<internal::ActivationController> activation_controller_;
137 scoped_ptr<internal::DragDropController> drag_drop_controller_;
138 scoped_ptr<internal::WorkspaceController> workspace_controller_;
139 scoped_ptr<internal::ShadowController> shadow_controller_;
140 scoped_ptr<internal::TooltipController> tooltip_controller_;
142 // An event filter that pre-handles all key events to send them to an IME.
143 scoped_ptr<internal::InputMethodEventFilter> input_method_filter_;
144 // An event filter that pre-handles global accelerators.
145 scoped_ptr<internal::AcceleratorFilter> accelerator_filter_;
148 DISALLOW_COPY_AND_ASSIGN(Shell);
151 } // namespace ash
153 #endif // ASH_SHELL_H_