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

Side by Side Diff: ui/message_center/views/slide_out_controller.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
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_MESSAGE_CENTER_VIEWS_SLIDE_OUT_CONTROLLER_H_
6 #define UI_MESSAGE_CENTER_VIEWS_SLIDE_OUT_CONTROLLER_H_
7
8 #include "base/macros.h"
9 #include "ui/compositor/layer_animation_observer.h"
10 #include "ui/events/scoped_target_handler.h"
11 #include "ui/views/view.h"
12 #include "ui/views/views_export.h"
13
14 namespace views {
15
16 // This class contains logic to control sliding out of a layer in response to
17 // swipes, i.e. gesture scroll events.
18 class SlideOutController : public ui::EventHandler,
19 public ui::ImplicitAnimationObserver {
20 public:
21 class Delegate {
22 public:
23 // Returns the layer for slide operations.
24 virtual ui::Layer* GetSlideOutLayer() = 0;
25
26 // Called when user intends to close the View by sliding it out.
27 virtual void OnSlideOut() = 0;
28 };
29
30 SlideOutController(ui::EventTarget* target, Delegate* delegate);
31 ~SlideOutController() override;
32
33 void set_enabled(bool enabled) { enabled_ = enabled; }
34 bool enabled() { return enabled_; }
35
36 // ui::EventHandler
37 void OnGestureEvent(ui::GestureEvent* event) override;
38
39 // ui::ImplicitAnimationObserver
40 void OnImplicitAnimationsCompleted() override;
41
42 private:
43 // Restores the transform and opacity of the view.
44 void RestoreVisualState();
45
46 // Slides the view out and closes it after the animation. The sign of
47 // |direction| indicates which way the slide occurs.
48 void SlideOutAndClose(int direction);
49
50 ui::ScopedTargetHandler target_handling_;
51 Delegate* delegate_;
52
53 float gesture_amount_ = 0.f;
54 bool enabled_ = true;
55
56 DISALLOW_COPY_AND_ASSIGN(SlideOutController);
57 };
58
59 } // namespace views
60
61 #endif // UI_MESSAGE_CENTER_VIEWS_SLIDE_OUT_CONTROLLER_H_
OLDNEW
« no previous file with comments | « ui/message_center/views/notification_view_unittest.cc ('k') | ui/message_center/views/slide_out_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698