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

Side by Side Diff: ash/app_list/app_list.cc

Issue 9320018: Revert 120092 - Reland 120074 -- Disable animations during aura tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 10 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/app_list/app_list.h ('k') | ash/drag_drop/drag_drop_controller.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/app_list/app_list.h" 5 #include "ash/app_list/app_list.h"
6 6
7 #include "ash/app_list/app_list_model.h" 7 #include "ash/app_list/app_list_model.h"
8 #include "ash/app_list/app_list_view.h" 8 #include "ash/app_list/app_list_view.h"
9 #include "ash/ash_switches.h" 9 #include "ash/ash_switches.h"
10 #include "ash/shell_delegate.h" 10 #include "ash/shell_delegate.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 } 80 }
81 81
82 //////////////////////////////////////////////////////////////////////////////// 82 ////////////////////////////////////////////////////////////////////////////////
83 // AppList, private: 83 // AppList, private:
84 84
85 void AppList::SetWidget(views::Widget* widget) { 85 void AppList::SetWidget(views::Widget* widget) {
86 DCHECK(widget_ == NULL); 86 DCHECK(widget_ == NULL);
87 87
88 if (is_visible_) { 88 if (is_visible_) {
89 widget_ = widget; 89 widget_ = widget;
90 widget_->AddObserver(this);
90 GetLayer(widget_)->GetAnimator()->AddObserver(this); 91 GetLayer(widget_)->GetAnimator()->AddObserver(this);
91 Shell::GetInstance()->AddRootWindowEventFilter(this); 92 Shell::GetInstance()->AddRootWindowEventFilter(this);
92 93
93 widget_->SetBounds(GetPreferredBounds(false)); 94 widget_->SetBounds(GetPreferredBounds(false));
94 widget_->SetOpacity(0); 95 widget_->SetOpacity(0);
95 ScheduleAnimation(); 96 ScheduleAnimation();
96 97
97 widget_->Show(); 98 widget_->Show();
98 } else { 99 } else {
99 widget->Close(); 100 widget->Close();
(...skipping 11 matching lines...) Expand all
111 } 112 }
112 113
113 void AppList::ScheduleAnimation() { 114 void AppList::ScheduleAnimation() {
114 aura::Window* default_container = Shell::GetInstance()->GetContainer( 115 aura::Window* default_container = Shell::GetInstance()->GetContainer(
115 internal::kShellWindowId_DefaultContainer); 116 internal::kShellWindowId_DefaultContainer);
116 // |default_container| could be NULL during Shell shutdown. 117 // |default_container| could be NULL during Shell shutdown.
117 if (!default_container) 118 if (!default_container)
118 return; 119 return;
119 120
120 ui::Layer* layer = GetLayer(widget_); 121 ui::Layer* layer = GetLayer(widget_);
121
122 // Stop observing previous animation.
123 StopObservingImplicitAnimations();
124
125 ui::ScopedLayerAnimationSettings app_list_animation(layer->GetAnimator()); 122 ui::ScopedLayerAnimationSettings app_list_animation(layer->GetAnimator());
126 app_list_animation.AddObserver(this);
127 layer->SetBounds(GetPreferredBounds(is_visible_)); 123 layer->SetBounds(GetPreferredBounds(is_visible_));
128 layer->SetOpacity(is_visible_ ? 1.0 : 0.0); 124 layer->SetOpacity(is_visible_ ? 1.0 : 0.0);
129 125
130 ui::Layer* default_container_layer = default_container->layer(); 126 ui::Layer* default_container_layer = default_container->layer();
131 ui::ScopedLayerAnimationSettings default_container_animation( 127 ui::ScopedLayerAnimationSettings default_container_animation(
132 default_container_layer->GetAnimator()); 128 default_container_layer->GetAnimator());
133 app_list_animation.AddObserver(this);
134 default_container_layer->SetOpacity(is_visible_ ? 0.0 : 1.0); 129 default_container_layer->SetOpacity(is_visible_ ? 0.0 : 1.0);
135 } 130 }
136 131
137 //////////////////////////////////////////////////////////////////////////////// 132 ////////////////////////////////////////////////////////////////////////////////
138 // AppList, aura::EventFilter implementation: 133 // AppList, aura::EventFilter implementation:
139 134
140 bool AppList::PreHandleKeyEvent(aura::Window* target, 135 bool AppList::PreHandleKeyEvent(aura::Window* target,
141 aura::KeyEvent* event) { 136 aura::KeyEvent* event) {
142 return false; 137 return false;
143 } 138 }
(...skipping 13 matching lines...) Expand all
157 return ui::TOUCH_STATUS_UNKNOWN; 152 return ui::TOUCH_STATUS_UNKNOWN;
158 } 153 }
159 154
160 ui::GestureStatus AppList::PreHandleGestureEvent( 155 ui::GestureStatus AppList::PreHandleGestureEvent(
161 aura::Window* target, 156 aura::Window* target,
162 aura::GestureEvent* event) { 157 aura::GestureEvent* event) {
163 return ui::GESTURE_STATUS_UNKNOWN; 158 return ui::GESTURE_STATUS_UNKNOWN;
164 } 159 }
165 160
166 //////////////////////////////////////////////////////////////////////////////// 161 ////////////////////////////////////////////////////////////////////////////////
167 // AppList, ui::ImplicitAnimationObserver implementation: 162 // AppList, ui::LayerAnimationObserver implementation:
168 163
169 void AppList::OnImplicitAnimationsCompleted() { 164 void AppList::OnLayerAnimationEnded(
165 const ui::LayerAnimationSequence* sequence) {
170 if (!is_visible_ ) 166 if (!is_visible_ )
171 widget_->Close(); 167 widget_->Close();
172 } 168 }
173 169
170 void AppList::OnLayerAnimationAborted(
171 const ui::LayerAnimationSequence* sequence) {
172 }
173
174 void AppList::OnLayerAnimationScheduled(
175 const ui::LayerAnimationSequence* sequence) {
176 }
177
174 //////////////////////////////////////////////////////////////////////////////// 178 ////////////////////////////////////////////////////////////////////////////////
175 // AppList, views::Widget::Observer implementation: 179 // AppList, views::Widget::Observer implementation:
176 180
177 void AppList::OnWidgetClosing(views::Widget* widget) { 181 void AppList::OnWidgetClosing(views::Widget* widget) {
178 DCHECK(widget_ == widget); 182 DCHECK(widget_ == widget);
179 if (is_visible_) 183 if (is_visible_)
180 SetVisible(false); 184 SetVisible(false);
181 ResetWidget(); 185 ResetWidget();
182 } 186 }
183 187
184 void AppList::OnWidgetActivationChanged(views::Widget* widget, bool active) { 188 void AppList::OnWidgetActivationChanged(views::Widget* widget, bool active) {
185 DCHECK(widget_ == widget); 189 DCHECK(widget_ == widget);
186 if (widget_ && is_visible_ && !active) 190 if (widget_ && is_visible_ && !active)
187 SetVisible(false); 191 SetVisible(false);
188 } 192 }
189 193
190 } // namespace internal 194 } // namespace internal
191 } // namespace ash 195 } // namespace ash
OLDNEW
« no previous file with comments | « ash/app_list/app_list.h ('k') | ash/drag_drop/drag_drop_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698