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