Make |track_| in MediaStreamTrack const. and a couple of other cosmetic changes.
[chromium-blink-merge.git] / athena / home / home_card_gesture_manager.h
blob04510187cbf95663e686ad092cac2c94281e2702
1 // Copyright 2014 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.
5 #ifndef ATHENA_HOME_HOME_CARD_GESTURE_MANAGER_H_
6 #define ATHENA_HOME_HOME_CARD_GESTURE_MANAGER_H_
8 #include "athena/home/public/home_card.h"
9 #include "athena/athena_export.h"
10 #include "ui/gfx/geometry/rect.h"
12 namespace ui {
13 class GestureEvent;
16 namespace athena {
18 // Handles the touch gestures over the home card.
19 class ATHENA_EXPORT HomeCardGestureManager {
20 public:
21 class Delegate {
22 public:
23 // Called when the gesture has ended. The state of the home card will
24 // end up with |final_state|. |is_fling| is true only when the gesture has
25 // ended with a fling action.
26 virtual void OnGestureEnded(HomeCard::State final_state,
27 bool is_fling) = 0;
29 // Called when the gesture position is updated so that |delegate| updates
30 // the visual. The arguments indicate that the gesture is switching between
31 // |from_state| and |to_state|, and that the level of progress is at
32 // |progress|, which is in the range (0, 1]. The home card was previously
33 // at either |from_state| or |to_state|. In particular, the home card may
34 // never have been at |from_state|. |from_state| is never equal to
35 // |to_state|.
36 virtual void OnGestureProgressed(
37 HomeCard::State from_state,
38 HomeCard::State to_state,
39 float progress) = 0;
42 HomeCardGestureManager(Delegate* delegate,
43 const gfx::Rect& screen_bounds);
44 ~HomeCardGestureManager();
46 void ProcessGestureEvent(ui::GestureEvent* event);
48 private:
49 // Get the final state from the last position.
50 HomeCard::State GetFinalState() const;
52 // Update the current position and emits OnGestureProgressed().
53 void UpdateScrollState(const ui::GestureEvent& event);
55 Delegate* delegate_; // Not owned.
57 // The state when the gesture starts.
58 HomeCard::State original_state_;
60 // The offset from the top edge of the home card and the initial position of
61 // gesture.
62 int y_offset_;
64 // The estimated height of the home card after the last touch event.
65 int last_estimated_height_;
67 // The bounds of the screen to compute the home card bounds.
68 gfx::Rect screen_bounds_;
70 DISALLOW_COPY_AND_ASSIGN(HomeCardGestureManager);
73 } // namespace athena
75 #endif // ATHENA_HOME_HOME_CARD_GESTURE_MANAGER_H_