| 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_STATUS_AREA_LAYOUT_MANAGER_H_ | 5 #ifndef ASH_WM_STATUS_AREA_LAYOUT_MANAGER_H_ |
| 6 #define ASH_WM_STATUS_AREA_LAYOUT_MANAGER_H_ | 6 #define ASH_WM_STATUS_AREA_LAYOUT_MANAGER_H_ |
| 7 | 7 |
| 8 #include "ash/snap_to_pixel_layout_manager.h" | 8 #include "ash/common/wm/wm_snap_to_pixel_layout_manager.h" |
| 9 #include "base/compiler_specific.h" | |
| 10 #include "base/macros.h" | 9 #include "base/macros.h" |
| 11 #include "ui/aura/layout_manager.h" | |
| 12 | 10 |
| 13 namespace ash { | 11 namespace ash { |
| 12 |
| 14 class ShelfWidget; | 13 class ShelfWidget; |
| 15 | 14 |
| 16 // StatusAreaLayoutManager is a layout manager responsible for the status area. | 15 // StatusAreaLayoutManager is a layout manager responsible for the status area. |
| 17 // In any case when status area needs relayout it redirects this call to | 16 // In any case when status area needs relayout it redirects this call to |
| 18 // ShelfLayoutManager. | 17 // ShelfLayoutManager. |
| 19 class StatusAreaLayoutManager : public SnapToPixelLayoutManager { | 18 class StatusAreaLayoutManager : public wm::WmSnapToPixelLayoutManager { |
| 20 public: | 19 public: |
| 21 StatusAreaLayoutManager(aura::Window* container, ShelfWidget* shelf); | 20 explicit StatusAreaLayoutManager(ShelfWidget* shelf_widget); |
| 22 ~StatusAreaLayoutManager() override; | 21 ~StatusAreaLayoutManager() override; |
| 23 | 22 |
| 24 // Overridden from aura::LayoutManager: | 23 // Overridden from wm::WmSnapToPixelLayoutManager: |
| 25 void OnWindowResized() override; | 24 void OnWindowResized() override; |
| 26 void SetChildBounds(aura::Window* child, | 25 void SetChildBounds(WmWindow* child, |
| 27 const gfx::Rect& requested_bounds) override; | 26 const gfx::Rect& requested_bounds) override; |
| 28 | 27 |
| 29 private: | 28 private: |
| 30 // Updates layout of the status area. Effectively calls ShelfLayoutManager | 29 // Updates layout of the status area. Effectively calls ShelfLayoutManager |
| 31 // to update layout of the shelf. | 30 // to update layout of the shelf. |
| 32 void LayoutStatusArea(); | 31 void LayoutStatusArea(); |
| 33 | 32 |
| 34 // True when inside LayoutStatusArea method. | 33 // True when inside LayoutStatusArea method. |
| 35 // Used to prevent calling itself again from SetChildBounds(). | 34 // Used to prevent calling itself again from SetChildBounds(). |
| 36 bool in_layout_; | 35 bool in_layout_; |
| 37 | 36 |
| 38 ShelfWidget* shelf_; | 37 ShelfWidget* shelf_widget_; |
| 39 | 38 |
| 40 DISALLOW_COPY_AND_ASSIGN(StatusAreaLayoutManager); | 39 DISALLOW_COPY_AND_ASSIGN(StatusAreaLayoutManager); |
| 41 }; | 40 }; |
| 42 | 41 |
| 43 } // namespace ash | 42 } // namespace ash |
| 44 | 43 |
| 45 #endif // ASH_WM_STATUS_AREA_LAYOUT_MANAGER_H_ | 44 #endif // ASH_WM_STATUS_AREA_LAYOUT_MANAGER_H_ |
| OLD | NEW |