Chromium Code Reviews| Index: ash/wm/window_state.h |
| diff --git a/ash/wm/window_state.h b/ash/wm/window_state.h |
| index 33987d0bd013ee05589de9daa5329adeec83e94b..7ed31ddae36f4f126f44696b1320737c6ba3b499 100644 |
| --- a/ash/wm/window_state.h |
| +++ b/ash/wm/window_state.h |
| @@ -6,6 +6,7 @@ |
| #define ASH_WM_WINDOW_STATE_H_ |
| #include "ash/ash_export.h" |
| +#include "ash/wm/drag_details.h" |
| #include "ash/wm/wm_types.h" |
| #include "base/basictypes.h" |
| #include "base/memory/scoped_ptr.h" |
| @@ -173,7 +174,7 @@ class ASH_EXPORT WindowState : public aura::WindowObserver { |
| void RemoveObserver(WindowStateObserver* observer); |
| // Whether the window is being dragged. |
| - bool is_dragged() const { return !!window_resizer_; } |
| + bool is_dragged() const { return !!window_resizer(); } |
|
oshima
2014/01/09 19:13:45
can you instead use drag_details_ ?
varkha
2014/01/10 01:34:50
I could, but I wanted to preserve the semantics du
|
| // Whether or not the window's position can be managed by the |
| // auto management logic. |
| @@ -229,17 +230,20 @@ class ASH_EXPORT WindowState : public aura::WindowObserver { |
| top_row_keys_are_function_keys_ = value; |
| } |
| - // Returns or sets a pointer to WindowResizer when resizing is active. |
| - // The pointer to a WindowResizer that is returned is set when a resizer gets |
| - // created and cleared when it gets destroyed. WindowState does not own the |
| - // |window_resizer_| instance and the resizer's lifetime is controlled |
| - // externally. It can be used to avoid creating multiple instances of a |
| - // WindowResizer for the same window. |
| - WindowResizer* window_resizer() const { |
| - return window_resizer_; |
| + // Sets or returns a pointer to DragDetails when resizing is active. |
| + // The pointer is set before a resizer gets created and cleared when it gets |
| + // destroyed. |
| + void set_drag_details(DragDetails* details) { |
| + drag_details_.reset(details); |
| } |
|
oshima
2014/01/09 19:13:45
It may be better to have
void CreateDragDetails(a
varkha
2014/01/10 01:34:50
Done. Yes, this allows fewer places to know about
|
| - void set_window_resizer_(WindowResizer* window_resizer) { |
| - window_resizer_ = window_resizer; |
| + const DragDetails* drag_details() const { return drag_details_.get(); } |
| + DragDetails* drag_details() { return drag_details_.get(); } |
| + |
| + // Returns a pointer to WindowResizer when resizing is active. |
| + // It can be used to avoid creating multiple instances of a WindowResizer for |
| + // the same window. |
| + WindowResizer* window_resizer() const { |
|
oshima
2014/01/09 19:13:45
Can you try to remove const? (If it causes a lot o
varkha
2014/01/10 01:34:50
Done. This forced me to use drag_details_->window_
|
| + return drag_details_ ? drag_details_->window_resizer : NULL; |
| } |
| // aura::WindowObserver overrides: |
| @@ -266,7 +270,7 @@ class ASH_EXPORT WindowState : public aura::WindowObserver { |
| bool ignored_by_shelf_; |
| bool can_consume_system_keys_; |
| bool top_row_keys_are_function_keys_; |
| - WindowResizer* window_resizer_; |
| + scoped_ptr<DragDetails> drag_details_; |
| bool always_restores_to_restore_bounds_; |
| bool hide_shelf_when_fullscreen_; |