| 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_COMMON_WINDOW_STATE_H_ |
| 6 #define ASH_WM_WINDOW_STATE_H_ | 6 #define ASH_WM_COMMON_WINDOW_STATE_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
| 11 #include "ash/wm/common/drag_details.h" |
| 11 #include "ash/wm/common/wm_types.h" | 12 #include "ash/wm/common/wm_types.h" |
| 12 #include "ash/wm/drag_details.h" | |
| 13 #include "base/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
| 16 #include "ui/base/ui_base_types.h" | 16 #include "ui/base/ui_base_types.h" |
| 17 | 17 |
| 18 namespace aura { | 18 namespace aura { |
| 19 class Window; | 19 class Window; |
| 20 } | 20 } |
| 21 | 21 |
| 22 namespace gfx { | 22 namespace gfx { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 39 // maximize, minimize, snap sizing etc) should be added here instead | 39 // maximize, minimize, snap sizing etc) should be added here instead |
| 40 // of defining separate functions (like |MaximizeWindow(aura::Window* | 40 // of defining separate functions (like |MaximizeWindow(aura::Window* |
| 41 // window)|) or using aura Window property. | 41 // window)|) or using aura Window property. |
| 42 // The WindowState gets created when first accessed by | 42 // The WindowState gets created when first accessed by |
| 43 // |wm::GetWindowState|, and deleted when the window is deleted. | 43 // |wm::GetWindowState|, and deleted when the window is deleted. |
| 44 // Prefer using this class instead of passing aura::Window* around in | 44 // Prefer using this class instead of passing aura::Window* around in |
| 45 // ash code as this is often what you need to interact with, and | 45 // ash code as this is often what you need to interact with, and |
| 46 // accessing the window using |window()| is cheap. | 46 // accessing the window using |window()| is cheap. |
| 47 class ASH_EXPORT WindowState { | 47 class ASH_EXPORT WindowState { |
| 48 public: | 48 public: |
| 49 | |
| 50 // A subclass of State class represents one of the window's states | 49 // A subclass of State class represents one of the window's states |
| 51 // that corresponds to WindowStateType in Ash environment, e.g. | 50 // that corresponds to WindowStateType in Ash environment, e.g. |
| 52 // maximized, minimized or side snapped, as subclass. | 51 // maximized, minimized or side snapped, as subclass. |
| 53 // Each subclass defines its own behavior and transition for each WMEvent. | 52 // Each subclass defines its own behavior and transition for each WMEvent. |
| 54 class State { | 53 class State { |
| 55 public: | 54 public: |
| 56 State() {} | 55 State() {} |
| 57 virtual ~State() {} | 56 virtual ~State() {} |
| 58 | 57 |
| 59 // Update WindowState based on |event|. | 58 // Update WindowState based on |event|. |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 | 195 |
| 197 void set_hide_shelf_when_fullscreen(bool value) { | 196 void set_hide_shelf_when_fullscreen(bool value) { |
| 198 hide_shelf_when_fullscreen_ = value; | 197 hide_shelf_when_fullscreen_ = value; |
| 199 } | 198 } |
| 200 | 199 |
| 201 // If the minimum visibility is true, ash will try to keep a | 200 // If the minimum visibility is true, ash will try to keep a |
| 202 // minimum amount of the window is always visible on the work area | 201 // minimum amount of the window is always visible on the work area |
| 203 // when shown. | 202 // when shown. |
| 204 // TODO(oshima): Consolidate this and window_position_managed | 203 // TODO(oshima): Consolidate this and window_position_managed |
| 205 // into single parameter to control the window placement. | 204 // into single parameter to control the window placement. |
| 206 bool minimum_visibility() const { | 205 bool minimum_visibility() const { return minimum_visibility_; } |
| 207 return minimum_visibility_; | |
| 208 } | |
| 209 void set_minimum_visibility(bool minimum_visibility) { | 206 void set_minimum_visibility(bool minimum_visibility) { |
| 210 minimum_visibility_ = minimum_visibility; | 207 minimum_visibility_ = minimum_visibility; |
| 211 } | 208 } |
| 212 | 209 |
| 213 // Specifies if the window can be dragged by the user via the caption or not. | 210 // Specifies if the window can be dragged by the user via the caption or not. |
| 214 bool can_be_dragged() const { | 211 bool can_be_dragged() const { return can_be_dragged_; } |
| 215 return can_be_dragged_; | |
| 216 } | |
| 217 void set_can_be_dragged(bool can_be_dragged) { | 212 void set_can_be_dragged(bool can_be_dragged) { |
| 218 can_be_dragged_ = can_be_dragged; | 213 can_be_dragged_ = can_be_dragged; |
| 219 } | 214 } |
| 220 | 215 |
| 221 // Gets/Sets the bounds of the window before it was moved by the auto window | 216 // Gets/Sets the bounds of the window before it was moved by the auto window |
| 222 // management. As long as it was not auto-managed, it will return NULL. | 217 // management. As long as it was not auto-managed, it will return NULL. |
| 223 const gfx::Rect* pre_auto_manage_window_bounds() const { | 218 const gfx::Rect* pre_auto_manage_window_bounds() const { |
| 224 return pre_auto_manage_window_bounds_.get(); | 219 return pre_auto_manage_window_bounds_.get(); |
| 225 } | 220 } |
| 226 void SetPreAutoManageWindowBounds(const gfx::Rect& bounds); | 221 void SetPreAutoManageWindowBounds(const gfx::Rect& bounds); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 238 bool window_position_managed() const { return window_position_managed_; } | 233 bool window_position_managed() const { return window_position_managed_; } |
| 239 void set_window_position_managed(bool window_position_managed) { | 234 void set_window_position_managed(bool window_position_managed) { |
| 240 window_position_managed_ = window_position_managed; | 235 window_position_managed_ = window_position_managed; |
| 241 } | 236 } |
| 242 | 237 |
| 243 // Whether or not the window's position or size was changed by a user. | 238 // Whether or not the window's position or size was changed by a user. |
| 244 bool bounds_changed_by_user() const { return bounds_changed_by_user_; } | 239 bool bounds_changed_by_user() const { return bounds_changed_by_user_; } |
| 245 void set_bounds_changed_by_user(bool bounds_changed_by_user); | 240 void set_bounds_changed_by_user(bool bounds_changed_by_user); |
| 246 | 241 |
| 247 // True if this window is an attached panel. | 242 // True if this window is an attached panel. |
| 248 bool panel_attached() const { | 243 bool panel_attached() const { return panel_attached_; } |
| 249 return panel_attached_; | |
| 250 } | |
| 251 void set_panel_attached(bool panel_attached) { | 244 void set_panel_attached(bool panel_attached) { |
| 252 panel_attached_ = panel_attached; | 245 panel_attached_ = panel_attached; |
| 253 } | 246 } |
| 254 | 247 |
| 255 // True if the window is ignored by the shelf layout manager for | 248 // True if the window is ignored by the shelf layout manager for |
| 256 // purposes of darkening the shelf. | 249 // purposes of darkening the shelf. |
| 257 bool ignored_by_shelf() const { return ignored_by_shelf_; } | 250 bool ignored_by_shelf() const { return ignored_by_shelf_; } |
| 258 void set_ignored_by_shelf(bool ignored_by_shelf) { | 251 void set_ignored_by_shelf(bool ignored_by_shelf) { |
| 259 ignored_by_shelf_ = ignored_by_shelf; | 252 ignored_by_shelf_ = ignored_by_shelf; |
| 260 } | 253 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 273 return top_row_keys_are_function_keys_; | 266 return top_row_keys_are_function_keys_; |
| 274 } | 267 } |
| 275 void set_top_row_keys_are_function_keys(bool value) { | 268 void set_top_row_keys_are_function_keys(bool value) { |
| 276 top_row_keys_are_function_keys_ = value; | 269 top_row_keys_are_function_keys_ = value; |
| 277 } | 270 } |
| 278 | 271 |
| 279 // True if the window is in "immersive full screen mode" which is slightly | 272 // True if the window is in "immersive full screen mode" which is slightly |
| 280 // different from the normal fullscreen mode by allowing the user to reveal | 273 // different from the normal fullscreen mode by allowing the user to reveal |
| 281 // the top portion of the window through a touch / mouse gesture. It might | 274 // the top portion of the window through a touch / mouse gesture. It might |
| 282 // also allow the shelf to be shown in some situations. | 275 // also allow the shelf to be shown in some situations. |
| 283 bool in_immersive_fullscreen() const { | 276 bool in_immersive_fullscreen() const { return in_immersive_fullscreen_; } |
| 284 return in_immersive_fullscreen_; | |
| 285 } | |
| 286 void set_in_immersive_fullscreen(bool enable) { | 277 void set_in_immersive_fullscreen(bool enable) { |
| 287 in_immersive_fullscreen_ = enable; | 278 in_immersive_fullscreen_ = enable; |
| 288 } | 279 } |
| 289 | 280 |
| 290 // Creates and takes ownership of a pointer to DragDetails when resizing is | 281 // Creates and takes ownership of a pointer to DragDetails when resizing is |
| 291 // active. This should be done before a resizer gets created. | 282 // active. This should be done before a resizer gets created. |
| 292 void CreateDragDetails(const gfx::Point& point_in_parent, | 283 void CreateDragDetails(const gfx::Point& point_in_parent, |
| 293 int window_component, | 284 int window_component, |
| 294 aura::client::WindowMoveSource source); | 285 aura::client::WindowMoveSource source); |
| 295 | 286 |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 386 bool ignore_property_change_; | 377 bool ignore_property_change_; |
| 387 | 378 |
| 388 std::unique_ptr<State> current_state_; | 379 std::unique_ptr<State> current_state_; |
| 389 | 380 |
| 390 DISALLOW_COPY_AND_ASSIGN(WindowState); | 381 DISALLOW_COPY_AND_ASSIGN(WindowState); |
| 391 }; | 382 }; |
| 392 | 383 |
| 393 } // namespace wm | 384 } // namespace wm |
| 394 } // namespace ash | 385 } // namespace ash |
| 395 | 386 |
| 396 #endif // ASH_WM_WINDOW_STATE_H_ | 387 #endif // ASH_WM_COMMON_WINDOW_STATE_H_ |
| OLD | NEW |