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

Side by Side Diff: ash/wm/base_layout_manager.cc

Issue 14273008: Add ash-enable-sticky-edges for 'sticky' instead of 'snap' behavior. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #include "ash/wm/base_layout_manager.h" 5 #include "ash/wm/base_layout_manager.h"
6 6
7 #include "ash/ash_switches.h"
7 #include "ash/screen_ash.h" 8 #include "ash/screen_ash.h"
8 #include "ash/shelf/shelf_layout_manager.h" 9 #include "ash/shelf/shelf_layout_manager.h"
9 #include "ash/shell.h" 10 #include "ash/shell.h"
10 #include "ash/wm/window_animations.h" 11 #include "ash/wm/window_animations.h"
11 #include "ash/wm/window_properties.h" 12 #include "ash/wm/window_properties.h"
12 #include "ash/wm/window_util.h" 13 #include "ash/wm/window_util.h"
13 #include "ash/wm/workspace/workspace_window_resizer.h" 14 #include "ash/wm/workspace/workspace_window_resizer.h"
15 #include "base/command_line.h"
14 #include "ui/aura/client/activation_client.h" 16 #include "ui/aura/client/activation_client.h"
15 #include "ui/aura/client/aura_constants.h" 17 #include "ui/aura/client/aura_constants.h"
16 #include "ui/aura/root_window.h" 18 #include "ui/aura/root_window.h"
17 #include "ui/aura/window.h" 19 #include "ui/aura/window.h"
18 #include "ui/base/ui_base_types.h" 20 #include "ui/base/ui_base_types.h"
19 #include "ui/compositor/layer.h" 21 #include "ui/compositor/layer.h"
20 #include "ui/gfx/screen.h" 22 #include "ui/gfx/screen.h"
21 #include "ui/views/corewm/corewm_switches.h" 23 #include "ui/views/corewm/corewm_switches.h"
22 #include "ui/views/corewm/window_util.h" 24 #include "ui/views/corewm/window_util.h"
23 25
(...skipping 21 matching lines...) Expand all
45 Shell::GetInstance()->RemoveShellObserver(this); 47 Shell::GetInstance()->RemoveShellObserver(this);
46 Shell::GetInstance()->activation_client()->RemoveObserver(this); 48 Shell::GetInstance()->activation_client()->RemoveObserver(this);
47 } 49 }
48 50
49 // static 51 // static
50 gfx::Rect BaseLayoutManager::BoundsWithScreenEdgeVisible( 52 gfx::Rect BaseLayoutManager::BoundsWithScreenEdgeVisible(
51 aura::Window* window, 53 aura::Window* window,
52 const gfx::Rect& restore_bounds) { 54 const gfx::Rect& restore_bounds) {
53 gfx::Rect max_bounds = 55 gfx::Rect max_bounds =
54 ash::ScreenAsh::GetMaximizedWindowBoundsInParent(window); 56 ash::ScreenAsh::GetMaximizedWindowBoundsInParent(window);
55 // If the restore_bounds are more than 1 grid step away from the size the 57 if (!CommandLine::ForCurrentProcess()->HasSwitch(
56 // window would be when maximized, inset it. 58 switches::kAshEnableStickyEdges)) {
varkha 2013/04/16 02:12:12 This changes the behavior of restore after a norma
stevenjb 2013/04/16 20:08:20 I'm going to revert this until discussing with UX.
57 max_bounds.Inset(ash::internal::WorkspaceWindowResizer::kScreenEdgeInset, 59 // If the restore_bounds are more than 1 grid step away from the size the
58 ash::internal::WorkspaceWindowResizer::kScreenEdgeInset); 60 // window would be when maximized, inset it.
61 max_bounds.Inset(ash::internal::WorkspaceWindowResizer::kScreenEdgeInset,
62 ash::internal::WorkspaceWindowResizer::kScreenEdgeInset);
63 }
59 if (restore_bounds.Contains(max_bounds)) 64 if (restore_bounds.Contains(max_bounds))
60 return max_bounds; 65 return max_bounds;
61 return restore_bounds; 66 return restore_bounds;
62 } 67 }
63 68
64 ///////////////////////////////////////////////////////////////////////////// 69 /////////////////////////////////////////////////////////////////////////////
65 // BaseLayoutManager, LayoutManager overrides: 70 // BaseLayoutManager, LayoutManager overrides:
66 71
67 void BaseLayoutManager::OnWindowResized() { 72 void BaseLayoutManager::OnWindowResized() {
68 } 73 }
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 // Put as much of the window as possible within the display area. 250 // Put as much of the window as possible within the display area.
246 gfx::Rect bounds = window->bounds(); 251 gfx::Rect bounds = window->bounds();
247 bounds.AdjustToFit(display_rect); 252 bounds.AdjustToFit(display_rect);
248 window->SetBounds(bounds); 253 window->SetBounds(bounds);
249 } 254 }
250 } 255 }
251 } 256 }
252 257
253 } // namespace internal 258 } // namespace internal
254 } // namespace ash 259 } // namespace ash
OLDNEW
« no previous file with comments | « ash/ash_switches.cc ('k') | ash/wm/window_util.h » ('j') | ash/wm/window_util.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698