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

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

Issue 11418040: gfx::Transform API clean-up (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 1 month 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/magnifier/magnification_controller.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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 // view (slide out towards the right). 158 // view (slide out towards the right).
159 if (bubble_type == BUBBLE_TYPE_DEFAULT) { 159 if (bubble_type == BUBBLE_TYPE_DEFAULT) {
160 // Make sure the old view is visibile over the new view during the 160 // Make sure the old view is visibile over the new view during the
161 // animation. 161 // animation.
162 layer->parent()->StackAbove(layer, bubble_view_->layer()); 162 layer->parent()->StackAbove(layer, bubble_view_->layer());
163 ui::ScopedLayerAnimationSettings settings(layer->GetAnimator()); 163 ui::ScopedLayerAnimationSettings settings(layer->GetAnimator());
164 settings.AddObserver(new AnimationObserverDeleteLayer(layer)); 164 settings.AddObserver(new AnimationObserverDeleteLayer(layer));
165 settings.SetTransitionDuration(swipe_duration); 165 settings.SetTransitionDuration(swipe_duration);
166 settings.SetTweenType(ui::Tween::EASE_OUT); 166 settings.SetTweenType(ui::Tween::EASE_OUT);
167 gfx::Transform transform; 167 gfx::Transform transform;
168 transform.SetTranslateX(layer->bounds().width()); 168 transform.Translate(layer->bounds().width(), 0.0);
169 layer->SetTransform(transform); 169 layer->SetTransform(transform);
170 } 170 }
171 171
172 { 172 {
173 // Add a shadow layer to make the old layer darker as the animation 173 // Add a shadow layer to make the old layer darker as the animation
174 // progresses. 174 // progresses.
175 ui::Layer* shadow = new ui::Layer(ui::LAYER_SOLID_COLOR); 175 ui::Layer* shadow = new ui::Layer(ui::LAYER_SOLID_COLOR);
176 shadow->SetColor(SK_ColorBLACK); 176 shadow->SetColor(SK_ColorBLACK);
177 shadow->SetOpacity(0.01f); 177 shadow->SetOpacity(0.01f);
178 shadow->SetBounds(layer->bounds()); 178 shadow->SetBounds(layer->bounds());
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 if (bubble_type_ == BUBBLE_TYPE_DEFAULT) { 211 if (bubble_type_ == BUBBLE_TYPE_DEFAULT) {
212 bubble_view_->SetMaxHeight(0); // Clear max height limit. 212 bubble_view_->SetMaxHeight(0); // Clear max height limit.
213 } 213 }
214 214
215 // When transitioning from default view to detailed view, animate the new 215 // When transitioning from default view to detailed view, animate the new
216 // view (slide in from the right). 216 // view (slide in from the right).
217 if (bubble_type == BUBBLE_TYPE_DETAILED) { 217 if (bubble_type == BUBBLE_TYPE_DETAILED) {
218 ui::Layer* new_layer = bubble_view_->layer(); 218 ui::Layer* new_layer = bubble_view_->layer();
219 gfx::Rect bounds = new_layer->bounds(); 219 gfx::Rect bounds = new_layer->bounds();
220 gfx::Transform transform; 220 gfx::Transform transform;
221 transform.SetTranslateX(bounds.width()); 221 transform.Translate(bounds.width(), 0.0);
222 new_layer->SetTransform(transform); 222 new_layer->SetTransform(transform);
223 { 223 {
224 ui::ScopedLayerAnimationSettings settings(new_layer->GetAnimator()); 224 ui::ScopedLayerAnimationSettings settings(new_layer->GetAnimator());
225 settings.AddObserver(new AnimationObserverDeleteLayer(layer)); 225 settings.AddObserver(new AnimationObserverDeleteLayer(layer));
226 settings.SetTransitionDuration(swipe_duration); 226 settings.SetTransitionDuration(swipe_duration);
227 settings.SetTweenType(ui::Tween::EASE_OUT); 227 settings.SetTweenType(ui::Tween::EASE_OUT);
228 new_layer->SetTransform(gfx::Transform()); 228 new_layer->SetTransform(gfx::Transform());
229 } 229 }
230 } 230 }
231 } 231 }
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 } 334 }
335 if (view) { 335 if (view) {
336 bubble_view_->AddChildView(new TrayPopupItemContainer( 336 bubble_view_->AddChildView(new TrayPopupItemContainer(
337 view, tray_->shelf_alignment(), bubble_type_ == BUBBLE_TYPE_DEFAULT)); 337 view, tray_->shelf_alignment(), bubble_type_ == BUBBLE_TYPE_DEFAULT));
338 } 338 }
339 } 339 }
340 } 340 }
341 341
342 } // namespace internal 342 } // namespace internal
343 } // namespace ash 343 } // namespace ash
OLDNEW
« no previous file with comments | « ash/magnifier/magnification_controller.cc ('k') | ash/system/tray/tray_item_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698