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

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

Issue 1645843003: Implement Non-Closable Notification (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments Created 4 years, 10 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 #ifndef UI_VIEWS_CONTROLS_SLIDE_OUT_VIEW_H_ 5 #ifndef UI_VIEWS_CONTROLS_SLIDE_OUT_VIEW_H_
6 #define UI_VIEWS_CONTROLS_SLIDE_OUT_VIEW_H_ 6 #define UI_VIEWS_CONTROLS_SLIDE_OUT_VIEW_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "ui/compositor/layer_animation_observer.h" 9 #include "ui/compositor/layer_animation_observer.h"
10 #include "ui/views/view.h" 10 #include "ui/views/view.h"
11 #include "ui/views/views_export.h" 11 #include "ui/views/views_export.h"
12 12
13 namespace views { 13 namespace views {
14 14
15 // A View that can be closed by a slide-out touch gesture. 15 // A View that can be closed by a slide-out touch gesture.
16 class VIEWS_EXPORT SlideOutView : public views::View, 16 class VIEWS_EXPORT SlideOutView : public views::View,
17 public ui::ImplicitAnimationObserver { 17 public ui::ImplicitAnimationObserver {
18 public: 18 public:
19 SlideOutView(); 19 SlideOutView();
20 ~SlideOutView() override; 20 ~SlideOutView() override;
21 21
22 bool slide_out_enabled() { return is_slide_out_enabled_; }
23
22 protected: 24 protected:
23 // Called when user intends to close the View by sliding it out. 25 // Called when user intends to close the View by sliding it out.
24 virtual void OnSlideOut() = 0; 26 virtual void OnSlideOut() = 0;
25 27
26 // Overridden from views::View. 28 // Overridden from views::View.
27 void OnGestureEvent(ui::GestureEvent* event) override; 29 void OnGestureEvent(ui::GestureEvent* event) override;
28 30
31 void set_slide_out_enabled(bool is_slide_out_enabled) {
32 is_slide_out_enabled_ = is_slide_out_enabled;
33 }
34
29 private: 35 private:
30 enum SlideDirection { 36 enum SlideDirection {
31 SLIDE_LEFT, 37 SLIDE_LEFT,
32 SLIDE_RIGHT, 38 SLIDE_RIGHT,
33 }; 39 };
34 40
41 static bool disable_animations_;
sky 2016/02/25 02:35:41 Remove this as you no longer use/need it.
yoshiki 2016/02/25 04:46:27 Done.
42
35 // Restores the transform and opacity of the view. 43 // Restores the transform and opacity of the view.
36 void RestoreVisualState(); 44 void RestoreVisualState();
37 45
38 // Slides the view out and closes it after the animation. 46 // Slides the view out and closes it after the animation.
39 void SlideOutAndClose(SlideDirection direction); 47 void SlideOutAndClose(SlideDirection direction);
40 48
41 // Overridden from ImplicitAnimationObserver. 49 // Overridden from ImplicitAnimationObserver.
42 void OnImplicitAnimationsCompleted() override; 50 void OnImplicitAnimationsCompleted() override;
43 51
44 float gesture_scroll_amount_; 52 float gesture_amount_ = 0.f;
53 bool is_slide_out_enabled_ = true;
45 54
46 DISALLOW_COPY_AND_ASSIGN(SlideOutView); 55 DISALLOW_COPY_AND_ASSIGN(SlideOutView);
47 }; 56 };
48 57
49 } // namespace views 58 } // namespace views
50 59
51 #endif // UI_VIEWS_CONTROLS_SLIDE_OUT_VIEW_H_ 60 #endif // UI_VIEWS_CONTROLS_SLIDE_OUT_VIEW_H_
OLDNEW
« no previous file with comments | « ui/message_center/views/notification_view_unittest.cc ('k') | ui/views/controls/slide_out_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698