OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef ASH_WM_COMPACT_LAYOUT_MANAGER_H_ | |
6 #define ASH_WM_COMPACT_LAYOUT_MANAGER_H_ | |
7 #pragma once | |
8 | |
9 #include "ash/ash_export.h" | |
10 #include "ash/wm/base_layout_manager.h" | |
11 #include "base/basictypes.h" | |
12 #include "base/compiler_specific.h" | |
13 #include "base/gtest_prod_util.h" | |
14 #include "ui/gfx/compositor/layer_animation_observer.h" | |
15 | |
16 namespace views { | |
17 class Widget; | |
18 } | |
19 | |
20 namespace ash { | |
21 namespace internal { | |
22 | |
23 // CompactLayoutManager is the LayoutManager used in compact window mode, | |
24 // which emulates the traditional Chrome OS window manager. Windows are always | |
25 // maximized, fill the screen, and only one tabbed browser window is visible at | |
26 // a time. The status area appears in the top-right corner of the screen. | |
27 class ASH_EXPORT CompactLayoutManager : public BaseLayoutManager, | |
28 public ui::ImplicitAnimationObserver { | |
29 public: | |
30 CompactLayoutManager(); | |
31 virtual ~CompactLayoutManager(); | |
32 | |
33 void set_status_area_widget(views::Widget* widget) { | |
34 status_area_widget_ = widget; | |
35 } | |
36 | |
37 // LayoutManager overrides: | |
38 virtual void OnWindowAddedToLayout(aura::Window* child) OVERRIDE; | |
39 virtual void OnWillRemoveWindowFromLayout(aura::Window* child) OVERRIDE; | |
40 virtual void OnChildWindowVisibilityChanged(aura::Window* child, | |
41 bool visibile) OVERRIDE; | |
42 virtual void SetChildBounds(aura::Window* child, | |
43 const gfx::Rect& requested_bounds) OVERRIDE; | |
44 | |
45 // aura::WindowObserver overrides: | |
46 virtual void OnWindowPropertyChanged(aura::Window* window, | |
47 const void* key, | |
48 intptr_t old) OVERRIDE; | |
49 virtual void OnWindowStackingChanged(aura::Window* window) OVERRIDE; | |
50 | |
51 // ui::LayerAnimationObserver overrides: | |
52 virtual void OnImplicitAnimationsCompleted() OVERRIDE; | |
53 | |
54 private: | |
55 FRIEND_TEST_ALL_PREFIXES(CompactLayoutManagerTest, TransitionTest); | |
56 FRIEND_TEST_ALL_PREFIXES(CompactLayoutManagerTest, CloseAllWindows); | |
57 | |
58 // Hides the status area if we are managing it and full screen windows are | |
59 // visible. | |
60 void UpdateStatusAreaVisibility(); | |
61 | |
62 // Start a slide in / out animation sequence for the layer. | |
63 // The underlying layer is translated to -|offset_x| position. | |
64 void AnimateSlideTo(int offset_x); | |
65 | |
66 // Layout all browser windows currently in the window cycle list. | |
67 // skip |skip_this_window| if we do not want the window to be laid out. | |
68 void LayoutWindows(aura::Window* skip_this_window); | |
69 | |
70 // Hides all but the |current_window_| in the windows list. If we | |
71 // cannot determine the |current_window_|, we do not hide any. | |
72 void HideWindows(); | |
73 | |
74 // Returns the next window after |window| in the window cycle list. | |
75 // This could return NULL if we cannot find a next window. | |
76 aura::Window* FindReplacementWindow(aura::Window* window); | |
77 | |
78 // Switches to a replacement window of |current_window_|. | |
79 void SwitchToReplacementWindow(); | |
80 | |
81 // Status area with clock, network, battery, etc. icons. May be NULL if the | |
82 // shelf is managing the status area. | |
83 views::Widget* status_area_widget_; | |
84 | |
85 // The browser window currently in the viewport. | |
86 aura::Window* current_window_; | |
87 | |
88 DISALLOW_COPY_AND_ASSIGN(CompactLayoutManager); | |
89 }; | |
90 | |
91 } // namespace ash | |
92 } // namespace internal | |
93 | |
94 #endif // ASH_WM_COMPACT_LAYOUT_MANAGER_H_ | |
OLD | NEW |