Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Side by Side Diff: ui/aura_shell/shell.h

Issue 8247012: Positions the launcher in the bottom left corner. Adds ShellDelegate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Tweaks Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/aura_shell/launcher/launcher_view.cc ('k') | ui/aura_shell/shell.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/desktop_delegate.h" 17 #include "ui/aura/desktop_delegate.h"
18 #include "ui/aura_shell/aura_shell_export.h" 18 #include "ui/aura_shell/aura_shell_export.h"
19 #include "views/controls/button/button.h"
20 19
21 namespace aura { 20 namespace aura {
22 class Window; 21 class Window;
23 } 22 }
24 namespace gfx { 23 namespace gfx {
25 class Rect; 24 class Rect;
26 } 25 }
27 namespace views {
28 class ImageButton;
29 }
30 26
31 namespace aura_shell { 27 namespace aura_shell {
32 28
33 class LauncherModel; 29 class Launcher;
34 class ShellDelegate; 30 class ShellDelegate;
35 31
36 // Shell is a singleton object that presents the Shell API and implements the 32 // Shell is a singleton object that presents the Shell API and implements the
37 // Desktop's delegate interface. 33 // Desktop's delegate interface.
38 class AURA_SHELL_EXPORT Shell : public aura::DesktopDelegate, 34 class AURA_SHELL_EXPORT Shell : public aura::DesktopDelegate {
39 public views::ButtonListener {
40 public: 35 public:
41 // Upon creation, the Shell sets itself as the Desktop's delegate, which takes 36 // Upon creation, the Shell sets itself as the Desktop's delegate, which takes
42 // ownership of the Shell. 37 // ownership of the Shell.
43 Shell(); 38 Shell();
44 virtual ~Shell(); 39 virtual ~Shell();
45 40
46 static Shell* GetInstance(); 41 static Shell* GetInstance();
47 42
48 void Init(); 43 void Init();
49 44
50 // Sets the delegate. Shell owns its delegate. 45 // Sets the delegate. Shell owns its delegate.
51 void SetDelegate(ShellDelegate* delegate); 46 void SetDelegate(ShellDelegate* delegate);
47 ShellDelegate* delegate() { return delegate_.get(); }
52 48
53 aura::Window* GetContainer(int container_id); 49 aura::Window* GetContainer(int container_id);
54 const aura::Window* GetContainer(int container_id) const; 50 const aura::Window* GetContainer(int container_id) const;
55 51
56 void TileWindows(); 52 void TileWindows();
57 void RestoreTiledWindows(); 53 void RestoreTiledWindows();
58 54
55 Launcher* launcher() { return launcher_.get(); }
56
59 private: 57 private:
60 typedef std::pair<aura::Window*, gfx::Rect> WindowAndBoundsPair; 58 typedef std::pair<aura::Window*, gfx::Rect> WindowAndBoundsPair;
61 59
62 void InitLauncherModel();
63
64 // Overridden from aura::DesktopDelegate: 60 // Overridden from aura::DesktopDelegate:
65 virtual void AddChildToDefaultParent(aura::Window* window) OVERRIDE; 61 virtual void AddChildToDefaultParent(aura::Window* window) OVERRIDE;
66 virtual aura::Window* GetTopmostWindowToActivate( 62 virtual aura::Window* GetTopmostWindowToActivate(
67 aura::Window* ignore) const OVERRIDE; 63 aura::Window* ignore) const OVERRIDE;
68 64
69 // Overriden from views::ButtonListener:
70 virtual void ButtonPressed(views::Button* sender,
71 const views::Event& event) OVERRIDE;
72
73 static Shell* instance_; 65 static Shell* instance_;
74 66
75 std::vector<WindowAndBoundsPair> to_restore_; 67 std::vector<WindowAndBoundsPair> to_restore_;
76 68
77 base::WeakPtrFactory<Shell> method_factory_; 69 base::WeakPtrFactory<Shell> method_factory_;
78 70
79 scoped_ptr<LauncherModel> launcher_model_; 71 scoped_ptr<ShellDelegate> delegate_;
80 views::ImageButton* new_browser_button_;
81 views::ImageButton* show_apps_button_;
82 72
83 scoped_ptr<ShellDelegate> delegate_; 73 scoped_ptr<Launcher> launcher_;
84 74
85 DISALLOW_COPY_AND_ASSIGN(Shell); 75 DISALLOW_COPY_AND_ASSIGN(Shell);
86 }; 76 };
87 77
88 } // namespace aura_shell 78 } // namespace aura_shell
89 79
90 #endif // UI_AURA_SHELL_SHELL_H_ 80 #endif // UI_AURA_SHELL_SHELL_H_
OLDNEW
« no previous file with comments | « ui/aura_shell/launcher/launcher_view.cc ('k') | ui/aura_shell/shell.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698