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_ALWAYS_ON_TOP_CONTROLLER_H_ | 5 #ifndef ASH_WM_ALWAYS_ON_TOP_CONTROLLER_H_ |
6 #define ASH_WM_ALWAYS_ON_TOP_CONTROLLER_H_ | 6 #define ASH_WM_ALWAYS_ON_TOP_CONTROLLER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "ui/aura/window_observer.h" | 10 #include "ui/aura/window_observer.h" |
11 | 11 |
12 namespace aura { | 12 namespace aura { |
13 class Window; | 13 class Window; |
14 } | 14 } |
15 | 15 |
16 namespace ash { | 16 namespace ash { |
17 namespace internal { | 17 namespace internal { |
18 | 18 |
19 // AlwaysOnTopController puts window into proper containers based on its | 19 // AlwaysOnTopController puts window into proper containers based on its |
20 // 'AlwaysOnTop' property. That is, putting a window to |default_container_| | 20 // 'AlwaysOnTop' property. That is, putting a window into the worskpace |
21 // if its "AlwaysOnTop" property is false. Otherwise, put it in | 21 // container if its "AlwaysOnTop" property is false. Otherwise, put it in |
22 // |always_on_top_container_|. | 22 // |always_on_top_container_|. |
23 class AlwaysOnTopController : public aura::WindowObserver { | 23 class AlwaysOnTopController : public aura::WindowObserver { |
24 public: | 24 public: |
25 AlwaysOnTopController(); | 25 AlwaysOnTopController(); |
26 virtual ~AlwaysOnTopController(); | 26 virtual ~AlwaysOnTopController(); |
27 | 27 |
28 // Sets the two top level window containers. | 28 // Sets the container for always on top windows. |
29 void SetContainers(aura::Window* default_container, | 29 void SetAlwaysOnTopContainer(aura::Window* always_on_top_container); |
30 aura::Window* always_on_top_container); | |
31 | 30 |
32 // Gets container for given |window| based on its "AlwaysOnTop" property. | 31 // Gets container for given |window| based on its "AlwaysOnTop" property. |
33 aura::Window* GetContainer(aura::Window* window) const; | 32 aura::Window* GetContainer(aura::Window* window) const; |
34 | 33 |
35 private: | 34 private: |
36 // Overridden from aura::WindowObserver: | 35 // Overridden from aura::WindowObserver: |
37 virtual void OnWindowAdded(aura::Window* child) OVERRIDE; | 36 virtual void OnWindowAdded(aura::Window* child) OVERRIDE; |
38 virtual void OnWillRemoveWindow(aura::Window* child) OVERRIDE; | 37 virtual void OnWillRemoveWindow(aura::Window* child) OVERRIDE; |
39 virtual void OnWindowPropertyChanged(aura::Window* window, | 38 virtual void OnWindowPropertyChanged(aura::Window* window, |
40 const void* key, | 39 const void* key, |
41 intptr_t old) OVERRIDE; | 40 intptr_t old) OVERRIDE; |
42 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; | 41 virtual void OnWindowDestroyed(aura::Window* window) OVERRIDE; |
43 | 42 |
44 // TODO(sky): remove this after workspace2 is the default. | |
45 // Is NULL if workspace2 is enabled. | |
46 aura::Window* default_container_; | |
47 aura::Window* always_on_top_container_; | 43 aura::Window* always_on_top_container_; |
48 | 44 |
49 DISALLOW_COPY_AND_ASSIGN(AlwaysOnTopController); | 45 DISALLOW_COPY_AND_ASSIGN(AlwaysOnTopController); |
50 }; | 46 }; |
51 | 47 |
52 } // namepsace internal | 48 } // namepsace internal |
53 } // namepsace ash | 49 } // namepsace ash |
54 | 50 |
55 #endif // ASH_WM_ALWAYS_ON_TOP_CONTROLLER_H_ | 51 #endif // ASH_WM_ALWAYS_ON_TOP_CONTROLLER_H_ |
OLD | NEW |