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_WINDOW_SETTINGS_H_ | |
6 #define ASH_WM_WINDOW_SETTINGS_H_ | |
7 | |
8 #include "ash/ash_export.h" | |
9 #include "base/basictypes.h" | |
10 #include "base/observer_list.h" | |
11 | |
12 namespace aura { | |
13 class Window; | |
14 } | |
15 | |
16 namespace ash { | |
17 namespace wm { | |
18 | |
19 // Per managed window information should be stored here | |
20 // instead of using plain aura window property. | |
21 class ASH_EXPORT WindowSettings { | |
22 public: | |
23 class ASH_EXPORT Observer { | |
24 public: | |
25 // Called when the tracked_by_workspace has changed. | |
26 virtual void OnTrackedByWorkspaceChanged(aura::Window* window, | |
27 bool old_value) {} | |
28 }; | |
29 | |
30 explicit WindowSettings(aura::Window* window); | |
31 ~WindowSettings(); | |
32 | |
33 void AddObserver(Observer* observer); | |
34 void RemoveObserver(Observer* observer); | |
35 | |
36 // Whether the window is tracked by workspace code. Default is | |
37 // true. If set to false the workspace does not switch the current | |
38 // workspace, nor does it attempt to impose constraints on the | |
39 // bounds of the window. This is intended for tab dragging. | |
40 bool tracked_by_workspace() const { return tracked_by_workspace_; } | |
41 void SetTrackedByWorkspace(bool tracked_by_workspace); | |
42 | |
43 // Whether or not the window's position can be managed by the | |
44 // auto management logic. | |
45 bool window_position_managed() const { return window_position_managed_; } | |
46 void set_window_position_managed(bool window_position_managed) { | |
47 window_position_managed_ = window_position_managed; | |
48 } | |
49 | |
50 // Whether or not the window's position or size was changed by a user. | |
51 bool bounds_changed_by_user() const { return bounds_changed_by_user_; } | |
52 void set_bounds_changed_by_user(bool bounds_changed_by_user) { | |
53 bounds_changed_by_user_ = bounds_changed_by_user; | |
54 } | |
55 | |
56 // True if this window is an attached panel. | |
57 bool panel_attached() const { | |
58 return panel_attached_; | |
59 } | |
60 void set_panel_attached(bool panel_attached) { | |
61 panel_attached_ = panel_attached; | |
62 } | |
63 | |
64 // Indicates that an in progress drag should be continued after the | |
65 // window is reparented to another container. | |
66 bool continue_drag_after_reparent() const { | |
67 return continue_drag_after_reparent_; | |
68 } | |
69 void set_continue_drag_after_reparent(bool value) { | |
70 continue_drag_after_reparent_ = value; | |
71 } | |
72 | |
73 // True if the window is ignored by the shelf layout manager for | |
74 // purposes of darkening the shelf. | |
75 bool ignored_by_shelf() const { return ignored_by_shelf_; } | |
76 void set_ignored_by_shelf(bool ignored_by_shelf) { | |
77 ignored_by_shelf_ = ignored_by_shelf; | |
78 } | |
79 | |
80 private: | |
81 // The owner of this window settings. | |
82 aura::Window* window_; | |
83 | |
84 bool tracked_by_workspace_; | |
85 bool window_position_managed_; | |
86 bool bounds_changed_by_user_; | |
87 bool panel_attached_; | |
88 bool continue_drag_after_reparent_; | |
89 bool ignored_by_shelf_; | |
90 | |
91 ObserverList<Observer> observer_list_; | |
92 | |
93 DISALLOW_COPY_AND_ASSIGN(WindowSettings); | |
94 }; | |
95 | |
96 // Returns the WindowSettings for |window|. Creates WindowSettings | |
97 // if it didn't exist. The settings object is owned by |window|. | |
98 ASH_EXPORT WindowSettings* GetWindowSettings(aura::Window* window); | |
99 | |
100 // const version of GetWindowSettings. | |
101 ASH_EXPORT const WindowSettings* | |
102 GetWindowSettings(const aura::Window* window); | |
103 | |
104 } // namespace wm | |
105 } // namespace ash | |
106 | |
107 #endif // ASH_WM_WINDOW_SETTINGS_H_ | |
OLD | NEW |