| 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 #include "ui/aura_shell/workspace/workspace_manager.h" | 4 #include "ui/aura_shell/workspace/workspace_manager.h" |
| 5 | 5 |
| 6 #include <algorithm> | 6 #include <algorithm> |
| 7 | 7 |
| 8 #include "base/auto_reset.h" | 8 #include "base/auto_reset.h" |
| 9 #include "ui/aura/desktop.h" | 9 #include "ui/aura/desktop.h" |
| 10 #include "ui/aura/screen_aura.h" | 10 #include "ui/aura/screen_aura.h" |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 } else if (active_workspace_) { | 113 } else if (active_workspace_) { |
| 114 // Center the active workspace. | 114 // Center the active workspace. |
| 115 int active_workspace_mid_x = (active_workspace_->bounds().x() + | 115 int active_workspace_mid_x = (active_workspace_->bounds().x() + |
| 116 active_workspace_->bounds().width() / 2) * scale; | 116 active_workspace_->bounds().width() / 2) * scale; |
| 117 dx = workspace_size_.width() / 2 - active_workspace_mid_x; | 117 dx = workspace_size_.width() / 2 - active_workspace_mid_x; |
| 118 dx = std::min(0, std::max(dx, workspace_size_.width() - overview_width)); | 118 dx = std::min(0, std::max(dx, workspace_size_.width() - overview_width)); |
| 119 } | 119 } |
| 120 | 120 |
| 121 transform.SetTranslateX(dx); | 121 transform.SetTranslateX(dx); |
| 122 transform.SetTranslateY(workspace_size_.height() * (1.0f - scale) / 2); | 122 transform.SetTranslateY(workspace_size_.height() * (1.0f - scale) / 2); |
| 123 } else { | 123 } else if (active_workspace_) { |
| 124 transform.SetTranslateX(-active_workspace_->bounds().x()); | 124 transform.SetTranslateX(-active_workspace_->bounds().x()); |
| 125 } | 125 } |
| 126 | 126 |
| 127 viewport_->layer()->SetAnimation(aura::Window::CreateDefaultAnimation()); | 127 viewport_->layer()->SetAnimation(aura::Window::CreateDefaultAnimation()); |
| 128 viewport_->layer()->SetTransform(transform); | 128 viewport_->layer()->SetTransform(transform); |
| 129 } | 129 } |
| 130 | 130 |
| 131 //////////////////////////////////////////////////////////////////////////////// | 131 //////////////////////////////////////////////////////////////////////////////// |
| 132 // WorkspaceManager, Overridden from aura::DesktopObserver: | 132 // WorkspaceManager, Overridden from aura::DesktopObserver: |
| 133 | 133 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 // Move to active workspace. | 198 // Move to active workspace. |
| 199 if (active_workspace_) { | 199 if (active_workspace_) { |
| 200 ui::Transform transform; | 200 ui::Transform transform; |
| 201 transform.SetTranslateX(-active_workspace_->bounds().x()); | 201 transform.SetTranslateX(-active_workspace_->bounds().x()); |
| 202 viewport_->layer()->SetAnimation(aura::Window::CreateDefaultAnimation()); | 202 viewport_->layer()->SetAnimation(aura::Window::CreateDefaultAnimation()); |
| 203 viewport_->SetTransform(transform); | 203 viewport_->SetTransform(transform); |
| 204 } | 204 } |
| 205 } | 205 } |
| 206 | 206 |
| 207 } // namespace aura_shell | 207 } // namespace aura_shell |
| OLD | NEW |