| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 |
| OLD | NEW |