| 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_TOPLEVEL_LAYOUT_MANAGER_H_ | 5 #ifndef UI_AURA_SHELL_LAPTOP_MODE_LAYOUT_MANAGER_H_ |
| 6 #define UI_AURA_SHELL_TOPLEVEL_LAYOUT_MANAGER_H_ | 6 #define UI_AURA_SHELL_LAPTOP_MODE_LAYOUT_MANAGER_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "ui/aura/layout_manager.h" | 13 #include "ui/aura/layout_manager.h" |
| 14 #include "ui/aura/window_observer.h" | 14 #include "ui/aura/window_observer.h" |
| 15 #include "ui/aura_shell/aura_shell_export.h" | 15 #include "ui/aura_shell/aura_shell_export.h" |
| 16 | 16 |
| 17 namespace aura_shell { | 17 namespace aura_shell { |
| 18 namespace internal { | 18 namespace internal { |
| 19 | 19 |
| 20 class ShelfLayoutManager; | 20 // LaptopModeLayoutManager is an alternate LayoutManager for the container that |
| 21 | 21 // hosts what the shell considers to be top-level windows. It is used for low |
| 22 // ToplevelLayoutManager is the LayoutManager installed on a container that | 22 // resolution screens and keeps the main browser window maximized. |
| 23 // hosts what the shell considers to be top-level windows. It is used if the | 23 // It listens for changes to kShowStateKey and resizes the window appropriately. |
| 24 // WorkspaceManager is not enabled. ToplevelLayoutManager listens for changes to | 24 class AURA_SHELL_EXPORT LaptopModeLayoutManager : public aura::LayoutManager, |
| 25 // kShowStateKey and resizes the window appropriately. | 25 public aura::WindowObserver { |
| 26 class AURA_SHELL_EXPORT ToplevelLayoutManager : public aura::LayoutManager, | |
| 27 public aura::WindowObserver { | |
| 28 public: | 26 public: |
| 29 ToplevelLayoutManager(); | 27 LaptopModeLayoutManager(); |
| 30 virtual ~ToplevelLayoutManager(); | 28 virtual ~LaptopModeLayoutManager(); |
| 31 | |
| 32 void set_shelf(ShelfLayoutManager* shelf) { shelf_ = shelf; } | |
| 33 | 29 |
| 34 // LayoutManager overrides: | 30 // LayoutManager overrides: |
| 35 virtual void OnWindowResized() OVERRIDE; | 31 virtual void OnWindowResized() OVERRIDE; |
| 36 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE; | 32 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE; |
| 37 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE; | 33 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE; |
| 38 virtual void OnChildWindowVisibilityChanged(aura::Window* child, | 34 virtual void OnChildWindowVisibilityChanged(aura::Window* child, |
| 39 bool visibile) OVERRIDE; | 35 bool visibile) OVERRIDE; |
| 40 virtual void SetChildBounds(aura::Window* child, | 36 virtual void SetChildBounds(aura::Window* child, |
| 41 const gfx::Rect& requested_bounds) OVERRIDE; | 37 const gfx::Rect& requested_bounds) OVERRIDE; |
| 42 | 38 |
| 43 // WindowObserver overrides: | 39 // WindowObserver overrides: |
| 44 virtual void OnWindowPropertyChanged(aura::Window* window, | 40 virtual void OnWindowPropertyChanged(aura::Window* window, |
| 45 const char* name, | 41 const char* name, |
| 46 void* old) OVERRIDE; | 42 void* old) OVERRIDE; |
| 47 | 43 |
| 48 private: | 44 private: |
| 49 typedef std::set<aura::Window*> Windows; | 45 typedef std::set<aura::Window*> Windows; |
| 50 | 46 |
| 51 // If necessary adjusts the bounds of window based on it's show state. | |
| 52 void WindowStateChanged(aura::Window* window); | |
| 53 | |
| 54 // Updates the visbility of the shelf based on if there are any full screen | |
| 55 // windows. | |
| 56 void UpdateShelfVisibility(); | |
| 57 | |
| 58 // Set of windows we're listening to. | 47 // Set of windows we're listening to. |
| 59 Windows windows_; | 48 Windows windows_; |
| 60 | 49 |
| 61 ShelfLayoutManager* shelf_; | 50 DISALLOW_COPY_AND_ASSIGN(LaptopModeLayoutManager); |
| 62 | |
| 63 DISALLOW_COPY_AND_ASSIGN(ToplevelLayoutManager); | |
| 64 }; | 51 }; |
| 65 | 52 |
| 66 } // namepsace aura_shell | 53 } // namespace aura_shell |
| 67 } // namepsace internal | 54 } // namespace internal |
| 68 | 55 |
| 69 #endif // UI_AURA_SHELL_TOPLEVEL_LAYOUT_MANAGER_H_ | 56 #endif // UI_AURA_SHELL_LAPTOP_MODE_LAYOUT_MANAGER_H_ |
| OLD | NEW |