Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 CHROME_BROWSER_CHROMEOS_DISPLAY_TOUCH_CALIBRATOR_TOUCH_CALIBRATOR_VIEW_H _ | 5 #ifndef CHROME_BROWSER_CHROMEOS_DISPLAY_TOUCH_CALIBRATOR_TOUCH_CALIBRATOR_VIEW_H _ |
| 6 #define CHROME_BROWSER_CHROMEOS_DISPLAY_TOUCH_CALIBRATOR_TOUCH_CALIBRATOR_VIEW_H _ | 6 #define CHROME_BROWSER_CHROMEOS_DISPLAY_TOUCH_CALIBRATOR_TOUCH_CALIBRATOR_VIEW_H _ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "ui/display/display.h" | 9 #include "ui/display/display.h" |
| 10 #include "ui/gfx/animation/animation_delegate.h" | 10 #include "ui/gfx/animation/animation_delegate.h" |
| 11 #include "ui/views/view.h" | 11 #include "ui/views/view.h" |
| 12 | 12 |
| 13 namespace views { | 13 namespace views { |
| 14 class Label; | |
| 14 class Widget; | 15 class Widget; |
| 15 } | 16 } |
| 16 | 17 |
| 18 namespace gfx { | |
| 19 class Animation; | |
| 20 class LinearAnimation; | |
| 21 } | |
| 22 | |
| 17 namespace chromeos { | 23 namespace chromeos { |
| 18 | 24 |
| 19 // An overlay view used during touch calibration. This view is responsible for | 25 // An overlay view used during touch calibration. This view is responsible for |
| 20 // all animations and UX during touch calibration on all displays currently | 26 // all animations and UX during touch calibration on all displays currently |
| 21 // active on the device. The view on the display being calibrated is the primary | 27 // active on the device. The view on the display being calibrated is the primary |
| 22 // touch calibration view. | 28 // touch calibration view. |
| 23 // |TouchCalibratorView| acts as a state machine and has an API to toggle its | 29 // |TouchCalibratorView| acts as a state machine and has an API to toggle its |
| 24 // state or get the current state. | 30 // state or get the current state. |
| 25 class TouchCalibratorView : public views::View, public gfx::AnimationDelegate { | 31 class TouchCalibratorView : public views::View, public gfx::AnimationDelegate { |
| 26 public: | 32 public: |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 65 | 71 |
| 66 // Skips to the final state. Should be used to cancel calibration and hide all | 72 // Skips to the final state. Should be used to cancel calibration and hide all |
| 67 // views from the screen with a smooth transition out animation. | 73 // views from the screen with a smooth transition out animation. |
| 68 void SkipToFinalState(); | 74 void SkipToFinalState(); |
| 69 | 75 |
| 70 // Returns true if |location| is set by the end of this function call. If set, | 76 // Returns true if |location| is set by the end of this function call. If set, |
| 71 // |location| will point to the center of the circle that the user sees during | 77 // |location| will point to the center of the circle that the user sees during |
| 72 // the touch calibration UX. | 78 // the touch calibration UX. |
| 73 bool GetDisplayPointLocation(gfx::Point* location); | 79 bool GetDisplayPointLocation(gfx::Point* location); |
| 74 | 80 |
| 81 // Skips/Cancels any current ongoing animation to the end. This is used during | |
| 82 // testing. | |
| 83 void SkipCurrentAnimation(); | |
|
stevenjb
2016/12/22 22:03:33
If this is only used for testing, just name it Ski
malaykeshav
2016/12/23 00:09:06
Done
| |
| 84 | |
| 75 // Returns the current state of the view. | 85 // Returns the current state of the view. |
| 76 State state() { return state_; } | 86 State state() { return state_; } |
| 77 | 87 |
| 78 private: | 88 private: |
| 89 void InitViewContents(); | |
| 90 | |
| 79 // The target display on which this view is rendered on. | 91 // The target display on which this view is rendered on. |
| 80 const display::Display display_; | 92 const display::Display display_; |
| 81 | 93 |
| 82 // True if this view is on the display that is being calibrated. | 94 // True if this view is on the display that is being calibrated. |
| 83 bool is_primary_view_ = false; | 95 bool is_primary_view_ = false; |
| 84 | 96 |
| 85 std::unique_ptr<views::Widget> widget_; | 97 std::unique_ptr<views::Widget> widget_; |
| 86 | 98 |
| 99 SkPaint paint_; | |
| 100 | |
| 101 // Defines the bounds for the background animation. | |
| 102 gfx::RectF background_rect_; | |
| 103 | |
| 104 // Text label indicating how to exit the touch calibration. | |
| 105 views::Label* exit_label_; | |
| 106 | |
| 107 // Start and end opacity values used during the fade animation. This is set | |
| 108 // before the animation begins. | |
| 109 float start_opacity_value_; | |
| 110 float end_opacity_value_; | |
| 111 | |
| 112 // Linear animation used for various aniations including fade-in, fade out, | |
| 113 // and view translation. | |
| 114 std::unique_ptr<gfx::LinearAnimation> animator_; | |
| 115 | |
| 87 State state_ = UNKNOWN; | 116 State state_ = UNKNOWN; |
| 88 | 117 |
| 89 DISALLOW_COPY_AND_ASSIGN(TouchCalibratorView); | 118 DISALLOW_COPY_AND_ASSIGN(TouchCalibratorView); |
| 90 }; | 119 }; |
| 91 | 120 |
| 92 } // namespace chromeos | 121 } // namespace chromeos |
| 93 | 122 |
| 94 #endif // CHROME_BROWSER_CHROMEOS_DISPLAY_TOUCH_CALIBRATOR_TOUCH_CALIBRATOR_VIE W_H_ | 123 #endif // CHROME_BROWSER_CHROMEOS_DISPLAY_TOUCH_CALIBRATOR_TOUCH_CALIBRATOR_VIE W_H_ |
| OLD | NEW |