Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(293)

Side by Side Diff: ash/wm/window_state.h

Issue 121153003: Prevents panels attached to shelf from docking (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Prevents panels attached to shelf from docking (comments+rebased) Created 6 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/wm_types.h" 10 #include "ash/wm/wm_types.h"
10 #include "base/basictypes.h" 11 #include "base/basictypes.h"
11 #include "base/memory/scoped_ptr.h" 12 #include "base/memory/scoped_ptr.h"
12 #include "base/observer_list.h" 13 #include "base/observer_list.h"
13 #include "ui/aura/window_observer.h" 14 #include "ui/aura/window_observer.h"
14 #include "ui/base/ui_base_types.h" 15 #include "ui/base/ui_base_types.h"
15 16
16 namespace aura { 17 namespace aura {
17 class Window; 18 class Window;
18 } 19 }
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 return pre_auto_manage_window_bounds_.get(); 167 return pre_auto_manage_window_bounds_.get();
167 } 168 }
168 void SetPreAutoManageWindowBounds(const gfx::Rect& bounds); 169 void SetPreAutoManageWindowBounds(const gfx::Rect& bounds);
169 170
170 // Layout related properties 171 // Layout related properties
171 172
172 void AddObserver(WindowStateObserver* observer); 173 void AddObserver(WindowStateObserver* observer);
173 void RemoveObserver(WindowStateObserver* observer); 174 void RemoveObserver(WindowStateObserver* observer);
174 175
175 // Whether the window is being dragged. 176 // Whether the window is being dragged.
176 bool is_dragged() const { return !!window_resizer_; } 177 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
177 178
178 // Whether or not the window's position can be managed by the 179 // Whether or not the window's position can be managed by the
179 // auto management logic. 180 // auto management logic.
180 bool window_position_managed() const { return window_position_managed_; } 181 bool window_position_managed() const { return window_position_managed_; }
181 void set_window_position_managed(bool window_position_managed) { 182 void set_window_position_managed(bool window_position_managed) {
182 window_position_managed_ = window_position_managed; 183 window_position_managed_ = window_position_managed;
183 } 184 }
184 185
185 // Whether or not the window's position or size was changed by a user. 186 // Whether or not the window's position or size was changed by a user.
186 bool bounds_changed_by_user() const { return bounds_changed_by_user_; } 187 bool bounds_changed_by_user() const { return bounds_changed_by_user_; }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 223
223 // True if this window has requested that the top-row keys (back, forward, 224 // True if this window has requested that the top-row keys (back, forward,
224 // brightness, volume) should be treated as function keys. 225 // brightness, volume) should be treated as function keys.
225 bool top_row_keys_are_function_keys() const { 226 bool top_row_keys_are_function_keys() const {
226 return top_row_keys_are_function_keys_; 227 return top_row_keys_are_function_keys_;
227 } 228 }
228 void set_top_row_keys_are_function_keys(bool value) { 229 void set_top_row_keys_are_function_keys(bool value) {
229 top_row_keys_are_function_keys_ = value; 230 top_row_keys_are_function_keys_ = value;
230 } 231 }
231 232
232 // Returns or sets a pointer to WindowResizer when resizing is active. 233 // Sets or returns a pointer to DragDetails when resizing is active.
233 // The pointer to a WindowResizer that is returned is set when a resizer gets 234 // The pointer is set before a resizer gets created and cleared when it gets
234 // created and cleared when it gets destroyed. WindowState does not own the 235 // destroyed.
235 // |window_resizer_| instance and the resizer's lifetime is controlled 236 void set_drag_details(DragDetails* details) {
236 // externally. It can be used to avoid creating multiple instances of a 237 drag_details_.reset(details);
237 // WindowResizer for the same window. 238 }
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
239 const DragDetails* drag_details() const { return drag_details_.get(); }
240 DragDetails* drag_details() { return drag_details_.get(); }
241
242 // Returns a pointer to WindowResizer when resizing is active.
243 // It can be used to avoid creating multiple instances of a WindowResizer for
244 // the same window.
238 WindowResizer* window_resizer() const { 245 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_
239 return window_resizer_; 246 return drag_details_ ? drag_details_->window_resizer : NULL;
240 }
241 void set_window_resizer_(WindowResizer* window_resizer) {
242 window_resizer_ = window_resizer;
243 } 247 }
244 248
245 // aura::WindowObserver overrides: 249 // aura::WindowObserver overrides:
246 virtual void OnWindowPropertyChanged(aura::Window* window, 250 virtual void OnWindowPropertyChanged(aura::Window* window,
247 const void* key, 251 const void* key,
248 intptr_t old) OVERRIDE; 252 intptr_t old) OVERRIDE;
249 253
250 private: 254 private:
251 // 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.
252 void SnapWindow(WindowShowType left_or_right, 256 void SnapWindow(WindowShowType left_or_right,
253 const gfx::Rect& bounds); 257 const gfx::Rect& bounds);
254 258
255 // Sets the window show type and updates the show state if necessary. 259 // Sets the window show type and updates the show state if necessary.
256 void SetWindowShowType(WindowShowType new_window_show_type); 260 void SetWindowShowType(WindowShowType new_window_show_type);
257 261
258 // The owner of this window settings. 262 // The owner of this window settings.
259 aura::Window* window_; 263 aura::Window* window_;
260 scoped_ptr<WindowStateDelegate> delegate_; 264 scoped_ptr<WindowStateDelegate> delegate_;
261 265
262 bool window_position_managed_; 266 bool window_position_managed_;
263 bool bounds_changed_by_user_; 267 bool bounds_changed_by_user_;
264 bool panel_attached_; 268 bool panel_attached_;
265 bool continue_drag_after_reparent_; 269 bool continue_drag_after_reparent_;
266 bool ignored_by_shelf_; 270 bool ignored_by_shelf_;
267 bool can_consume_system_keys_; 271 bool can_consume_system_keys_;
268 bool top_row_keys_are_function_keys_; 272 bool top_row_keys_are_function_keys_;
269 WindowResizer* window_resizer_; 273 scoped_ptr<DragDetails> drag_details_;
270 274
271 bool always_restores_to_restore_bounds_; 275 bool always_restores_to_restore_bounds_;
272 bool hide_shelf_when_fullscreen_; 276 bool hide_shelf_when_fullscreen_;
273 bool animate_to_fullscreen_; 277 bool animate_to_fullscreen_;
274 bool minimum_visibility_; 278 bool minimum_visibility_;
275 279
276 // A property to remember the window position which was set before the 280 // A property to remember the window position which was set before the
277 // auto window position manager changed the window bounds, so that it can get 281 // auto window position manager changed the window bounds, so that it can get
278 // restored when only this one window gets shown. 282 // restored when only this one window gets shown.
279 scoped_ptr<gfx::Rect> pre_auto_manage_window_bounds_; 283 scoped_ptr<gfx::Rect> pre_auto_manage_window_bounds_;
(...skipping 17 matching lines...) Expand all
297 ASH_EXPORT WindowState* GetWindowState(aura::Window* window); 301 ASH_EXPORT WindowState* GetWindowState(aura::Window* window);
298 302
299 // const version of GetWindowState. 303 // const version of GetWindowState.
300 ASH_EXPORT const WindowState* 304 ASH_EXPORT const WindowState*
301 GetWindowState(const aura::Window* window); 305 GetWindowState(const aura::Window* window);
302 306
303 } // namespace wm 307 } // namespace wm
304 } // namespace ash 308 } // namespace ash
305 309
306 #endif // ASH_WM_WINDOW_STATE_H_ 310 #endif // ASH_WM_WINDOW_STATE_H_
OLDNEW
« ash/wm/window_resizer.cc ('K') | « ash/wm/window_resizer.cc ('k') | ash/wm/window_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698