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

Side by Side Diff: ui/views/corewm/window_animations.cc

Issue 115153002: wm: public window_types. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ozone deps Created 7 years 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
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 "ui/views/corewm/window_animations.h" 5 #include "ui/views/corewm/window_animations.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <vector> 10 #include <vector>
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 const float kWindowAnimation_Rotate_DegreesX = 5.f; 80 const float kWindowAnimation_Rotate_DegreesX = 5.f;
81 const float kWindowAnimation_Rotate_ScaleFactor = .99f; 81 const float kWindowAnimation_Rotate_ScaleFactor = .99f;
82 82
83 const float kWindowAnimation_Bounce_Scale = 1.02f; 83 const float kWindowAnimation_Bounce_Scale = 1.02f;
84 const int kWindowAnimation_Bounce_DurationMS = 180; 84 const int kWindowAnimation_Bounce_DurationMS = 180;
85 const int kWindowAnimation_Bounce_GrowShrinkDurationPercent = 40; 85 const int kWindowAnimation_Bounce_GrowShrinkDurationPercent = 40;
86 86
87 base::TimeDelta GetWindowVisibilityAnimationDuration(aura::Window* window) { 87 base::TimeDelta GetWindowVisibilityAnimationDuration(aura::Window* window) {
88 int duration = 88 int duration =
89 window->GetProperty(kWindowVisibilityAnimationDurationKey); 89 window->GetProperty(kWindowVisibilityAnimationDurationKey);
90 if (duration == 0 && window->type() == aura::client::WINDOW_TYPE_MENU) { 90 if (duration == 0 && window->type() == ui::wm::WINDOW_TYPE_MENU) {
91 return base::TimeDelta::FromMilliseconds( 91 return base::TimeDelta::FromMilliseconds(
92 kDefaultAnimationDurationForMenuMS); 92 kDefaultAnimationDurationForMenuMS);
93 } 93 }
94 return TimeDelta::FromInternalValue(duration); 94 return TimeDelta::FromInternalValue(duration);
95 } 95 }
96 96
97 // Gets/sets the WindowVisibilityAnimationType associated with a window. 97 // Gets/sets the WindowVisibilityAnimationType associated with a window.
98 // TODO(beng): redundant/fold into method on public api? 98 // TODO(beng): redundant/fold into method on public api?
99 int GetWindowVisibilityAnimationType(aura::Window* window) { 99 int GetWindowVisibilityAnimationType(aura::Window* window) {
100 int type = window->GetProperty(kWindowVisibilityAnimationTypeKey); 100 int type = window->GetProperty(kWindowVisibilityAnimationTypeKey);
101 if (type == WINDOW_VISIBILITY_ANIMATION_TYPE_DEFAULT) { 101 if (type == WINDOW_VISIBILITY_ANIMATION_TYPE_DEFAULT) {
102 return (window->type() == aura::client::WINDOW_TYPE_MENU || 102 return (window->type() == ui::wm::WINDOW_TYPE_MENU ||
103 window->type() == aura::client::WINDOW_TYPE_TOOLTIP) ? 103 window->type() == ui::wm::WINDOW_TYPE_TOOLTIP)
104 WINDOW_VISIBILITY_ANIMATION_TYPE_FADE : 104 ? WINDOW_VISIBILITY_ANIMATION_TYPE_FADE
105 WINDOW_VISIBILITY_ANIMATION_TYPE_DROP; 105 : WINDOW_VISIBILITY_ANIMATION_TYPE_DROP;
106 } 106 }
107 return type; 107 return type;
108 } 108 }
109 109
110 // Observes a hide animation. 110 // Observes a hide animation.
111 // A window can be hidden for a variety of reasons. Sometimes, Hide() will be 111 // A window can be hidden for a variety of reasons. Sometimes, Hide() will be
112 // called and life is simple. Sometimes, the window is actually bound to a 112 // called and life is simple. Sometimes, the window is actually bound to a
113 // views::Widget and that Widget is closed, and life is a little more 113 // views::Widget and that Widget is closed, and life is a little more
114 // complicated. When a Widget is closed the aura::Window* is actually not 114 // complicated. When a Widget is closed the aura::Window* is actually not
115 // destroyed immediately - it is actually just immediately hidden and then 115 // destroyed immediately - it is actually just immediately hidden and then
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 564
565 bool WindowAnimationsDisabled(aura::Window* window) { 565 bool WindowAnimationsDisabled(aura::Window* window) {
566 return (window && 566 return (window &&
567 window->GetProperty(aura::client::kAnimationsDisabledKey)) || 567 window->GetProperty(aura::client::kAnimationsDisabledKey)) ||
568 CommandLine::ForCurrentProcess()->HasSwitch( 568 CommandLine::ForCurrentProcess()->HasSwitch(
569 switches::kWindowAnimationsDisabled); 569 switches::kWindowAnimationsDisabled);
570 } 570 }
571 571
572 } // namespace corewm 572 } // namespace corewm
573 } // namespace views 573 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/corewm/visibility_controller_unittest.cc ('k') | ui/views/widget/desktop_aura/desktop_native_widget_aura.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698