| OLD | NEW |
| 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_DESKTOP_LAYOUT_MANAGER_H_ | 5 #ifndef UI_AURA_SHELL_STATUS_AREA_LAYOUT_MANAGER_H_ |
| 6 #define UI_AURA_SHELL_DESKTOP_LAYOUT_MANAGER_H_ | 6 #define UI_AURA_SHELL_STATUS_AREA_LAYOUT_MANAGER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| 11 #include "ui/aura/layout_manager.h" | 11 #include "ui/aura/layout_manager.h" |
| 12 | 12 |
| 13 namespace aura { | |
| 14 class Window; | |
| 15 } | |
| 16 namespace gfx { | |
| 17 class Rect; | |
| 18 } | |
| 19 namespace views { | |
| 20 class Widget; | |
| 21 } | |
| 22 | |
| 23 namespace aura_shell { | 13 namespace aura_shell { |
| 24 namespace internal { | 14 namespace internal { |
| 25 | 15 |
| 26 class ShelfLayoutController; | 16 class ShelfLayoutManager; |
| 27 | 17 |
| 28 // A layout manager for the root window. | 18 // StatusAreaLayoutManager is a layout manager responsible for the status area. |
| 29 // Resizes all of its immediate children to fill the bounds of the root window. | 19 // In any case when status area needs relayout it redirects this call to |
| 30 class DesktopLayoutManager : public aura::LayoutManager { | 20 // ShelfLayoutManager. |
| 21 class StatusAreaLayoutManager : public aura::LayoutManager { |
| 31 public: | 22 public: |
| 32 explicit DesktopLayoutManager(aura::Window* owner); | 23 explicit StatusAreaLayoutManager(ShelfLayoutManager* shelf); |
| 33 virtual ~DesktopLayoutManager(); | 24 virtual ~StatusAreaLayoutManager(); |
| 34 | |
| 35 void set_shelf(ShelfLayoutController* shelf) { shelf_ = shelf; } | |
| 36 | |
| 37 void set_background_widget(views::Widget* background_widget) { | |
| 38 background_widget_ = background_widget; | |
| 39 } | |
| 40 | 25 |
| 41 // Overridden from aura::LayoutManager: | 26 // Overridden from aura::LayoutManager: |
| 42 virtual void OnWindowResized() OVERRIDE; | 27 virtual void OnWindowResized() OVERRIDE; |
| 43 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE; | 28 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE; |
| 44 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE; | 29 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE; |
| 45 virtual void OnChildWindowVisibilityChanged(aura::Window* child, | 30 virtual void OnChildWindowVisibilityChanged(aura::Window* child, |
| 46 bool visible) OVERRIDE; | 31 bool visible) OVERRIDE; |
| 47 virtual void SetChildBounds(aura::Window* child, | 32 virtual void SetChildBounds(aura::Window* child, |
| 48 const gfx::Rect& requested_bounds) OVERRIDE; | 33 const gfx::Rect& requested_bounds) OVERRIDE; |
| 49 | 34 |
| 50 private: | 35 private: |
| 51 aura::Window* owner_; | 36 // Updates layout of the status area. Effectively calls ShelfLayoutManager |
| 37 // to update layout of the shelf. |
| 38 void LayoutStatusArea(); |
| 52 | 39 |
| 53 views::Widget* background_widget_; | 40 // True when inside LayoutStatusArea method. |
| 41 // Used to prevent calling itself again from SetChildBounds(). |
| 42 bool in_layout_; |
| 54 | 43 |
| 55 ShelfLayoutController* shelf_; | 44 ShelfLayoutManager* shelf_; |
| 56 | 45 |
| 57 DISALLOW_COPY_AND_ASSIGN(DesktopLayoutManager); | 46 DISALLOW_COPY_AND_ASSIGN(StatusAreaLayoutManager); |
| 58 }; | 47 }; |
| 59 | 48 |
| 60 } // namespace internal | 49 } // namespace internal |
| 61 } // namespace aura_shell | 50 } // namespace aura_shell |
| 62 | 51 |
| 63 #endif // UI_AURA_SHELL_DESKTOP_LAYOUT_MANAGER_H_ | 52 #endif // UI_AURA_SHELL_STATUS_AREA_LAYOUT_MANAGER_H_ |
| OLD | NEW |