summaryrefslogtreecommitdiffstats
path: root/ui/aura_shell/shell.h
blob: 2d1107cd6d822a3685a22c7cb1ca68dea6426829 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef UI_AURA_SHELL_SHELL_H_
#define UI_AURA_SHELL_SHELL_H_
#pragma once

#include <utility>
#include <vector>

#include "base/task.h"
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "ui/aura/desktop_delegate.h"

namespace aura {
class Window;
}
namespace gfx{
class Rect;
}

namespace aura_shell {

// Shell is a singleton object that presents the Shell API and implements the
// Desktop's delegate interface.
class Shell : public aura::DesktopDelegate {
 public:
  // Upon creation, the Shell sets itself as the Desktop's delegate, which takes
  // ownership of the Shell.
  Shell();
  virtual ~Shell();

  static Shell* GetInstance();

  void Init();

  aura::Window* GetContainer(int container_id);
  const aura::Window* GetContainer(int container_id) const;

  void TileWindows();
  void RestoreTiledWindows();

 private:
  typedef std::pair<aura::Window*, gfx::Rect> WindowAndBoundsPair;

  // Overridden from aura::DesktopDelegate:
  virtual void AddChildToDefaultParent(aura::Window* window) OVERRIDE;
  virtual aura::Window* GetTopmostWindowToActivate(
      aura::Window* ignore) const OVERRIDE;

  static Shell* instance_;

  std::vector<WindowAndBoundsPair> to_restore_;

  ScopedRunnableMethodFactory<Shell> method_factory_;

  DISALLOW_COPY_AND_ASSIGN(Shell);
};

}  // namespace aura_shell

#endif  // UI_AURA_SHELL_SHELL_H_