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

Side by Side Diff: ui/aura_shell/workspace/workspace.cc

Issue 8362006: Reland r107720 - Enable the new layer animation framework. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge Created 9 years, 1 month 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 | « ui/aura_shell/shell.cc ('k') | ui/aura_shell/workspace/workspace_manager.cc » ('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) 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 "base/logging.h" 7 #include "base/logging.h"
8 #include "ui/aura/desktop.h" 8 #include "ui/aura/desktop.h"
9 #include "ui/aura/window.h" 9 #include "ui/aura/window.h"
10 #include "ui/aura_shell/workspace/workspace_manager.h" 10 #include "ui/aura_shell/workspace/workspace_manager.h"
11 #include "ui/gfx/compositor/layer.h" 11 #include "ui/gfx/compositor/layer.h"
12 #include "ui/gfx/compositor/layer_animator.h"
12 13
13 namespace { 14 namespace {
14 // Horizontal margin between windows. 15 // Horizontal margin between windows.
15 const int kWindowHorizontalMargin = 10; 16 const int kWindowHorizontalMargin = 10;
16 17
17 // Maximum number of windows a workspace can have. 18 // Maximum number of windows a workspace can have.
18 size_t g_max_windows_per_workspace = 2; 19 size_t g_max_windows_per_workspace = 2;
19 } 20 }
20 21
21 namespace aura_shell { 22 namespace aura_shell {
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 aura::Window* window, 205 aura::Window* window,
205 const gfx::Point& origin, 206 const gfx::Point& origin,
206 bool animate) { 207 bool animate) {
207 if (window->show_state() == ui::SHOW_STATE_FULLSCREEN) 208 if (window->show_state() == ui::SHOW_STATE_FULLSCREEN)
208 window->Fullscreen(); 209 window->Fullscreen();
209 else if (window->show_state() == ui::SHOW_STATE_MAXIMIZED) 210 else if (window->show_state() == ui::SHOW_STATE_MAXIMIZED)
210 window->Maximize(); 211 window->Maximize();
211 else { 212 else {
212 gfx::Rect bounds = window->GetTargetBounds(); 213 gfx::Rect bounds = window->GetTargetBounds();
213 bounds.set_origin(origin); 214 bounds.set_origin(origin);
214 if (animate) 215 if (animate) {
215 window->layer()->SetAnimation(aura::Window::CreateDefaultAnimation()); 216 ui::LayerAnimator::ScopedSettings settings(
216 window->SetBounds(bounds); 217 window->layer()->GetAnimator());
218 window->SetBounds(bounds);
219 } else {
220 window->SetBounds(bounds);
221 }
217 } 222 }
218 } 223 }
219 224
220 int Workspace::GetTotalWindowsWidth() const { 225 int Workspace::GetTotalWindowsWidth() const {
221 int total_width = 0; 226 int total_width = 0;
222 for (aura::Window::Windows::const_iterator i = windows_.begin(); 227 for (aura::Window::Windows::const_iterator i = windows_.begin();
223 i != windows_.end(); 228 i != windows_.end();
224 ++i) { 229 ++i) {
225 if (total_width) 230 if (total_width)
226 total_width += kWindowHorizontalMargin; 231 total_width += kWindowHorizontalMargin;
227 // TODO(oshima): use restored bounds. 232 // TODO(oshima): use restored bounds.
228 total_width += (*i)->bounds().width(); 233 total_width += (*i)->bounds().width();
229 } 234 }
230 return total_width; 235 return total_width;
231 } 236 }
232 237
233 // static 238 // static
234 size_t Workspace::SetMaxWindowsCount(size_t max) { 239 size_t Workspace::SetMaxWindowsCount(size_t max) {
235 int old = g_max_windows_per_workspace; 240 int old = g_max_windows_per_workspace;
236 g_max_windows_per_workspace = max; 241 g_max_windows_per_workspace = max;
237 return old; 242 return old;
238 } 243 }
239 244
240 } // namespace aura_shell 245 } // namespace aura_shell
OLDNEW
« no previous file with comments | « ui/aura_shell/shell.cc ('k') | ui/aura_shell/workspace/workspace_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698