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

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: Patch for review Created 8 years, 8 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"
14 #include "ui/aura/layout_manager.h" 15 #include "ui/aura/layout_manager.h"
15 16
16 namespace aura { 17 namespace aura {
17 class Window; 18 class Window;
18 } 19 }
19 20
20 namespace gfx { 21 namespace gfx {
21 class Rect; 22 class Rect;
22 } 23 }
23 24
24 namespace ash { 25 namespace ash {
26 class Launcher;
27
25 namespace internal { 28 namespace internal {
26 29
27 // PanelLayoutManager is responsible for organizing panels within the 30 // PanelLayoutManager is responsible for organizing panels within the
28 // workspace. It is associated with a specific container window (i.e. 31 // workspace. It is associated with a specific container window (i.e.
29 // kShellWindowId_PanelContainer) and controls the layout of any windows 32 // kShellWindowId_PanelContainer) and controls the layout of any windows
30 // added to that container. 33 // added to that container.
31 // 34 //
32 // The constructor takes a |panel_container| argument which is expected to set 35 // The constructor takes a |panel_container| argument which is expected to set
33 // its layout manager to this instance, e.g.: 36 // its layout manager to this instance, e.g.:
34 // panel_container->SetLayoutManager(new PanelLayoutManager(panel_container)); 37 // panel_container->SetLayoutManager(new PanelLayoutManager(panel_container));
35 38
36 class ASH_EXPORT PanelLayoutManager : public aura::LayoutManager { 39 class ASH_EXPORT PanelLayoutManager : public aura::LayoutManager {
37 public: 40 public:
38 explicit PanelLayoutManager(aura::Window* panel_container); 41 explicit PanelLayoutManager(aura::Window* panel_container);
39 virtual ~PanelLayoutManager(); 42 virtual ~PanelLayoutManager();
40 43
41 void StartDragging(aura::Window* panel); 44 void StartDragging(aura::Window* panel);
42 void FinishDragging(); 45 void FinishDragging();
43 46
44 void ToggleMinimize(aura::Window* panel); 47 void ToggleMinimize(aura::Window* panel);
45 48
49 void SetLauncher(ash::Launcher* launcher);
50
46 // Overridden from aura::LayoutManager: 51 // Overridden from aura::LayoutManager:
47 virtual void OnWindowResized() OVERRIDE; 52 virtual void OnWindowResized() OVERRIDE;
48 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE; 53 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE;
49 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE; 54 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE;
50 virtual void OnChildWindowVisibilityChanged(aura::Window* child, 55 virtual void OnChildWindowVisibilityChanged(aura::Window* child,
51 bool visibile) OVERRIDE; 56 bool visibile) OVERRIDE;
52 virtual void SetChildBounds(aura::Window* child, 57 virtual void SetChildBounds(aura::Window* child,
53 const gfx::Rect& requested_bounds) OVERRIDE; 58 const gfx::Rect& requested_bounds) OVERRIDE;
54 59
55 private: 60 private:
61 class LauncherIconsObserver : public ash::LauncherIconsObserver {
sky 2012/04/03 20:39:37 Any reason you don't make PanelLayoutManager direc
Dmitry Lomov (no reviews) 2012/04/03 20:50:07 The fact that PanelLayoutManager observes launcher
sky 2012/04/03 20:57:18 There are a plethora of classes in Chrome that fit
Dmitry Lomov (no reviews) 2012/04/03 21:18:23 Widespread use of errant practice does not make it
stevenjb 2012/04/03 22:09:29 I have to agree with sky here - we make "correctne
62 public:
63 LauncherIconsObserver(PanelLayoutManager* layout_manager);
64
65 virtual void OnLauncherIconPositionsChanged() OVERRIDE;
66 private:
67 PanelLayoutManager* layout_manager_;
68 };
69
56 typedef std::list<aura::Window*> PanelList; 70 typedef std::list<aura::Window*> PanelList;
57 71
58 // Called whenever the panel layout might change. 72 // Called whenever the panel layout might change.
59 void Relayout(); 73 void Relayout();
60 74
61 // Parent window associated with this layout manager. 75 // Parent window associated with this layout manager.
62 aura::Window* panel_container_; 76 aura::Window* panel_container_;
63 // Protect against recursive calls to Relayout(). 77 // Protect against recursive calls to Relayout().
64 bool in_layout_; 78 bool in_layout_;
65 // Ordered list of unowned pointers to panel windows. 79 // Ordered list of unowned pointers to panel windows.
66 PanelList panel_windows_; 80 PanelList panel_windows_;
67 81
68 aura::Window* dragged_panel_; 82 aura::Window* dragged_panel_;
69 83
84 LauncherIconsObserver launcher_icons_observer_;
85
70 DISALLOW_COPY_AND_ASSIGN(PanelLayoutManager); 86 DISALLOW_COPY_AND_ASSIGN(PanelLayoutManager);
71 }; 87 };
72 88
73 } // namespace internal 89 } // namespace internal
74 } // namespace ash 90 } // namespace ash
75 91
76 #endif // ASH_WM_PANEL_LAYOUT_MANAGER_H_ 92 #endif // ASH_WM_PANEL_LAYOUT_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698