| OLD | NEW |
| 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 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 | 9 |
| 10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| 11 #include "ash/launcher/launcher_icon_observer.h" | 11 #include "ash/launcher/launcher_icon_observer.h" |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "base/compiler_specific.h" | 13 #include "base/compiler_specific.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/memory/weak_ptr.h" | 15 #include "base/memory/weak_ptr.h" |
| 16 #include "ui/aura/client/activation_change_observer.h" | 16 #include "ui/aura/client/activation_change_observer.h" |
| 17 #include "ui/aura/layout_manager.h" | 17 #include "ui/aura/layout_manager.h" |
| 18 #include "ui/aura/window_observer.h" |
| 18 | 19 |
| 19 namespace aura { | 20 namespace aura { |
| 20 class Window; | 21 class Window; |
| 21 } | 22 } |
| 22 | 23 |
| 23 namespace gfx { | 24 namespace gfx { |
| 24 class Rect; | 25 class Rect; |
| 25 } | 26 } |
| 26 | 27 |
| 27 namespace views { | 28 namespace views { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 38 // kShellWindowId_PanelContainer) and controls the layout of any windows | 39 // kShellWindowId_PanelContainer) and controls the layout of any windows |
| 39 // added to that container. | 40 // added to that container. |
| 40 // | 41 // |
| 41 // The constructor takes a |panel_container| argument which is expected to set | 42 // The constructor takes a |panel_container| argument which is expected to set |
| 42 // its layout manager to this instance, e.g.: | 43 // its layout manager to this instance, e.g.: |
| 43 // panel_container->SetLayoutManager(new PanelLayoutManager(panel_container)); | 44 // panel_container->SetLayoutManager(new PanelLayoutManager(panel_container)); |
| 44 | 45 |
| 45 class ASH_EXPORT PanelLayoutManager | 46 class ASH_EXPORT PanelLayoutManager |
| 46 : public aura::LayoutManager, | 47 : public aura::LayoutManager, |
| 47 public ash::LauncherIconObserver, | 48 public ash::LauncherIconObserver, |
| 49 public aura::WindowObserver, |
| 48 public aura::client::ActivationChangeObserver { | 50 public aura::client::ActivationChangeObserver { |
| 49 public: | 51 public: |
| 50 explicit PanelLayoutManager(aura::Window* panel_container); | 52 explicit PanelLayoutManager(aura::Window* panel_container); |
| 51 virtual ~PanelLayoutManager(); | 53 virtual ~PanelLayoutManager(); |
| 52 | 54 |
| 53 void StartDragging(aura::Window* panel); | 55 void StartDragging(aura::Window* panel); |
| 54 void FinishDragging(); | 56 void FinishDragging(); |
| 55 | 57 |
| 56 void ToggleMinimize(aura::Window* panel); | 58 void ToggleMinimize(aura::Window* panel); |
| 57 | 59 |
| 58 void SetLauncher(ash::Launcher* launcher); | 60 void SetLauncher(ash::Launcher* launcher); |
| 59 | 61 |
| 60 // Overridden from aura::LayoutManager: | 62 // Overridden from aura::LayoutManager: |
| 61 virtual void OnWindowResized() OVERRIDE; | 63 virtual void OnWindowResized() OVERRIDE; |
| 62 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE; | 64 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE; |
| 63 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE; | 65 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE; |
| 64 virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE; | 66 virtual void OnWindowRemovedFromLayout(aura::Window* child) OVERRIDE; |
| 65 virtual void OnChildWindowVisibilityChanged(aura::Window* child, | 67 virtual void OnChildWindowVisibilityChanged(aura::Window* child, |
| 66 bool visibile) OVERRIDE; | 68 bool visibile) OVERRIDE; |
| 67 virtual void SetChildBounds(aura::Window* child, | 69 virtual void SetChildBounds(aura::Window* child, |
| 68 const gfx::Rect& requested_bounds) OVERRIDE; | 70 const gfx::Rect& requested_bounds) OVERRIDE; |
| 69 | 71 |
| 70 // Overridden from ash::LauncherIconObserver | 72 // Overridden from ash::LauncherIconObserver |
| 71 virtual void OnLauncherIconPositionsChanged() OVERRIDE; | 73 virtual void OnLauncherIconPositionsChanged() OVERRIDE; |
| 72 | 74 |
| 75 // Overridden from aura::WindowObserver |
| 76 virtual void OnWindowPropertyChanged(aura::Window* window, |
| 77 const void* key, |
| 78 intptr_t old) OVERRIDE; |
| 79 |
| 73 // Overridden from aura::client::ActivationChangeObserver | 80 // Overridden from aura::client::ActivationChangeObserver |
| 74 virtual void OnWindowActivated(aura::Window* active, | 81 virtual void OnWindowActivated(aura::Window* active, |
| 75 aura::Window* old_active) OVERRIDE; | 82 aura::Window* old_active) OVERRIDE; |
| 76 | 83 |
| 77 private: | 84 private: |
| 78 friend class PanelLayoutManagerTest; | 85 friend class PanelLayoutManagerTest; |
| 79 | 86 |
| 80 typedef std::list<aura::Window*> PanelList; | 87 typedef std::list<aura::Window*> PanelList; |
| 81 | 88 |
| 89 void MinimizePanel(aura::Window* panel); |
| 90 void RestorePanel(aura::Window* panel); |
| 91 |
| 82 // Called whenever the panel layout might change. | 92 // Called whenever the panel layout might change. |
| 83 void Relayout(); | 93 void Relayout(); |
| 84 | 94 |
| 85 // Called whenever the panel stacking order needs to be updated (e.g. focus | 95 // Called whenever the panel stacking order needs to be updated (e.g. focus |
| 86 // changes or a panel is moved). | 96 // changes or a panel is moved). |
| 87 void UpdateStacking(aura::Window* active_panel); | 97 void UpdateStacking(aura::Window* active_panel); |
| 88 | 98 |
| 89 // Trigger a delayed task to update the callout. We use this because | 99 // Trigger a delayed task to update the callout. We use this because |
| 90 // otherwise, ShadowController::OnWindowPropertyChanged may be invoked after | 100 // otherwise, ShadowController::OnWindowPropertyChanged may be invoked after |
| 91 // we've already updated the callout, causing the drop shadow to be stacked on | 101 // we've already updated the callout, causing the drop shadow to be stacked on |
| (...skipping 26 matching lines...) Expand all Loading... |
| 118 scoped_ptr<views::Widget> callout_widget_; | 128 scoped_ptr<views::Widget> callout_widget_; |
| 119 base::WeakPtrFactory<PanelLayoutManager> weak_factory_; | 129 base::WeakPtrFactory<PanelLayoutManager> weak_factory_; |
| 120 | 130 |
| 121 DISALLOW_COPY_AND_ASSIGN(PanelLayoutManager); | 131 DISALLOW_COPY_AND_ASSIGN(PanelLayoutManager); |
| 122 }; | 132 }; |
| 123 | 133 |
| 124 } // namespace internal | 134 } // namespace internal |
| 125 } // namespace ash | 135 } // namespace ash |
| 126 | 136 |
| 127 #endif // ASH_WM_PANEL_LAYOUT_MANAGER_H_ | 137 #endif // ASH_WM_PANEL_LAYOUT_MANAGER_H_ |
| OLD | NEW |