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

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

Issue 23531053: ui/base/animation -> ui/gfx/animation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge 2 trunk Created 7 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « ash/wm/frame_painter.h ('k') | ash/wm/gestures/long_press_affordance_handler.h » ('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/frame_painter.h" 5 #include "ash/wm/frame_painter.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/ash_constants.h" 9 #include "ash/ash_constants.h"
10 #include "ash/root_window_controller.h" 10 #include "ash/root_window_controller.h"
11 #include "ash/root_window_settings.h" 11 #include "ash/root_window_settings.h"
12 #include "ash/shell.h" 12 #include "ash/shell.h"
13 #include "ash/shell_window_ids.h" 13 #include "ash/shell_window_ids.h"
14 #include "ash/wm/property_util.h" 14 #include "ash/wm/property_util.h"
15 #include "ash/wm/window_settings.h" 15 #include "ash/wm/window_settings.h"
16 #include "ash/wm/window_util.h" 16 #include "ash/wm/window_util.h"
17 #include "ash/wm/workspace/frame_caption_button_container_view.h" 17 #include "ash/wm/workspace/frame_caption_button_container_view.h"
18 #include "base/logging.h" // DCHECK 18 #include "base/logging.h" // DCHECK
19 #include "grit/ash_resources.h" 19 #include "grit/ash_resources.h"
20 #include "third_party/skia/include/core/SkCanvas.h" 20 #include "third_party/skia/include/core/SkCanvas.h"
21 #include "third_party/skia/include/core/SkColor.h" 21 #include "third_party/skia/include/core/SkColor.h"
22 #include "third_party/skia/include/core/SkPaint.h" 22 #include "third_party/skia/include/core/SkPaint.h"
23 #include "third_party/skia/include/core/SkPath.h" 23 #include "third_party/skia/include/core/SkPath.h"
24 #include "ui/aura/client/aura_constants.h" 24 #include "ui/aura/client/aura_constants.h"
25 #include "ui/aura/env.h" 25 #include "ui/aura/env.h"
26 #include "ui/aura/root_window.h" 26 #include "ui/aura/root_window.h"
27 #include "ui/aura/window.h" 27 #include "ui/aura/window.h"
28 #include "ui/base/animation/slide_animation.h"
29 #include "ui/base/hit_test.h" 28 #include "ui/base/hit_test.h"
30 #include "ui/base/layout.h" 29 #include "ui/base/layout.h"
31 #include "ui/base/resource/resource_bundle.h" 30 #include "ui/base/resource/resource_bundle.h"
32 #include "ui/base/theme_provider.h" 31 #include "ui/base/theme_provider.h"
32 #include "ui/gfx/animation/slide_animation.h"
33 #include "ui/gfx/canvas.h" 33 #include "ui/gfx/canvas.h"
34 #include "ui/gfx/font.h" 34 #include "ui/gfx/font.h"
35 #include "ui/gfx/image/image.h" 35 #include "ui/gfx/image/image.h"
36 #include "ui/gfx/screen.h" 36 #include "ui/gfx/screen.h"
37 #include "ui/gfx/skia_util.h" 37 #include "ui/gfx/skia_util.h"
38 #include "ui/views/widget/widget.h" 38 #include "ui/views/widget/widget.h"
39 #include "ui/views/widget/widget_delegate.h" 39 #include "ui/views/widget/widget_delegate.h"
40 40
41 using aura::RootWindow; 41 using aura::RootWindow;
42 using aura::Window; 42 using aura::Window;
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 // animating. Doing so results in continually painting during the animation 411 // animating. Doing so results in continually painting during the animation
412 // and gives a slower frame rate. 412 // and gives a slower frame rate.
413 // TODO(sky): expose a better way to determine this rather than assuming 413 // TODO(sky): expose a better way to determine this rather than assuming
414 // the parent is a workspace. 414 // the parent is a workspace.
415 bool parent_animating = parent && 415 bool parent_animating = parent &&
416 (parent->layer()->GetAnimator()->IsAnimatingProperty( 416 (parent->layer()->GetAnimator()->IsAnimatingProperty(
417 ui::LayerAnimationElement::OPACITY) || 417 ui::LayerAnimationElement::OPACITY) ||
418 parent->layer()->GetAnimator()->IsAnimatingProperty( 418 parent->layer()->GetAnimator()->IsAnimatingProperty(
419 ui::LayerAnimationElement::VISIBILITY)); 419 ui::LayerAnimationElement::VISIBILITY));
420 if (!parent_animating) { 420 if (!parent_animating) {
421 crossfade_animation_.reset(new ui::SlideAnimation(this)); 421 crossfade_animation_.reset(new gfx::SlideAnimation(this));
422 crossfade_theme_frame_id_ = previous_theme_frame_id_; 422 crossfade_theme_frame_id_ = previous_theme_frame_id_;
423 crossfade_theme_frame_overlay_id_ = previous_theme_frame_overlay_id_; 423 crossfade_theme_frame_overlay_id_ = previous_theme_frame_overlay_id_;
424 crossfade_opacity_ = previous_opacity_; 424 crossfade_opacity_ = previous_opacity_;
425 crossfade_animation_->SetSlideDuration(kActivationCrossfadeDurationMs); 425 crossfade_animation_->SetSlideDuration(kActivationCrossfadeDurationMs);
426 crossfade_animation_->Show(); 426 crossfade_animation_->Show();
427 } else { 427 } else {
428 crossfade_animation_.reset(); 428 crossfade_animation_.reset();
429 } 429 }
430 } 430 }
431 431
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 } 695 }
696 696
697 void FramePainter::OnWindowRemovingFromRootWindow(aura::Window* window) { 697 void FramePainter::OnWindowRemovingFromRootWindow(aura::Window* window) {
698 // Needs to trigger the window appearance change if the window moves across 698 // Needs to trigger the window appearance change if the window moves across
699 // root windows and only one window is left in the previous root. Because 699 // root windows and only one window is left in the previous root. Because
700 // |window| is not yet moved, |window| has to be ignored. 700 // |window| is not yet moved, |window| has to be ignored.
701 UpdateSoloWindowInRoot(window->GetRootWindow(), window); 701 UpdateSoloWindowInRoot(window->GetRootWindow(), window);
702 } 702 }
703 703
704 /////////////////////////////////////////////////////////////////////////////// 704 ///////////////////////////////////////////////////////////////////////////////
705 // ui::AnimationDelegate overrides: 705 // gfx::AnimationDelegate overrides:
706 706
707 void FramePainter::AnimationProgressed(const ui::Animation* animation) { 707 void FramePainter::AnimationProgressed(const gfx::Animation* animation) {
708 frame_->non_client_view()->SchedulePaintInRect(header_frame_bounds_); 708 frame_->non_client_view()->SchedulePaintInRect(header_frame_bounds_);
709 } 709 }
710 710
711 /////////////////////////////////////////////////////////////////////////////// 711 ///////////////////////////////////////////////////////////////////////////////
712 // FramePainter, private: 712 // FramePainter, private:
713 713
714 int FramePainter::GetTitleOffsetX() const { 714 int FramePainter::GetTitleOffsetX() const {
715 return window_icon_ ? 715 return window_icon_ ?
716 window_icon_->bounds().right() + kTitleIconOffsetX : 716 window_icon_->bounds().right() + kTitleIconOffsetX :
717 kTitleNoIconOffsetX; 717 kTitleNoIconOffsetX;
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
841 // icon. Don't use |window_icon_| for this computation as it may be NULL. 841 // icon. Don't use |window_icon_| for this computation as it may be NULL.
842 int title_y = GetCaptionButtonContainerCenterY() - title_font.GetHeight() / 2; 842 int title_y = GetCaptionButtonContainerCenterY() - title_font.GetHeight() / 2;
843 return gfx::Rect( 843 return gfx::Rect(
844 title_x, 844 title_x,
845 std::max(0, title_y), 845 std::max(0, title_y),
846 std::max(0, caption_button_container_->x() - kTitleLogoSpacing - title_x), 846 std::max(0, caption_button_container_->x() - kTitleLogoSpacing - title_x),
847 title_font.GetHeight()); 847 title_font.GetHeight());
848 } 848 }
849 849
850 } // namespace ash 850 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/frame_painter.h ('k') | ash/wm/gestures/long_press_affordance_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698