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

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 (nits) 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
« no previous file with comments | « ash/wm/window_resizer.cc ('k') | ash/wm/window_state.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 {
178 return drag_details_ && drag_details_->window_resizer;
179 }
177 180
178 // Whether or not the window's position can be managed by the 181 // Whether or not the window's position can be managed by the
179 // auto management logic. 182 // auto management logic.
180 bool window_position_managed() const { return window_position_managed_; } 183 bool window_position_managed() const { return window_position_managed_; }
181 void set_window_position_managed(bool window_position_managed) { 184 void set_window_position_managed(bool window_position_managed) {
182 window_position_managed_ = window_position_managed; 185 window_position_managed_ = window_position_managed;
183 } 186 }
184 187
185 // Whether or not the window's position or size was changed by a user. 188 // 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_; } 189 bool bounds_changed_by_user() const { return bounds_changed_by_user_; }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 225
223 // True if this window has requested that the top-row keys (back, forward, 226 // True if this window has requested that the top-row keys (back, forward,
224 // brightness, volume) should be treated as function keys. 227 // brightness, volume) should be treated as function keys.
225 bool top_row_keys_are_function_keys() const { 228 bool top_row_keys_are_function_keys() const {
226 return top_row_keys_are_function_keys_; 229 return top_row_keys_are_function_keys_;
227 } 230 }
228 void set_top_row_keys_are_function_keys(bool value) { 231 void set_top_row_keys_are_function_keys(bool value) {
229 top_row_keys_are_function_keys_ = value; 232 top_row_keys_are_function_keys_ = value;
230 } 233 }
231 234
232 // Returns or sets a pointer to WindowResizer when resizing is active. 235 // Creates and takes ownership of a pointer to DragDetails when resizing is
233 // The pointer to a WindowResizer that is returned is set when a resizer gets 236 // active. This should be done before a resizer gets created. Returns true
234 // created and cleared when it gets destroyed. WindowState does not own the 237 // if |window| is resizable based on |window_component|, false otherwise.
235 // |window_resizer_| instance and the resizer's lifetime is controlled 238 bool CreateDragDetails(aura::Window* window,
236 // externally. It can be used to avoid creating multiple instances of a 239 const gfx::Point& point_in_parent,
237 // WindowResizer for the same window. 240 int window_component,
238 WindowResizer* window_resizer() const { 241 aura::client::WindowMoveSource source);
239 return window_resizer_; 242
240 } 243 // Deletes and clears a pointer to DragDetails. This should be done when the
241 void set_window_resizer_(WindowResizer* window_resizer) { 244 // resizer gets destroyed.
242 window_resizer_ = window_resizer; 245 void DeleteDragDetails();
246
247 // Returns a pointer to DragDetails during drag operations.
248 const DragDetails* drag_details() const { return drag_details_.get(); }
249 DragDetails* drag_details() { return drag_details_.get(); }
250
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;
243 } 256 }
244 257
245 // aura::WindowObserver overrides: 258 // aura::WindowObserver overrides:
246 virtual void OnWindowPropertyChanged(aura::Window* window, 259 virtual void OnWindowPropertyChanged(aura::Window* window,
247 const void* key, 260 const void* key,
248 intptr_t old) OVERRIDE; 261 intptr_t old) OVERRIDE;
249 262
250 private: 263 private:
251 // Snaps the window to left or right of the desktop with given bounds. 264 // Snaps the window to left or right of the desktop with given bounds.
252 void SnapWindow(WindowShowType left_or_right, 265 void SnapWindow(WindowShowType left_or_right,
253 const gfx::Rect& bounds); 266 const gfx::Rect& bounds);
254 267
255 // Sets the window show type and updates the show state if necessary. 268 // Sets the window show type and updates the show state if necessary.
256 void SetWindowShowType(WindowShowType new_window_show_type); 269 void SetWindowShowType(WindowShowType new_window_show_type);
257 270
258 // The owner of this window settings. 271 // The owner of this window settings.
259 aura::Window* window_; 272 aura::Window* window_;
260 scoped_ptr<WindowStateDelegate> delegate_; 273 scoped_ptr<WindowStateDelegate> delegate_;
261 274
262 bool window_position_managed_; 275 bool window_position_managed_;
263 bool bounds_changed_by_user_; 276 bool bounds_changed_by_user_;
264 bool panel_attached_; 277 bool panel_attached_;
265 bool continue_drag_after_reparent_; 278 bool continue_drag_after_reparent_;
266 bool ignored_by_shelf_; 279 bool ignored_by_shelf_;
267 bool can_consume_system_keys_; 280 bool can_consume_system_keys_;
268 bool top_row_keys_are_function_keys_; 281 bool top_row_keys_are_function_keys_;
269 WindowResizer* window_resizer_; 282 scoped_ptr<DragDetails> drag_details_;
270 283
271 bool always_restores_to_restore_bounds_; 284 bool always_restores_to_restore_bounds_;
272 bool hide_shelf_when_fullscreen_; 285 bool hide_shelf_when_fullscreen_;
273 bool animate_to_fullscreen_; 286 bool animate_to_fullscreen_;
274 bool minimum_visibility_; 287 bool minimum_visibility_;
275 288
276 // A property to remember the window position which was set before the 289 // 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 290 // auto window position manager changed the window bounds, so that it can get
278 // restored when only this one window gets shown. 291 // restored when only this one window gets shown.
279 scoped_ptr<gfx::Rect> pre_auto_manage_window_bounds_; 292 scoped_ptr<gfx::Rect> pre_auto_manage_window_bounds_;
(...skipping 17 matching lines...) Expand all
297 ASH_EXPORT WindowState* GetWindowState(aura::Window* window); 310 ASH_EXPORT WindowState* GetWindowState(aura::Window* window);
298 311
299 // const version of GetWindowState. 312 // const version of GetWindowState.
300 ASH_EXPORT const WindowState* 313 ASH_EXPORT const WindowState*
301 GetWindowState(const aura::Window* window); 314 GetWindowState(const aura::Window* window);
302 315
303 } // namespace wm 316 } // namespace wm
304 } // namespace ash 317 } // namespace ash
305 318
306 #endif // ASH_WM_WINDOW_STATE_H_ 319 #endif // ASH_WM_WINDOW_STATE_H_
OLDNEW
« no previous file with comments | « 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