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

Side by Side Diff: ui/views/controls/slide_out_view.h

Issue 2849523005: CrOS: Fix appearance of notification toasts when sliding out via gesture (Closed)
Patch Set: update build includes 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
« no previous file with comments | « ui/views/BUILD.gn ('k') | ui/views/controls/slide_out_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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef UI_VIEWS_CONTROLS_SLIDE_OUT_VIEW_H_
6 #define UI_VIEWS_CONTROLS_SLIDE_OUT_VIEW_H_
7
8 #include "base/macros.h"
9 #include "ui/compositor/layer_animation_observer.h"
10 #include "ui/views/view.h"
11 #include "ui/views/views_export.h"
12
13 namespace views {
14
15 // A View that can be closed by a slide-out touch gesture.
16 class VIEWS_EXPORT SlideOutView : public views::View,
17 public ui::ImplicitAnimationObserver {
18 public:
19 SlideOutView();
20 ~SlideOutView() override;
21
22 bool slide_out_enabled() { return is_slide_out_enabled_; }
23
24 protected:
25 // Called when user intends to close the View by sliding it out.
26 virtual void OnSlideOut() = 0;
27
28 // Overridden from views::View.
29 void OnGestureEvent(ui::GestureEvent* event) override;
30
31 void set_slide_out_enabled(bool is_slide_out_enabled) {
32 is_slide_out_enabled_ = is_slide_out_enabled;
33 }
34
35 private:
36 enum SlideDirection {
37 SLIDE_LEFT,
38 SLIDE_RIGHT,
39 };
40
41 // Restores the transform and opacity of the view.
42 void RestoreVisualState();
43
44 // Slides the view out and closes it after the animation.
45 void SlideOutAndClose(SlideDirection direction);
46
47 // Overridden from ImplicitAnimationObserver.
48 void OnImplicitAnimationsCompleted() override;
49
50 float gesture_amount_ = 0.f;
51 bool is_slide_out_enabled_ = true;
52
53 DISALLOW_COPY_AND_ASSIGN(SlideOutView);
54 };
55
56 } // namespace views
57
58 #endif // UI_VIEWS_CONTROLS_SLIDE_OUT_VIEW_H_
OLDNEW
« no previous file with comments | « ui/views/BUILD.gn ('k') | ui/views/controls/slide_out_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698