OLD | NEW |
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/controls/slide_out_view.h" | 5 #include "ui/views/controls/slide_out_view.h" |
6 | 6 |
7 #include "ui/compositor/layer.h" | 7 #include "ui/compositor/layer.h" |
8 #include "ui/compositor/scoped_layer_animation_settings.h" | 8 #include "ui/compositor/scoped_layer_animation_settings.h" |
9 #include "ui/gfx/transform.h" | 9 #include "ui/gfx/transform.h" |
10 | 10 |
11 namespace views { | 11 namespace views { |
12 | 12 |
13 SlideOutView::SlideOutView() { | 13 SlideOutView::SlideOutView() { |
14 // If accelerated compositing is not available, this widget tracks the | 14 // If accelerated compositing is not available, this widget tracks the |
15 // OnSlideOut event but does not render any visible changes. | 15 // OnSlideOut event but does not render any visible changes. |
16 SetPaintToLayer(true); | 16 SetPaintToLayer(); |
17 layer()->SetFillsBoundsOpaquely(false); | 17 layer()->SetFillsBoundsOpaquely(false); |
18 } | 18 } |
19 | 19 |
20 SlideOutView::~SlideOutView() { | 20 SlideOutView::~SlideOutView() { |
21 } | 21 } |
22 | 22 |
23 void SlideOutView::OnGestureEvent(ui::GestureEvent* event) { | 23 void SlideOutView::OnGestureEvent(ui::GestureEvent* event) { |
24 const float kScrollRatioForClosingNotification = 0.5f; | 24 const float kScrollRatioForClosingNotification = 0.5f; |
25 | 25 |
26 if (event->type() == ui::ET_SCROLL_FLING_START) { | 26 if (event->type() == ui::ET_SCROLL_FLING_START) { |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 transform.Translate(direction == SLIDE_LEFT ? -width() : width(), 0.0); | 102 transform.Translate(direction == SLIDE_LEFT ? -width() : width(), 0.0); |
103 layer()->SetTransform(transform); | 103 layer()->SetTransform(transform); |
104 layer()->SetOpacity(0.f); | 104 layer()->SetOpacity(0.f); |
105 } | 105 } |
106 | 106 |
107 void SlideOutView::OnImplicitAnimationsCompleted() { | 107 void SlideOutView::OnImplicitAnimationsCompleted() { |
108 OnSlideOut(); | 108 OnSlideOut(); |
109 } | 109 } |
110 | 110 |
111 } // namespace views | 111 } // namespace views |
OLD | NEW |