OLD | NEW |
| (Empty) |
1 // Copyright 2013 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_SOLO_WINDOW_TRACKER_H_ | |
6 #define ASH_WM_SOLO_WINDOW_TRACKER_H_ | |
7 | |
8 #include <vector> | |
9 | |
10 #include "ash/ash_export.h" | |
11 #include "ash/wm/dock/docked_window_layout_manager_observer.h" | |
12 #include "base/compiler_specific.h" | |
13 #include "base/memory/scoped_ptr.h" | |
14 #include "ui/aura/window_observer.h" | |
15 #include "ui/gfx/rect.h" | |
16 | |
17 namespace aura { | |
18 class RootWindow; | |
19 class Window; | |
20 } | |
21 | |
22 namespace ash { | |
23 | |
24 // Class which keeps track of the window (if any) which should use the solo | |
25 // window header. The solo window header is very transparent and is used when | |
26 // there is only one visible window and the window is not maximized or | |
27 // fullscreen. The solo window header is not used for either panels or docked | |
28 // windows. | |
29 class ASH_EXPORT SoloWindowTracker | |
30 : public aura::WindowObserver, | |
31 public internal::DockedWindowLayoutManagerObserver { | |
32 public: | |
33 explicit SoloWindowTracker(aura::RootWindow* root_window); | |
34 virtual ~SoloWindowTracker(); | |
35 | |
36 // Enable/Disable solo headers. | |
37 static void SetSoloHeaderEnabled(bool enabled); | |
38 | |
39 // Returns the window, if any, which should use the solo window header. | |
40 aura::Window* GetWindowWithSoloHeader(); | |
41 | |
42 private: | |
43 // Updates the window which would use the solo header if the window were not | |
44 // maximized or fullscreen. If |ignore_window| is not NULL, it is ignored for | |
45 // counting valid candidates. This is useful when there is a window which is | |
46 // about to be moved to a different root window or about to be closed. | |
47 void UpdateSoloWindow(aura::Window* ignore_window); | |
48 | |
49 // Returns true if there is a visible docked window. | |
50 bool AnyVisibleWindowDocked() const; | |
51 | |
52 // aura::WindowObserver overrides: | |
53 virtual void OnWindowAdded(aura::Window* new_window) OVERRIDE; | |
54 virtual void OnWillRemoveWindow(aura::Window* window) OVERRIDE; | |
55 virtual void OnWindowVisibilityChanged(aura::Window* window, | |
56 bool visible) OVERRIDE; | |
57 | |
58 // ash::internal::DockedWindowLayoutManagerObserver override: | |
59 virtual void OnDockBoundsChanging(const gfx::Rect& new_bounds, | |
60 Reason reason) OVERRIDE; | |
61 | |
62 // The containers whose children can use the solo header. | |
63 std::vector<aura::Window*> containers_; | |
64 | |
65 // The dock's bounds. | |
66 gfx::Rect dock_bounds_; | |
67 | |
68 // The window which would use the solo header if it were not maximized or | |
69 // fullscreen. | |
70 aura::Window* solo_window_; | |
71 | |
72 // Class which observes changes in |solo_window_|'s show type. | |
73 class SoloWindowObserver; | |
74 scoped_ptr<SoloWindowObserver> solo_window_observer_; | |
75 | |
76 DISALLOW_COPY_AND_ASSIGN(SoloWindowTracker); | |
77 }; | |
78 | |
79 } // namespace ash | |
80 | |
81 #endif // ASH_WM_SOLO_WINDOW_TRACKER_H_ | |
OLD | NEW |