| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 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_WINDOW_STATE_H_ | 5 #ifndef ASH_WM_WINDOW_STATE_H_ |
| 6 #define ASH_WM_WINDOW_STATE_H_ | 6 #define ASH_WM_WINDOW_STATE_H_ |
| 7 | 7 |
| 8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
| 9 #include "ash/wm/drag_details.h" | 9 #include "ash/wm/drag_details.h" |
| 10 #include "ash/wm/wm_types.h" | 10 #include "ash/wm/wm_types.h" |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
| 14 #include "ui/aura/window_observer.h" | 14 #include "ui/aura/window_observer.h" |
| 15 #include "ui/base/ui_base_types.h" | 15 #include "ui/base/ui_base_types.h" |
| 16 | 16 |
| 17 namespace aura { | 17 namespace aura { |
| 18 class Window; | 18 class Window; |
| 19 } | 19 } |
| 20 | 20 |
| 21 namespace gfx { | 21 namespace gfx { |
| 22 class Rect; | 22 class Rect; |
| 23 } | 23 } |
| 24 | 24 |
| 25 namespace ash { | 25 namespace ash { |
| 26 class WindowResizer; | |
| 27 | 26 |
| 28 namespace wm { | 27 namespace wm { |
| 29 class WindowStateDelegate; | 28 class WindowStateDelegate; |
| 30 class WindowStateObserver; | 29 class WindowStateObserver; |
| 31 | 30 |
| 32 // WindowState manages and defines ash specific window state and | 31 // WindowState manages and defines ash specific window state and |
| 33 // behavior. Ash specific per-window state (such as ones that controls | 32 // behavior. Ash specific per-window state (such as ones that controls |
| 34 // window manager behavior) and ash specific window behavior (such as | 33 // window manager behavior) and ash specific window behavior (such as |
| 35 // maximize, minimize, snap sizing etc) should be added here instead | 34 // maximize, minimize, snap sizing etc) should be added here instead |
| 36 // of defining separate functions (like |MaximizeWindow(aura::Window* | 35 // of defining separate functions (like |MaximizeWindow(aura::Window* |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 } | 167 } |
| 169 void SetPreAutoManageWindowBounds(const gfx::Rect& bounds); | 168 void SetPreAutoManageWindowBounds(const gfx::Rect& bounds); |
| 170 | 169 |
| 171 // Layout related properties | 170 // Layout related properties |
| 172 | 171 |
| 173 void AddObserver(WindowStateObserver* observer); | 172 void AddObserver(WindowStateObserver* observer); |
| 174 void RemoveObserver(WindowStateObserver* observer); | 173 void RemoveObserver(WindowStateObserver* observer); |
| 175 | 174 |
| 176 // Whether the window is being dragged. | 175 // Whether the window is being dragged. |
| 177 bool is_dragged() const { | 176 bool is_dragged() const { |
| 178 return drag_details_ && drag_details_->window_resizer; | 177 return drag_details_; |
| 179 } | 178 } |
| 180 | 179 |
| 181 // Whether or not the window's position can be managed by the | 180 // Whether or not the window's position can be managed by the |
| 182 // auto management logic. | 181 // auto management logic. |
| 183 bool window_position_managed() const { return window_position_managed_; } | 182 bool window_position_managed() const { return window_position_managed_; } |
| 184 void set_window_position_managed(bool window_position_managed) { | 183 void set_window_position_managed(bool window_position_managed) { |
| 185 window_position_managed_ = window_position_managed; | 184 window_position_managed_ = window_position_managed; |
| 186 } | 185 } |
| 187 | 186 |
| 188 // Whether or not the window's position or size was changed by a user. | 187 // Whether or not the window's position or size was changed by a user. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 // True if this window has requested that the top-row keys (back, forward, | 225 // True if this window has requested that the top-row keys (back, forward, |
| 227 // brightness, volume) should be treated as function keys. | 226 // brightness, volume) should be treated as function keys. |
| 228 bool top_row_keys_are_function_keys() const { | 227 bool top_row_keys_are_function_keys() const { |
| 229 return top_row_keys_are_function_keys_; | 228 return top_row_keys_are_function_keys_; |
| 230 } | 229 } |
| 231 void set_top_row_keys_are_function_keys(bool value) { | 230 void set_top_row_keys_are_function_keys(bool value) { |
| 232 top_row_keys_are_function_keys_ = value; | 231 top_row_keys_are_function_keys_ = value; |
| 233 } | 232 } |
| 234 | 233 |
| 235 // Creates and takes ownership of a pointer to DragDetails when resizing is | 234 // Creates and takes ownership of a pointer to DragDetails when resizing is |
| 236 // active. This should be done before a resizer gets created. Returns true | 235 // active. This should be done before a resizer gets created. |
| 237 // if |window| is resizable based on |window_component|, false otherwise. | 236 void CreateDragDetails(aura::Window* window, |
| 238 bool CreateDragDetails(aura::Window* window, | |
| 239 const gfx::Point& point_in_parent, | 237 const gfx::Point& point_in_parent, |
| 240 int window_component, | 238 int window_component, |
| 241 aura::client::WindowMoveSource source); | 239 aura::client::WindowMoveSource source); |
| 242 | 240 |
| 243 // Deletes and clears a pointer to DragDetails. This should be done when the | 241 // Deletes and clears a pointer to DragDetails. This should be done when the |
| 244 // resizer gets destroyed. | 242 // resizer gets destroyed. |
| 245 void DeleteDragDetails(); | 243 void DeleteDragDetails(); |
| 246 | 244 |
| 247 // Returns a pointer to DragDetails during drag operations. | 245 // Returns a pointer to DragDetails during drag operations. |
| 248 const DragDetails* drag_details() const { return drag_details_.get(); } | 246 const DragDetails* drag_details() const { return drag_details_.get(); } |
| 249 DragDetails* drag_details() { return drag_details_.get(); } | 247 DragDetails* drag_details() { return drag_details_.get(); } |
| 250 | 248 |
| 251 // Returns a pointer to WindowResizer when resizing is active. | |
| 252 // It can be used to avoid creating multiple instances of a WindowResizer for | |
| 253 // the same window. | |
| 254 WindowResizer* window_resizer() { | |
| 255 return drag_details_ ? drag_details_->window_resizer : NULL; | |
| 256 } | |
| 257 | |
| 258 // aura::WindowObserver overrides: | 249 // aura::WindowObserver overrides: |
| 259 virtual void OnWindowPropertyChanged(aura::Window* window, | 250 virtual void OnWindowPropertyChanged(aura::Window* window, |
| 260 const void* key, | 251 const void* key, |
| 261 intptr_t old) OVERRIDE; | 252 intptr_t old) OVERRIDE; |
| 262 | 253 |
| 263 private: | 254 private: |
| 264 // Snaps the window to left or right of the desktop with given bounds. | 255 // Snaps the window to left or right of the desktop with given bounds. |
| 265 void SnapWindow(WindowShowType left_or_right, | 256 void SnapWindow(WindowShowType left_or_right, |
| 266 const gfx::Rect& bounds); | 257 const gfx::Rect& bounds); |
| 267 | 258 |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 ASH_EXPORT WindowState* GetWindowState(aura::Window* window); | 301 ASH_EXPORT WindowState* GetWindowState(aura::Window* window); |
| 311 | 302 |
| 312 // const version of GetWindowState. | 303 // const version of GetWindowState. |
| 313 ASH_EXPORT const WindowState* | 304 ASH_EXPORT const WindowState* |
| 314 GetWindowState(const aura::Window* window); | 305 GetWindowState(const aura::Window* window); |
| 315 | 306 |
| 316 } // namespace wm | 307 } // namespace wm |
| 317 } // namespace ash | 308 } // namespace ash |
| 318 | 309 |
| 319 #endif // ASH_WM_WINDOW_STATE_H_ | 310 #endif // ASH_WM_WINDOW_STATE_H_ |
| OLD | NEW |