| 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 ongoing animation to its end. |
| 82 void SkipCurrentAnimationForTest(); |
| 83 |
| 75 // Returns the current state of the view. | 84 // Returns the current state of the view. |
| 76 State state() { return state_; } | 85 State state() { return state_; } |
| 77 | 86 |
| 78 private: | 87 private: |
| 88 void InitViewContents(); |
| 89 |
| 79 // The target display on which this view is rendered on. | 90 // The target display on which this view is rendered on. |
| 80 const display::Display display_; | 91 const display::Display display_; |
| 81 | 92 |
| 82 // True if this view is on the display that is being calibrated. | 93 // True if this view is on the display that is being calibrated. |
| 83 bool is_primary_view_ = false; | 94 bool is_primary_view_ = false; |
| 84 | 95 |
| 85 std::unique_ptr<views::Widget> widget_; | 96 std::unique_ptr<views::Widget> widget_; |
| 86 | 97 |
| 98 SkPaint paint_; |
| 99 |
| 100 // Defines the bounds for the background animation. |
| 101 gfx::RectF background_rect_; |
| 102 |
| 103 // Text label indicating how to exit the touch calibration. |
| 104 views::Label* exit_label_; |
| 105 |
| 106 // Start and end opacity values used during the fade animation. This is set |
| 107 // before the animation begins. |
| 108 float start_opacity_value_; |
| 109 float end_opacity_value_; |
| 110 |
| 111 // Linear animation used for various aniations including fade-in, fade out, |
| 112 // and view translation. |
| 113 std::unique_ptr<gfx::LinearAnimation> animator_; |
| 114 |
| 87 State state_ = UNKNOWN; | 115 State state_ = UNKNOWN; |
| 88 | 116 |
| 89 DISALLOW_COPY_AND_ASSIGN(TouchCalibratorView); | 117 DISALLOW_COPY_AND_ASSIGN(TouchCalibratorView); |
| 90 }; | 118 }; |
| 91 | 119 |
| 92 } // namespace chromeos | 120 } // namespace chromeos |
| 93 | 121 |
| 94 #endif // CHROME_BROWSER_CHROMEOS_DISPLAY_TOUCH_CALIBRATOR_TOUCH_CALIBRATOR_VIE
W_H_ | 122 #endif // CHROME_BROWSER_CHROMEOS_DISPLAY_TOUCH_CALIBRATOR_TOUCH_CALIBRATOR_VIE
W_H_ |
| OLD | NEW |