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

Side by Side Diff: chrome/browser/chromeos/display/touch_calibrator/touch_calibrator_controller.h

Issue 2638903003: Updates touch calibration API and plumbs through the native touch calibration method (Closed)
Patch Set: Resolving comments Created 3 years, 11 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/display/touch_calibrator/touch_calibrator_controller.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_CONTRO LLER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_DISPLAY_TOUCH_CALIBRATOR_TOUCH_CALIBRATOR_CONTRO LLER_H_
6 #define CHROME_BROWSER_CHROMEOS_DISPLAY_TOUCH_CALIBRATOR_TOUCH_CALIBRATOR_CONTRO LLER_H_ 6 #define CHROME_BROWSER_CHROMEOS_DISPLAY_TOUCH_CALIBRATOR_TOUCH_CALIBRATOR_CONTRO LLER_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "ash/display/window_tree_host_manager.h" 10 #include "ash/display/window_tree_host_manager.h"
(...skipping 13 matching lines...) Expand all
24 24
25 // TouchCalibratorController is responsible for collecting the touch calibration 25 // TouchCalibratorController is responsible for collecting the touch calibration
26 // associated data from the user. It instantiates TouchCalibratorView classes to 26 // associated data from the user. It instantiates TouchCalibratorView classes to
27 // present an interface the user can interact with for calibration. 27 // present an interface the user can interact with for calibration.
28 // Touch calibration is restricted to calibrate only one display at a time. 28 // Touch calibration is restricted to calibrate only one display at a time.
29 class TouchCalibratorController : public ui::EventHandler, 29 class TouchCalibratorController : public ui::EventHandler,
30 public ash::WindowTreeHostManager::Observer { 30 public ash::WindowTreeHostManager::Observer {
31 public: 31 public:
32 using CalibrationPointPairQuad = 32 using CalibrationPointPairQuad =
33 display::TouchCalibrationData::CalibrationPointPairQuad; 33 display::TouchCalibrationData::CalibrationPointPairQuad;
34 using TouchCalibrationCallback = base::Callback<void(bool)>;
34 35
35 static const base::TimeDelta kTouchIntervalThreshold; 36 static const base::TimeDelta kTouchIntervalThreshold;
36 37
37 TouchCalibratorController(); 38 TouchCalibratorController();
38 ~TouchCalibratorController() override; 39 ~TouchCalibratorController() override;
39 40
40 // ui::EventHandler 41 // ui::EventHandler
41 void OnKeyEvent(ui::KeyEvent* event) override; 42 void OnKeyEvent(ui::KeyEvent* event) override;
42 void OnTouchEvent(ui::TouchEvent* event) override; 43 void OnTouchEvent(ui::TouchEvent* event) override;
43 44
44 // WindowTreeHostManager::Observer 45 // WindowTreeHostManager::Observer
45 void OnDisplayConfigurationChanged() override; 46 void OnDisplayConfigurationChanged() override;
46 47
47 // Starts the calibration process for the given |target_display|. 48 // Starts the calibration process for the given |target_display|.
48 void StartCalibration(const display::Display& target_display); 49 void StartCalibration(const display::Display& target_display);
49 50
51 // Adds a callback that will be called once the calibration has been
52 // completed. This should be called before |StartCalibration()|.
53 void AddCallback(const TouchCalibrationCallback& callback);
Reilly Grant (use Gerrit) 2017/01/19 02:41:46 Why not pass this callback to StartCalibration()?
malaykeshav 2017/01/19 06:10:38 I was thinking of making the callback optional in
54
50 // Stops any ongoing calibration process. 55 // Stops any ongoing calibration process.
51 void StopCalibration(); 56 void StopCalibration();
52 57
53 bool is_calibrating() { return is_calibrating_; } 58 bool is_calibrating() { return is_calibrating_; }
54 59
55 private: 60 private:
56 friend class TouchCalibratorControllerTest; 61 friend class TouchCalibratorControllerTest;
57 FRIEND_TEST_ALL_PREFIXES(TouchCalibratorControllerTest, StartCalibration); 62 FRIEND_TEST_ALL_PREFIXES(TouchCalibratorControllerTest, StartCalibration);
58 FRIEND_TEST_ALL_PREFIXES(TouchCalibratorControllerTest, KeyEventIntercept); 63 FRIEND_TEST_ALL_PREFIXES(TouchCalibratorControllerTest, KeyEventIntercept);
59 FRIEND_TEST_ALL_PREFIXES(TouchCalibratorControllerTest, TouchThreshold); 64 FRIEND_TEST_ALL_PREFIXES(TouchCalibratorControllerTest, TouchThreshold);
(...skipping 11 matching lines...) Expand all
71 // was received. 76 // was received.
72 base::Time last_touch_timestamp_; 77 base::Time last_touch_timestamp_;
73 78
74 // Is true if a touch calibration is already underprocess. 79 // Is true if a touch calibration is already underprocess.
75 bool is_calibrating_ = false; 80 bool is_calibrating_ = false;
76 81
77 // An array of Calibration point pairs. This stores all the 4 display and 82 // An array of Calibration point pairs. This stores all the 4 display and
78 // touch input point pairs that will be used for calibration. 83 // touch input point pairs that will be used for calibration.
79 CalibrationPointPairQuad touch_point_quad_; 84 CalibrationPointPairQuad touch_point_quad_;
80 85
86 // A callback to be called when touch calibration completes.
87 TouchCalibrationCallback callback_;
88 bool has_callback_;
Reilly Grant (use Gerrit) 2017/01/19 02:41:46 This field is unnecessary. callback_.is_null() wil
malaykeshav 2017/01/19 06:10:38 Done
89
81 DISALLOW_COPY_AND_ASSIGN(TouchCalibratorController); 90 DISALLOW_COPY_AND_ASSIGN(TouchCalibratorController);
82 }; 91 };
83 92
84 } // namespace chromeos 93 } // namespace chromeos
85 #endif // CHROME_BROWSER_CHROMEOS_DISPLAY_TOUCH_CALIBRATOR_TOUCH_CALIBRATOR_CON TROLLER_H_ 94 #endif // CHROME_BROWSER_CHROMEOS_DISPLAY_TOUCH_CALIBRATOR_TOUCH_CALIBRATOR_CON TROLLER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/display/touch_calibrator/touch_calibrator_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698