| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ui/aura_shell/workspace/workspace.h" | 5 #include "ui/aura_shell/workspace/workspace.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "ui/aura/aura_constants.h" | 10 #include "ui/aura/aura_constants.h" |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 } | 173 } |
| 174 Layout(shift_reached_until ? until : NULL, NULL); | 174 Layout(shift_reached_until ? until : NULL, NULL); |
| 175 return pushed; | 175 return pushed; |
| 176 } | 176 } |
| 177 | 177 |
| 178 void Workspace::Activate() { | 178 void Workspace::Activate() { |
| 179 workspace_manager_->SetActiveWorkspace(this); | 179 workspace_manager_->SetActiveWorkspace(this); |
| 180 } | 180 } |
| 181 | 181 |
| 182 void Workspace::Layout(aura::Window* ignore, aura::Window* no_animation) { | 182 void Workspace::Layout(aura::Window* ignore, aura::Window* no_animation) { |
| 183 workspace_manager_->set_layout_in_progress(true); |
| 183 gfx::Rect work_area = workspace_manager_->GetWorkAreaBounds(bounds_); | 184 gfx::Rect work_area = workspace_manager_->GetWorkAreaBounds(bounds_); |
| 184 int total_width = GetTotalWindowsWidth(); | 185 int total_width = GetTotalWindowsWidth(); |
| 185 if (total_width < work_area.width()) { | 186 if (total_width < work_area.width()) { |
| 186 int dx = (work_area.width() - total_width) / 2; | 187 int dx = (work_area.width() - total_width) / 2; |
| 187 for (aura::Window::Windows::iterator i = windows_.begin(); | 188 for (aura::Window::Windows::iterator i = windows_.begin(); |
| 188 i != windows_.end(); | 189 i != windows_.end(); |
| 189 ++i) { | 190 ++i) { |
| 190 if (*i != ignore) { | 191 if (*i != ignore) { |
| 191 MoveWindowTo(*i, | 192 MoveWindowTo(*i, |
| 192 gfx::Point(work_area.x() + dx, work_area.y()), | 193 gfx::Point(work_area.x() + dx, work_area.y()), |
| (...skipping 10 matching lines...) Expand all Loading... |
| 203 work_area.origin(), | 204 work_area.origin(), |
| 204 no_animation != windows_[0]); | 205 no_animation != windows_[0]); |
| 205 } | 206 } |
| 206 if (windows_.size() == 2 && windows_[1] != ignore) { | 207 if (windows_.size() == 2 && windows_[1] != ignore) { |
| 207 MoveWindowTo(windows_[1], | 208 MoveWindowTo(windows_[1], |
| 208 gfx::Point(work_area.right() - GetLayoutWidth(windows_[1]), | 209 gfx::Point(work_area.right() - GetLayoutWidth(windows_[1]), |
| 209 work_area.y()), | 210 work_area.y()), |
| 210 no_animation != windows_[1]); | 211 no_animation != windows_[1]); |
| 211 } | 212 } |
| 212 } | 213 } |
| 214 workspace_manager_->set_layout_in_progress(false); |
| 213 } | 215 } |
| 214 | 216 |
| 215 bool Workspace::ContainsFullscreenWindow() const { | 217 bool Workspace::ContainsFullscreenWindow() const { |
| 216 for (aura::Window::Windows::const_iterator i = windows_.begin(); | 218 for (aura::Window::Windows::const_iterator i = windows_.begin(); |
| 217 i != windows_.end(); | 219 i != windows_.end(); |
| 218 ++i) { | 220 ++i) { |
| 219 aura::Window* w = *i; | 221 aura::Window* w = *i; |
| 220 if (w->IsVisible() && | 222 if (w->IsVisible() && |
| 221 w->GetIntProperty(aura::kShowStateKey) == ui::SHOW_STATE_FULLSCREEN) | 223 w->GetIntProperty(aura::kShowStateKey) == ui::SHOW_STATE_FULLSCREEN) |
| 222 return true; | 224 return true; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 | 271 |
| 270 // static | 272 // static |
| 271 size_t Workspace::SetMaxWindowsCount(size_t max) { | 273 size_t Workspace::SetMaxWindowsCount(size_t max) { |
| 272 int old = g_max_windows_per_workspace; | 274 int old = g_max_windows_per_workspace; |
| 273 g_max_windows_per_workspace = max; | 275 g_max_windows_per_workspace = max; |
| 274 return old; | 276 return old; |
| 275 } | 277 } |
| 276 | 278 |
| 277 } // namespace internal | 279 } // namespace internal |
| 278 } // namespace aura_shell | 280 } // namespace aura_shell |
| OLD | NEW |