| 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 namespace internal { |
| 27 class WorkspaceLayoutManager; |
| 28 } |
| 26 | 29 |
| 27 namespace wm { | 30 namespace wm { |
| 28 class WindowStateDelegate; | 31 class WindowStateDelegate; |
| 29 class WindowStateObserver; | 32 class WindowStateObserver; |
| 30 | 33 |
| 31 // WindowState manages and defines ash specific window state and | 34 // WindowState manages and defines ash specific window state and |
| 32 // behavior. Ash specific per-window state (such as ones that controls | 35 // behavior. Ash specific per-window state (such as ones that controls |
| 33 // window manager behavior) and ash specific window behavior (such as | 36 // window manager behavior) and ash specific window behavior (such as |
| 34 // maximize, minimize, snap sizing etc) should be added here instead | 37 // maximize, minimize, snap sizing etc) should be added here instead |
| 35 // of defining separate functions (like |MaximizeWindow(aura::Window* | 38 // of defining separate functions (like |MaximizeWindow(aura::Window* |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 int window_component, | 267 int window_component, |
| 265 aura::client::WindowMoveSource source); | 268 aura::client::WindowMoveSource source); |
| 266 | 269 |
| 267 // Deletes and clears a pointer to DragDetails. This should be done when the | 270 // Deletes and clears a pointer to DragDetails. This should be done when the |
| 268 // resizer gets destroyed. | 271 // resizer gets destroyed. |
| 269 void DeleteDragDetails(); | 272 void DeleteDragDetails(); |
| 270 | 273 |
| 271 // Sets the currently stored restore bounds and clears the restore bounds. | 274 // Sets the currently stored restore bounds and clears the restore bounds. |
| 272 void SetAndClearRestoreBounds(); | 275 void SetAndClearRestoreBounds(); |
| 273 | 276 |
| 277 // Adjusts the |bounds| so that they are flush with the edge of the |
| 278 // workspace if the window represented by |window_state| is side snapped. |
| 279 void AdjustSnappedBounds(gfx::Rect* bounds); |
| 280 |
| 274 // Returns a pointer to DragDetails during drag operations. | 281 // Returns a pointer to DragDetails during drag operations. |
| 275 const DragDetails* drag_details() const { return drag_details_.get(); } | 282 const DragDetails* drag_details() const { return drag_details_.get(); } |
| 276 DragDetails* drag_details() { return drag_details_.get(); } | 283 DragDetails* drag_details() { return drag_details_.get(); } |
| 277 | 284 |
| 278 // aura::WindowObserver overrides: | 285 // aura::WindowObserver overrides: |
| 279 virtual void OnWindowPropertyChanged(aura::Window* window, | 286 virtual void OnWindowPropertyChanged(aura::Window* window, |
| 280 const void* key, | 287 const void* key, |
| 281 intptr_t old) OVERRIDE; | 288 intptr_t old) OVERRIDE; |
| 282 | 289 |
| 283 private: | 290 private: |
| 291 friend class DefaultState; |
| 292 // TODO(oshima): Remove more logic from WLM and this. |
| 293 friend class internal::WorkspaceLayoutManager; |
| 294 |
| 295 WindowStateDelegate* delegate() { return delegate_.get(); } |
| 296 |
| 284 // Snaps the window to left or right of the desktop with given bounds. | 297 // Snaps the window to left or right of the desktop with given bounds. |
| 285 void SnapWindow(WindowShowType left_or_right, | 298 void SnapWindow(WindowShowType left_or_right, |
| 286 const gfx::Rect& bounds); | 299 const gfx::Rect& bounds); |
| 287 | 300 |
| 288 // Sets the window show type and updates the show state if necessary. | 301 // Sets the window show type and updates the show state if necessary. |
| 289 void SetWindowShowType(WindowShowType new_window_show_type); | 302 void UpdateWindowShowType(WindowShowType new_window_show_type); |
| 303 void NotifyPreShowTypeChange(WindowShowType old_window_show_type); |
| 304 void NotifyPostShowTypeChange(WindowShowType old_window_show_type); |
| 305 |
| 306 void SetBoundsDirect(const gfx::Rect& bounds); |
| 307 void SetBoundsDirectAnimated(const gfx::Rect& bounds); |
| 290 | 308 |
| 291 // The owner of this window settings. | 309 // The owner of this window settings. |
| 292 aura::Window* window_; | 310 aura::Window* window_; |
| 293 scoped_ptr<WindowStateDelegate> delegate_; | 311 scoped_ptr<WindowStateDelegate> delegate_; |
| 294 | 312 |
| 295 bool window_position_managed_; | 313 bool window_position_managed_; |
| 296 bool bounds_changed_by_user_; | 314 bool bounds_changed_by_user_; |
| 297 bool panel_attached_; | 315 bool panel_attached_; |
| 298 bool continue_drag_after_reparent_; | 316 bool continue_drag_after_reparent_; |
| 299 bool ignored_by_shelf_; | 317 bool ignored_by_shelf_; |
| 300 bool can_consume_system_keys_; | 318 bool can_consume_system_keys_; |
| 301 bool top_row_keys_are_function_keys_; | 319 bool top_row_keys_are_function_keys_; |
| 302 scoped_ptr<DragDetails> drag_details_; | 320 scoped_ptr<DragDetails> drag_details_; |
| 303 | 321 |
| 304 bool unminimize_to_restore_bounds_; | 322 bool unminimize_to_restore_bounds_; |
| 305 bool hide_shelf_when_fullscreen_; | 323 bool hide_shelf_when_fullscreen_; |
| 306 bool animate_to_fullscreen_; | 324 bool animate_to_fullscreen_; |
| 307 bool minimum_visibility_; | 325 bool minimum_visibility_; |
| 308 | 326 |
| 309 // A property to remember the window position which was set before the | 327 // A property to remember the window position which was set before the |
| 310 // auto window position manager changed the window bounds, so that it can get | 328 // auto window position manager changed the window bounds, so that it can get |
| 311 // restored when only this one window gets shown. | 329 // restored when only this one window gets shown. |
| 312 scoped_ptr<gfx::Rect> pre_auto_manage_window_bounds_; | 330 scoped_ptr<gfx::Rect> pre_auto_manage_window_bounds_; |
| 313 | 331 |
| 314 ObserverList<WindowStateObserver> observer_list_; | 332 ObserverList<WindowStateObserver> observer_list_; |
| 315 | 333 |
| 316 // True when in SetWindowShowType(). This is used to avoid reentrance. | 334 // True to ignore a property change event to avoid reentrance. |
| 317 bool in_set_window_show_type_; | 335 bool ignore_property_change_; |
| 318 | 336 |
| 319 WindowShowType window_show_type_; | 337 WindowShowType window_show_type_; |
| 320 | 338 |
| 321 scoped_ptr<State> current_state_; | 339 scoped_ptr<State> current_state_; |
| 322 | 340 |
| 323 DISALLOW_COPY_AND_ASSIGN(WindowState); | 341 DISALLOW_COPY_AND_ASSIGN(WindowState); |
| 324 }; | 342 }; |
| 325 | 343 |
| 326 // Returns the WindowState for active window. Returns |NULL| | 344 // Returns the WindowState for active window. Returns |NULL| |
| 327 // if there is no active window. | 345 // if there is no active window. |
| 328 ASH_EXPORT WindowState* GetActiveWindowState(); | 346 ASH_EXPORT WindowState* GetActiveWindowState(); |
| 329 | 347 |
| 330 // Returns the WindowState for |window|. Creates WindowState | 348 // Returns the WindowState for |window|. Creates WindowState |
| 331 // if it didn't exist. The settings object is owned by |window|. | 349 // if it didn't exist. The settings object is owned by |window|. |
| 332 ASH_EXPORT WindowState* GetWindowState(aura::Window* window); | 350 ASH_EXPORT WindowState* GetWindowState(aura::Window* window); |
| 333 | 351 |
| 334 // const version of GetWindowState. | 352 // const version of GetWindowState. |
| 335 ASH_EXPORT const WindowState* | 353 ASH_EXPORT const WindowState* |
| 336 GetWindowState(const aura::Window* window); | 354 GetWindowState(const aura::Window* window); |
| 337 | 355 |
| 338 } // namespace wm | 356 } // namespace wm |
| 339 } // namespace ash | 357 } // namespace ash |
| 340 | 358 |
| 341 #endif // ASH_WM_WINDOW_STATE_H_ | 359 #endif // ASH_WM_WINDOW_STATE_H_ |
| OLD | NEW |