blob: 75643c558c75ae3b6aa2cb766d880dd1f484b804 [file] [log] [blame]
[email protected]87b0d82e2011-10-07 21:02:591// 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.
4
5#ifndef UI_AURA_SHELL_SHELL_H_
6#define UI_AURA_SHELL_SHELL_H_
7#pragma once
8
[email protected]cac10fc62011-10-07 23:22:569#include <utility>
10#include <vector>
11
[email protected]87b0d82e2011-10-07 21:02:5912#include "base/basictypes.h"
[email protected]2b99f8c2011-10-11 19:42:2413#include "base/memory/scoped_ptr.h"
14#include "base/task.h"
[email protected]87b0d82e2011-10-07 21:02:5915#include "base/compiler_specific.h"
[email protected]f296be72011-10-11 15:40:0016#include "base/memory/weak_ptr.h"
[email protected]18d237872011-10-08 02:22:5117#include "ui/aura_shell/aura_shell_export.h"
[email protected]87b0d82e2011-10-07 21:02:5918
19namespace aura {
[email protected]e29014c2011-11-16 18:25:5120class EventFilter;
[email protected]87b0d82e2011-10-07 21:02:5921class Window;
22}
[email protected]2b99f8c2011-10-11 19:42:2423namespace gfx {
[email protected]cac10fc62011-10-07 23:22:5624class Rect;
25}
[email protected]87b0d82e2011-10-07 21:02:5926
27namespace aura_shell {
28
[email protected]671a2ae2011-10-13 21:53:2329class Launcher;
[email protected]2b99f8c2011-10-11 19:42:2430class ShellDelegate;
[email protected]60fa9bba2011-10-28 21:21:5131
32namespace internal {
[email protected]ae18b9112011-11-07 16:59:1333class ShelfLayoutController;
[email protected]60fa9bba2011-10-28 21:21:5134class WorkspaceController;
35}
[email protected]2b99f8c2011-10-11 19:42:2436
[email protected]87b0d82e2011-10-07 21:02:5937// Shell is a singleton object that presents the Shell API and implements the
38// Desktop's delegate interface.
[email protected]6377a002011-11-10 20:26:4739class AURA_SHELL_EXPORT Shell {
[email protected]87b0d82e2011-10-07 21:02:5940 public:
41 // Upon creation, the Shell sets itself as the Desktop's delegate, which takes
42 // ownership of the Shell.
[email protected]87b0d82e2011-10-07 21:02:5943
[email protected]3266c2b92011-11-14 00:06:0844 // 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).
46 static Shell* CreateInstance(ShellDelegate* delegate);
47
48 // Should never be called before |CreateInstance()|.
[email protected]cac10fc62011-10-07 23:22:5649 static Shell* GetInstance();
[email protected]3266c2b92011-11-14 00:06:0850
[email protected]6377a002011-11-10 20:26:4751 static void DeleteInstanceForTesting();
[email protected]cac10fc62011-10-07 23:22:5652
[email protected]87b0d82e2011-10-07 21:02:5953 aura::Window* GetContainer(int container_id);
54 const aura::Window* GetContainer(int container_id) const;
55
[email protected]e29014c2011-11-16 18:25:5156 // Adds or removes |filter| from the DesktopEventFilter.
57 void AddDesktopEventFilter(aura::EventFilter* filter);
58 void RemoveDesktopEventFilter(aura::EventFilter* filter);
59
[email protected]ca4ed122011-10-26 05:40:0160 // Toggles between overview mode and normal mode.
61 void ToggleOverview();
[email protected]cac10fc62011-10-07 23:22:5662
[email protected]3266c2b92011-11-14 00:06:0863 ShellDelegate* delegate() { return delegate_.get(); }
[email protected]671a2ae2011-10-13 21:53:2364 Launcher* launcher() { return launcher_.get(); }
65
[email protected]cac10fc62011-10-07 23:22:5666 private:
67 typedef std::pair<aura::Window*, gfx::Rect> WindowAndBoundsPair;
68
[email protected]3266c2b92011-11-14 00:06:0869 explicit Shell(ShellDelegate* delegate);
70 virtual ~Shell();
71
72 void Init();
73
[email protected]46ca3632011-11-03 03:33:4274 // Enables WorkspaceManager.
75 void EnableWorkspaceManager();
76
[email protected]cac10fc62011-10-07 23:22:5677 static Shell* instance_;
78
79 std::vector<WindowAndBoundsPair> to_restore_;
80
[email protected]f296be72011-10-11 15:40:0081 base::WeakPtrFactory<Shell> method_factory_;
[email protected]cac10fc62011-10-07 23:22:5682
[email protected]2b99f8c2011-10-11 19:42:2483 scoped_ptr<ShellDelegate> delegate_;
84
[email protected]671a2ae2011-10-13 21:53:2385 scoped_ptr<Launcher> launcher_;
86
[email protected]60fa9bba2011-10-28 21:21:5187 scoped_ptr<internal::WorkspaceController> workspace_controller_;
[email protected]ae18b9112011-11-07 16:59:1388 scoped_ptr<internal::ShelfLayoutController> shelf_layout_controller_;
89
[email protected]87b0d82e2011-10-07 21:02:5990 DISALLOW_COPY_AND_ASSIGN(Shell);
91};
92
93} // namespace aura_shell
94
95#endif // UI_AURA_SHELL_SHELL_H_