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

Side by Side Diff: extensions/browser/api/system_display/display_info_provider.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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 EXTENSIONS_BROWSER_API_SYSTEM_DISPLAY_DISPLAY_INFO_PROVIDER_H_ 5 #ifndef EXTENSIONS_BROWSER_API_SYSTEM_DISPLAY_DISPLAY_INFO_PROVIDER_H_
6 #define EXTENSIONS_BROWSER_API_SYSTEM_DISPLAY_DISPLAY_INFO_PROVIDER_H_ 6 #define EXTENSIONS_BROWSER_API_SYSTEM_DISPLAY_DISPLAY_INFO_PROVIDER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
11 #include <vector> 11 #include <vector>
12 12
13 #include "base/callback_forward.h"
13 #include "base/macros.h" 14 #include "base/macros.h"
14 15
15 namespace display { 16 namespace display {
16 class Display; 17 class Display;
17 } 18 }
18 19
19 namespace extensions { 20 namespace extensions {
20 21
21 namespace api { 22 namespace api {
22 namespace system_display { 23 namespace system_display {
23 struct Bounds; 24 struct Bounds;
24 struct DisplayLayout; 25 struct DisplayLayout;
25 struct DisplayProperties; 26 struct DisplayProperties;
26 struct DisplayUnitInfo; 27 struct DisplayUnitInfo;
27 struct Insets; 28 struct Insets;
28 struct TouchCalibrationPairQuad; 29 struct TouchCalibrationPairQuad;
29 } 30 }
30 } 31 }
31 32
32 class DisplayInfoProvider { 33 class DisplayInfoProvider {
33 public: 34 public:
34 using DisplayUnitInfoList = std::vector<api::system_display::DisplayUnitInfo>; 35 using DisplayUnitInfoList = std::vector<api::system_display::DisplayUnitInfo>;
35 using DisplayLayoutList = std::vector<api::system_display::DisplayLayout>; 36 using DisplayLayoutList = std::vector<api::system_display::DisplayLayout>;
37 using TouchCalibrationCallback = base::Callback<void(bool)>;
36 38
37 virtual ~DisplayInfoProvider(); 39 virtual ~DisplayInfoProvider();
38 40
39 // Returns a pointer to DisplayInfoProvider or NULL if Create() 41 // Returns a pointer to DisplayInfoProvider or NULL if Create()
40 // or InitializeForTesting() or not called yet. 42 // or InitializeForTesting() or not called yet.
41 static DisplayInfoProvider* Get(); 43 static DisplayInfoProvider* Get();
42 44
43 // This is for tests that run in its own process (e.g. browser_tests). 45 // This is for tests that run in its own process (e.g. browser_tests).
44 // Using this in other tests (e.g. unit_tests) will result in DCHECK failure. 46 // Using this in other tests (e.g. unit_tests) will result in DCHECK failure.
45 static void InitializeForTesting(DisplayInfoProvider* display_info_provider); 47 static void InitializeForTesting(DisplayInfoProvider* display_info_provider);
(...skipping 22 matching lines...) Expand all
68 // return false if |id| is invalid. 70 // return false if |id| is invalid.
69 virtual bool OverscanCalibrationStart(const std::string& id); 71 virtual bool OverscanCalibrationStart(const std::string& id);
70 virtual bool OverscanCalibrationAdjust( 72 virtual bool OverscanCalibrationAdjust(
71 const std::string& id, 73 const std::string& id,
72 const api::system_display::Insets& delta); 74 const api::system_display::Insets& delta);
73 virtual bool OverscanCalibrationReset(const std::string& id); 75 virtual bool OverscanCalibrationReset(const std::string& id);
74 virtual bool OverscanCalibrationComplete(const std::string& id); 76 virtual bool OverscanCalibrationComplete(const std::string& id);
75 77
76 // Implements touch calibration methods. See system_display.idl. This returns 78 // Implements touch calibration methods. See system_display.idl. This returns
77 // false if |id| is invalid. 79 // false if |id| is invalid.
78 virtual bool TouchCalibrationStart(const std::string& id); 80 virtual bool ShowNativeTouchCalibration(
79 virtual bool TouchCalibrationSet(
80 const std::string& id, 81 const std::string& id,
82 std::string* error,
83 const TouchCalibrationCallback& callback);
84 virtual bool StartCustomTouchCalibration(const std::string& id,
85 std::string* error);
86 virtual bool CompleteCustomTouchCalibration(
81 const api::system_display::TouchCalibrationPairQuad& pairs, 87 const api::system_display::TouchCalibrationPairQuad& pairs,
82 const api::system_display::Bounds& bounds, 88 const api::system_display::Bounds& bounds,
83 std::string* error); 89 std::string* error);
84 virtual bool TouchCalibrationReset(const std::string& id, std::string* error); 90 virtual bool ResetTouchCalibration(const std::string& id, std::string* error);
85 virtual bool IsTouchCalibrationActive(std::string* error); 91 virtual bool IsNativeTouchCalibrationActive(std::string* error);
stevenjb 2017/01/19 17:19:01 All of these should be documented. In particular,
malaykeshav 2017/01/19 23:49:07 Adding comments where the error is being set.
stevenjb 2017/01/20 00:07:07 Public methods should *always* be documented, espe
86 92
87 protected: 93 protected:
88 DisplayInfoProvider(); 94 DisplayInfoProvider();
89 95
90 // Create a DisplayUnitInfo from a display::Display for implementations of 96 // Create a DisplayUnitInfo from a display::Display for implementations of
91 // GetAllDisplaysInfo() 97 // GetAllDisplaysInfo()
92 static api::system_display::DisplayUnitInfo CreateDisplayUnitInfo( 98 static api::system_display::DisplayUnitInfo CreateDisplayUnitInfo(
93 const display::Display& display, 99 const display::Display& display,
94 int64_t primary_display_id); 100 int64_t primary_display_id);
95 101
96 private: 102 private:
97 static DisplayInfoProvider* Create(); 103 static DisplayInfoProvider* Create();
98 104
99 // Update the content of the |unit| obtained for |display| using 105 // Update the content of the |unit| obtained for |display| using
100 // platform specific method. 106 // platform specific method.
101 virtual void UpdateDisplayUnitInfoForPlatform( 107 virtual void UpdateDisplayUnitInfoForPlatform(
102 const display::Display& display, 108 const display::Display& display,
103 api::system_display::DisplayUnitInfo* unit) = 0; 109 api::system_display::DisplayUnitInfo* unit) = 0;
104 110
105 DISALLOW_COPY_AND_ASSIGN(DisplayInfoProvider); 111 DISALLOW_COPY_AND_ASSIGN(DisplayInfoProvider);
106 }; 112 };
107 113
108 } // namespace extensions 114 } // namespace extensions
109 115
110 #endif // EXTENSIONS_BROWSER_API_SYSTEM_DISPLAY_DISPLAY_INFO_PROVIDER_H_ 116 #endif // EXTENSIONS_BROWSER_API_SYSTEM_DISPLAY_DISPLAY_INFO_PROVIDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698