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

Side by Side Diff: ui/message_center/views/slide_out_controller.cc

Issue 2873553002: [Notifications] Fix swipe to close for ARC notifications. (Closed)
Patch Set: Created 3 years, 7 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
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/message_center/views/slide_out_controller.h" 5 #include "ui/message_center/views/slide_out_controller.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 SlideOutController::SlideOutController(ui::EventTarget* target, 13 SlideOutController::SlideOutController(ui::EventTarget* target,
14 Delegate* delegate) 14 Delegate* delegate)
15 : target_handling_(target, this), delegate_(delegate) {} 15 : delegate_(delegate) {}
16 16
17 SlideOutController::~SlideOutController() {} 17 SlideOutController::~SlideOutController() {}
18 18
19 void SlideOutController::OnGestureEvent(ui::GestureEvent* event) { 19 void SlideOutController::OnGestureEvent(ui::GestureEvent* event) {
20 const float kScrollRatioForClosingNotification = 0.5f; 20 const float kScrollRatioForClosingNotification = 0.5f;
21 21
22 if (event->type() == ui::ET_SCROLL_FLING_START) { 22 if (event->type() == ui::ET_SCROLL_FLING_START) {
23 // The threshold for the fling velocity is computed empirically. 23 // The threshold for the fling velocity is computed empirically.
24 // The unit is in pixels/second. 24 // The unit is in pixels/second.
25 const float kFlingThresholdForClose = 800.f; 25 const float kFlingThresholdForClose = 800.f;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 transform.Translate(direction < 0 ? -width : width, 0.0); 100 transform.Translate(direction < 0 ? -width : width, 0.0);
101 layer->SetTransform(transform); 101 layer->SetTransform(transform);
102 layer->SetOpacity(0.f); 102 layer->SetOpacity(0.f);
103 } 103 }
104 104
105 void SlideOutController::OnImplicitAnimationsCompleted() { 105 void SlideOutController::OnImplicitAnimationsCompleted() {
106 delegate_->OnSlideOut(); 106 delegate_->OnSlideOut();
107 } 107 }
108 108
109 } // namespace views 109 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698