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

Side by Side Diff: ash/wm/window_animations.cc

Issue 1547223002: Convert Pass()→std::move() in //ash (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 12 months 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
« no previous file with comments | « ash/wm/panels/panel_layout_manager.cc ('k') | ash/wm/window_state.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) 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_animations.h" 5 #include "ash/wm/window_animations.h"
6 6
7 #include <math.h> 7 #include <math.h>
8
9 #include <algorithm> 8 #include <algorithm>
9 #include <utility>
10 #include <vector> 10 #include <vector>
11 11
12 #include "ash/screen_util.h" 12 #include "ash/screen_util.h"
13 #include "ash/shelf/shelf.h" 13 #include "ash/shelf/shelf.h"
14 #include "ash/shelf/shelf_layout_manager.h" 14 #include "ash/shelf/shelf_layout_manager.h"
15 #include "ash/shelf/shelf_widget.h" 15 #include "ash/shelf/shelf_widget.h"
16 #include "ash/shell.h" 16 #include "ash/shell.h"
17 #include "ash/wm/window_util.h" 17 #include "ash/wm/window_util.h"
18 #include "ash/wm/workspace_controller.h" 18 #include "ash/wm/workspace_controller.h"
19 #include "base/command_line.h" 19 #include "base/command_line.h"
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 // the layer's animation completes or compositing is aborted due to GPU crash, 264 // the layer's animation completes or compositing is aborted due to GPU crash,
265 // it deletes the layer and removes itself as an observer. 265 // it deletes the layer and removes itself as an observer.
266 class CrossFadeObserver : public ui::CompositorObserver, 266 class CrossFadeObserver : public ui::CompositorObserver,
267 public aura::WindowObserver, 267 public aura::WindowObserver,
268 public ui::ImplicitAnimationObserver { 268 public ui::ImplicitAnimationObserver {
269 public: 269 public:
270 // Observes |window| for destruction, but does not take ownership. 270 // Observes |window| for destruction, but does not take ownership.
271 // Takes ownership of |layer| and its child layers. 271 // Takes ownership of |layer| and its child layers.
272 CrossFadeObserver(aura::Window* window, 272 CrossFadeObserver(aura::Window* window,
273 scoped_ptr<ui::LayerTreeOwner> layer_owner) 273 scoped_ptr<ui::LayerTreeOwner> layer_owner)
274 : window_(window), 274 : window_(window), layer_owner_(std::move(layer_owner)) {
275 layer_owner_(layer_owner.Pass()) {
276 window_->AddObserver(this); 275 window_->AddObserver(this);
277 layer_owner_->root()->GetCompositor()->AddObserver(this); 276 layer_owner_->root()->GetCompositor()->AddObserver(this);
278 } 277 }
279 ~CrossFadeObserver() override { 278 ~CrossFadeObserver() override {
280 window_->RemoveObserver(this); 279 window_->RemoveObserver(this);
281 window_ = NULL; 280 window_ = NULL;
282 layer_owner_->root()->GetCompositor()->RemoveObserver(this); 281 layer_owner_->root()->GetCompositor()->RemoveObserver(this);
283 } 282 }
284 283
285 // ui::CompositorObserver overrides: 284 // ui::CompositorObserver overrides:
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
335 old_transformed_bounds, new_bounds); 334 old_transformed_bounds, new_bounds);
336 335
337 // Scale up the old layer while translating to new position. 336 // Scale up the old layer while translating to new position.
338 { 337 {
339 ui::Layer* old_layer = old_layer_owner->root(); 338 ui::Layer* old_layer = old_layer_owner->root();
340 old_layer->GetAnimator()->StopAnimating(); 339 old_layer->GetAnimator()->StopAnimating();
341 old_layer->SetTransform(old_transform); 340 old_layer->SetTransform(old_transform);
342 ui::ScopedLayerAnimationSettings settings(old_layer->GetAnimator()); 341 ui::ScopedLayerAnimationSettings settings(old_layer->GetAnimator());
343 342
344 // Animation observer owns the old layer and deletes itself. 343 // Animation observer owns the old layer and deletes itself.
345 settings.AddObserver(new CrossFadeObserver(window, old_layer_owner.Pass())); 344 settings.AddObserver(
345 new CrossFadeObserver(window, std::move(old_layer_owner)));
346 settings.SetTransitionDuration(duration); 346 settings.SetTransitionDuration(duration);
347 settings.SetTweenType(tween_type); 347 settings.SetTweenType(tween_type);
348 gfx::Transform out_transform; 348 gfx::Transform out_transform;
349 float scale_x = static_cast<float>(new_bounds.width()) / 349 float scale_x = static_cast<float>(new_bounds.width()) /
350 static_cast<float>(old_bounds.width()); 350 static_cast<float>(old_bounds.width());
351 float scale_y = static_cast<float>(new_bounds.height()) / 351 float scale_y = static_cast<float>(new_bounds.height()) /
352 static_cast<float>(old_bounds.height()); 352 static_cast<float>(old_bounds.height());
353 out_transform.Translate(new_bounds.x() - old_bounds.x(), 353 out_transform.Translate(new_bounds.x() - old_bounds.x(),
354 new_bounds.y() - old_bounds.y()); 354 new_bounds.y() - old_bounds.y());
355 out_transform.Scale(scale_x, scale_y); 355 out_transform.Scale(scale_x, scale_y);
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 case SHELF_ALIGNMENT_LEFT: 503 case SHELF_ALIGNMENT_LEFT:
504 return gfx::Rect(work_area.x(), work_area.y(), 0, 0); 504 return gfx::Rect(work_area.x(), work_area.y(), 0, 0);
505 case SHELF_ALIGNMENT_RIGHT: 505 case SHELF_ALIGNMENT_RIGHT:
506 return gfx::Rect(work_area.right(), work_area.y(), 0, 0); 506 return gfx::Rect(work_area.right(), work_area.y(), 0, 0);
507 } 507 }
508 NOTREACHED(); 508 NOTREACHED();
509 return gfx::Rect(); 509 return gfx::Rect();
510 } 510 }
511 511
512 } // namespace ash 512 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/panels/panel_layout_manager.cc ('k') | ash/wm/window_state.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698