| 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 int overview_width = viewport_->bounds().width() * scale; | 110 int overview_width = viewport_->bounds().width() * scale; |
| 111 int dx = overview_width < workspace_size_.width() ? | 111 int dx = overview_width < workspace_size_.width() ? |
| 112 (workspace_size_.width() - overview_width) / 2 : 0; | 112 (workspace_size_.width() - overview_width) / 2 : 0; |
| 113 | 113 |
| 114 transform.SetTranslateX(-viewport_->GetTargetBounds().x() + dx); | 114 transform.SetTranslateX(-viewport_->GetTargetBounds().x() + dx); |
| 115 transform.SetTranslateY(workspace_size_.height() * (1.0f - scale) / 2); | 115 transform.SetTranslateY(workspace_size_.height() * (1.0f - scale) / 2); |
| 116 } else { | 116 } else { |
| 117 transform.SetTranslateX(-active_workspace_->bounds().x()); | 117 transform.SetTranslateX(-active_workspace_->bounds().x()); |
| 118 } | 118 } |
| 119 | 119 |
| 120 viewport_->layer()->SetAnimation(aura::Window::CreateDefaultAnimation()); | 120 aura::Window::ScopedAnimationSettings settings( |
| 121 viewport_->layer()->GetAnimator()); |
| 121 viewport_->layer()->SetTransform(transform); | 122 viewport_->layer()->SetTransform(transform); |
| 122 } | 123 } |
| 123 | 124 |
| 124 //////////////////////////////////////////////////////////////////////////////// | 125 //////////////////////////////////////////////////////////////////////////////// |
| 125 // WorkspaceManager, Overridden from aura::DesktopObserver: | 126 // WorkspaceManager, Overridden from aura::DesktopObserver: |
| 126 | 127 |
| 127 void WorkspaceManager::OnDesktopResized(const gfx::Size& new_size) { | 128 void WorkspaceManager::OnDesktopResized(const gfx::Size& new_size) { |
| 128 workspace_size_ = | 129 workspace_size_ = |
| 129 gfx::Screen::GetMonitorAreaNearestWindow(viewport_).size(); | 130 gfx::Screen::GetMonitorAreaNearestWindow(viewport_).size(); |
| 130 LayoutWorkspaces(); | 131 LayoutWorkspaces(); |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 kWorkspaceHorizontalMargin * (num_workspaces - 1); | 186 kWorkspaceHorizontalMargin * (num_workspaces - 1); |
| 186 gfx::Rect bounds(0, 0, total_width, workspace_size_.height()); | 187 gfx::Rect bounds(0, 0, total_width, workspace_size_.height()); |
| 187 | 188 |
| 188 if (viewport_->GetTargetBounds() != bounds) | 189 if (viewport_->GetTargetBounds() != bounds) |
| 189 viewport_->SetBounds(bounds); | 190 viewport_->SetBounds(bounds); |
| 190 | 191 |
| 191 // Move to active workspace. | 192 // Move to active workspace. |
| 192 if (active_workspace_) { | 193 if (active_workspace_) { |
| 193 ui::Transform transform; | 194 ui::Transform transform; |
| 194 transform.SetTranslateX(-active_workspace_->bounds().x()); | 195 transform.SetTranslateX(-active_workspace_->bounds().x()); |
| 195 viewport_->layer()->SetAnimation(aura::Window::CreateDefaultAnimation()); | 196 aura::Window::ScopedAnimationSettings settings( |
| 197 viewport_->layer()->GetAnimator()); |
| 196 viewport_->SetTransform(transform); | 198 viewport_->SetTransform(transform); |
| 197 } | 199 } |
| 198 } | 200 } |
| 199 | 201 |
| 200 } // namespace aura_shell | 202 } // namespace aura_shell |
| OLD | NEW |