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

Side by Side Diff: ash/system/tray/system_tray_bubble.cc

Issue 11145005: Migrate ui::Transform to gfx::Transform (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Hopefully should work this time Created 8 years, 2 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/rotator/screen_rotation.cc ('k') | ash/system/tray/tray_item_view.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/system/tray/system_tray_bubble.h" 5 #include "ash/system/tray/system_tray_bubble.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/system/tray/system_tray.h" 8 #include "ash/system/tray/system_tray.h"
9 #include "ash/system/tray/system_tray_delegate.h" 9 #include "ash/system/tray/system_tray_delegate.h"
10 #include "ash/system/tray/system_tray_item.h" 10 #include "ash/system/tray/system_tray_item.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 // When transitioning from detailed view to default view, animate the existing 160 // When transitioning from detailed view to default view, animate the existing
161 // view (slide out towards the right). 161 // view (slide out towards the right).
162 if (bubble_type == BUBBLE_TYPE_DEFAULT) { 162 if (bubble_type == BUBBLE_TYPE_DEFAULT) {
163 // Make sure the old view is visibile over the new view during the 163 // Make sure the old view is visibile over the new view during the
164 // animation. 164 // animation.
165 layer->parent()->StackAbove(layer, bubble_view_->layer()); 165 layer->parent()->StackAbove(layer, bubble_view_->layer());
166 ui::ScopedLayerAnimationSettings settings(layer->GetAnimator()); 166 ui::ScopedLayerAnimationSettings settings(layer->GetAnimator());
167 settings.AddObserver(new AnimationObserverDeleteLayer(layer)); 167 settings.AddObserver(new AnimationObserverDeleteLayer(layer));
168 settings.SetTransitionDuration(swipe_duration); 168 settings.SetTransitionDuration(swipe_duration);
169 settings.SetTweenType(ui::Tween::EASE_OUT); 169 settings.SetTweenType(ui::Tween::EASE_OUT);
170 ui::Transform transform; 170 gfx::Transform transform;
171 transform.SetTranslateX(layer->bounds().width()); 171 transform.SetTranslateX(layer->bounds().width());
172 layer->SetTransform(transform); 172 layer->SetTransform(transform);
173 } 173 }
174 174
175 { 175 {
176 // Add a shadow layer to make the old layer darker as the animation 176 // Add a shadow layer to make the old layer darker as the animation
177 // progresses. 177 // progresses.
178 ui::Layer* shadow = new ui::Layer(ui::LAYER_SOLID_COLOR); 178 ui::Layer* shadow = new ui::Layer(ui::LAYER_SOLID_COLOR);
179 shadow->SetColor(SK_ColorBLACK); 179 shadow->SetColor(SK_ColorBLACK);
180 shadow->SetOpacity(0.01f); 180 shadow->SetOpacity(0.01f);
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
213 // Make sure that the bubble is large enough for the default view. 213 // Make sure that the bubble is large enough for the default view.
214 if (bubble_type_ == BUBBLE_TYPE_DEFAULT) { 214 if (bubble_type_ == BUBBLE_TYPE_DEFAULT) {
215 bubble_view_->SetMaxHeight(0); // Clear max height limit. 215 bubble_view_->SetMaxHeight(0); // Clear max height limit.
216 } 216 }
217 217
218 // When transitioning from default view to detailed view, animate the new 218 // When transitioning from default view to detailed view, animate the new
219 // view (slide in from the right). 219 // view (slide in from the right).
220 if (bubble_type == BUBBLE_TYPE_DETAILED) { 220 if (bubble_type == BUBBLE_TYPE_DETAILED) {
221 ui::Layer* new_layer = bubble_view_->layer(); 221 ui::Layer* new_layer = bubble_view_->layer();
222 gfx::Rect bounds = new_layer->bounds(); 222 gfx::Rect bounds = new_layer->bounds();
223 ui::Transform transform; 223 gfx::Transform transform;
224 transform.SetTranslateX(bounds.width()); 224 transform.SetTranslateX(bounds.width());
225 new_layer->SetTransform(transform); 225 new_layer->SetTransform(transform);
226 { 226 {
227 ui::ScopedLayerAnimationSettings settings(new_layer->GetAnimator()); 227 ui::ScopedLayerAnimationSettings settings(new_layer->GetAnimator());
228 settings.AddObserver(new AnimationObserverDeleteLayer(layer)); 228 settings.AddObserver(new AnimationObserverDeleteLayer(layer));
229 settings.SetTransitionDuration(swipe_duration); 229 settings.SetTransitionDuration(swipe_duration);
230 settings.SetTweenType(ui::Tween::EASE_OUT); 230 settings.SetTweenType(ui::Tween::EASE_OUT);
231 new_layer->SetTransform(ui::Transform()); 231 new_layer->SetTransform(gfx::Transform());
232 } 232 }
233 } 233 }
234 } 234 }
235 235
236 void SystemTrayBubble::InitView(views::View* anchor, 236 void SystemTrayBubble::InitView(views::View* anchor,
237 TrayBubbleView::InitParams init_params, 237 TrayBubbleView::InitParams init_params,
238 user::LoginStatus login_status) { 238 user::LoginStatus login_status) {
239 DCHECK(bubble_view_ == NULL); 239 DCHECK(bubble_view_ == NULL);
240 240
241 if (bubble_type_ == BUBBLE_TYPE_DETAILED && 241 if (bubble_type_ == BUBBLE_TYPE_DETAILED &&
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 } 356 }
357 357
358 void SystemTrayBubble::OnWidgetClosing(views::Widget* widget) { 358 void SystemTrayBubble::OnWidgetClosing(views::Widget* widget) {
359 CHECK_EQ(bubble_widget_, widget); 359 CHECK_EQ(bubble_widget_, widget);
360 bubble_widget_ = NULL; 360 bubble_widget_ = NULL;
361 tray_->RemoveBubble(this); 361 tray_->RemoveBubble(this);
362 } 362 }
363 363
364 } // namespace internal 364 } // namespace internal
365 } // namespace ash 365 } // namespace ash
OLDNEW
« no previous file with comments | « ash/rotator/screen_rotation.cc ('k') | ash/system/tray/tray_item_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698