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

Side by Side Diff: ash/wm/panel_layout_manager.h

Issue 9808026: Layout panels on top of their launcher icons (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ununsed constanrs removed Created 8 years, 9 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 ASH_WM_PANEL_LAYOUT_MANAGER_H_ 5 #ifndef ASH_WM_PANEL_LAYOUT_MANAGER_H_
6 #define ASH_WM_PANEL_LAYOUT_MANAGER_H_ 6 #define ASH_WM_PANEL_LAYOUT_MANAGER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <list> 9 #include <list>
10 10
11 #include "ash/ash_export.h" 11 #include "ash/ash_export.h"
12 #include "ash/launcher/launcher_icons_observer.h"
12 #include "base/basictypes.h" 13 #include "base/basictypes.h"
13 #include "base/compiler_specific.h" 14 #include "base/compiler_specific.h"
15 #include "base/memory/scoped_ptr.h"
14 #include "ui/aura/layout_manager.h" 16 #include "ui/aura/layout_manager.h"
17 #include "ui/aura/window_observer.h"
15 18
16 namespace aura { 19 namespace aura {
17 class Window; 20 class Window;
18 } 21 }
19 22
20 namespace gfx { 23 namespace gfx {
21 class Rect; 24 class Rect;
22 } 25 }
23 26
24 namespace ash { 27 namespace ash {
28 class Launcher;
29
25 namespace internal { 30 namespace internal {
26 31
27 // PanelLayoutManager is responsible for organizing panels within the 32 // PanelLayoutManager is responsible for organizing panels within the
28 // workspace. It is associated with a specific container window (i.e. 33 // workspace. It is associated with a specific container window (i.e.
29 // kShellWindowId_PanelContainer) and controls the layout of any windows 34 // kShellWindowId_PanelContainer) and controls the layout of any windows
30 // added to that container. 35 // added to that container.
31 // 36 //
32 // The constructor takes a |panel_container| argument which is expected to set 37 // The constructor takes a |panel_container| argument which is expected to set
33 // its layout manager to this instance, e.g.: 38 // its layout manager to this instance, e.g.:
34 // panel_container->SetLayoutManager(new PanelLayoutManager(panel_container)); 39 // panel_container->SetLayoutManager(new PanelLayoutManager(panel_container));
35 40
36 class ASH_EXPORT PanelLayoutManager : public aura::LayoutManager { 41 class ASH_EXPORT PanelLayoutManager : public aura::LayoutManager {
37 public: 42 public:
38 explicit PanelLayoutManager(aura::Window* panel_container); 43 explicit PanelLayoutManager(aura::Window* panel_container);
39 virtual ~PanelLayoutManager(); 44 virtual ~PanelLayoutManager();
40 45
41 void StartDragging(aura::Window* panel); 46 void StartDragging(aura::Window* panel);
42 void FinishDragging(); 47 void FinishDragging();
43 48
44 void ToggleMinimize(aura::Window* panel); 49 void ToggleMinimize(aura::Window* panel);
45 50
51 void SetLauncher(ash::Launcher* launcher);
sky 2012/03/23 21:41:14 If this positions things above the launcher, doesn
52
46 // Overridden from aura::LayoutManager: 53 // Overridden from aura::LayoutManager:
47 virtual void OnWindowResized() OVERRIDE; 54 virtual void OnWindowResized() OVERRIDE;
48 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE; 55 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE;
49 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE; 56 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE;
50 virtual void OnChildWindowVisibilityChanged(aura::Window* child, 57 virtual void OnChildWindowVisibilityChanged(aura::Window* child,
51 bool visibile) OVERRIDE; 58 bool visibile) OVERRIDE;
52 virtual void SetChildBounds(aura::Window* child, 59 virtual void SetChildBounds(aura::Window* child,
53 const gfx::Rect& requested_bounds) OVERRIDE; 60 const gfx::Rect& requested_bounds) OVERRIDE;
54 61
55 private: 62 private:
63 class LauncherIconsObserver : public ash::LauncherIconsObserver {
sky 2012/03/23 21:41:14 Don't inline all this.
64 public:
65 LauncherIconsObserver(PanelLayoutManager* layout_manager)
66 : layout_manager_(layout_manager) {}
sky 2012/03/23 21:41:14 indent 4.
67
68 virtual void OnLauncherIconPositionsChanged() OVERRIDE {
69 layout_manager_->Relayout();
70 }
71 private:
72 PanelLayoutManager* layout_manager_;
73 };
74
56 typedef std::list<aura::Window*> PanelList; 75 typedef std::list<aura::Window*> PanelList;
57 76
58 // Called whenever the panel layout might change. 77 // Called whenever the panel layout might change.
59 void Relayout(); 78 void Relayout();
60 79
61 // Parent window associated with this layout manager. 80 // Parent window associated with this layout manager.
62 aura::Window* panel_container_; 81 aura::Window* panel_container_;
63 // Protect against recursive calls to Relayout(). 82 // Protect against recursive calls to Relayout().
64 bool in_layout_; 83 bool in_layout_;
65 // Ordered list of unowned pointers to panel windows. 84 // Ordered list of unowned pointers to panel windows.
66 PanelList panel_windows_; 85 PanelList panel_windows_;
67 86
68 aura::Window* dragged_panel_; 87 aura::Window* dragged_panel_;
69 88
89 LauncherIconsObserver launcher_icons_observer_;
90
70 DISALLOW_COPY_AND_ASSIGN(PanelLayoutManager); 91 DISALLOW_COPY_AND_ASSIGN(PanelLayoutManager);
71 }; 92 };
72 93
73 } // namespace internal 94 } // namespace internal
74 } // namespace ash 95 } // namespace ash
75 96
76 #endif // ASH_WM_PANEL_LAYOUT_MANAGER_H_ 97 #endif // ASH_WM_PANEL_LAYOUT_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698