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

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

Issue 11434004: ash: Refactor some code that snaps windows. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years 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
« no previous file with comments | « ash/wm/toplevel_window_event_handler_unittest.cc ('k') | ash/wm/workspace/snap_sizer.h » ('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 (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/window_util.h" 5 #include "ash/wm/window_util.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/ash_constants.h" 9 #include "ash/ash_constants.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 bool CanMaximizeWindow(const aura::Window* window) { 79 bool CanMaximizeWindow(const aura::Window* window) {
80 return window->GetProperty(aura::client::kCanMaximizeKey); 80 return window->GetProperty(aura::client::kCanMaximizeKey);
81 } 81 }
82 82
83 bool CanResizeWindow(const aura::Window* window) { 83 bool CanResizeWindow(const aura::Window* window) {
84 return window->GetProperty(aura::client::kCanResizeKey); 84 return window->GetProperty(aura::client::kCanResizeKey);
85 } 85 }
86 86
87 bool CanSnapWindow(aura::Window* window) { 87 bool CanSnapWindow(aura::Window* window) {
88 // If a window has a maximum size defined, snapping may make it too big. 88 // If a window has a maximum size defined, snapping may make it too big.
89 return window->delegate()->GetMaximumSize().IsEmpty(); 89 return window->delegate() ? window->delegate()->GetMaximumSize().IsEmpty() :
90 true;
90 } 91 }
91 92
92 bool IsWindowNormal(const aura::Window* window) { 93 bool IsWindowNormal(const aura::Window* window) {
93 return IsWindowStateNormal(window->GetProperty(aura::client::kShowStateKey)); 94 return IsWindowStateNormal(window->GetProperty(aura::client::kShowStateKey));
94 } 95 }
95 96
96 bool IsWindowStateNormal(ui::WindowShowState state) { 97 bool IsWindowStateNormal(ui::WindowShowState state) {
97 return state == ui::SHOW_STATE_NORMAL || state == ui::SHOW_STATE_DEFAULT; 98 return state == ui::SHOW_STATE_NORMAL || state == ui::SHOW_STATE_DEFAULT;
98 } 99 }
99 100
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 x_offset = work_area.right() - bounds->x() - kMinimumOnScreenArea; 211 x_offset = work_area.right() - bounds->x() - kMinimumOnScreenArea;
211 } else if (bounds->right() < work_area.x()) { 212 } else if (bounds->right() < work_area.x()) {
212 x_offset = work_area.x() - bounds->right() + kMinimumOnScreenArea; 213 x_offset = work_area.x() - bounds->right() + kMinimumOnScreenArea;
213 } 214 }
214 bounds->Offset(x_offset, y_offset); 215 bounds->Offset(x_offset, y_offset);
215 } 216 }
216 } 217 }
217 218
218 } // namespace wm 219 } // namespace wm
219 } // namespace ash 220 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/toplevel_window_event_handler_unittest.cc ('k') | ash/wm/workspace/snap_sizer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698