Commit 205a9955 authored by malaykeshav's avatar malaykeshav Committed by Commit bot

Adds the touch calibration setting behind a chrome switch

 - Adds the touch calibration setting to settings > display
 - Adds a command line switch to enable the settings.
 - Updates system_display.idl to add a new parameter.

BUG=634166
COMPONENT=System Display API, ChromeOS Switch, md settings
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:closure_compilation

Review-Url: https://codereview.chromium.org/2620073002
Cr-Commit-Position: refs/heads/master@{#443052}
parent 82f137db
...@@ -2682,6 +2682,12 @@ ...@@ -2682,6 +2682,12 @@
<message name="IDS_SETTINGS_DISPLAY_MIRRORING_OFF" desc="Label indicating that the displays are currently not mirrored"> <message name="IDS_SETTINGS_DISPLAY_MIRRORING_OFF" desc="Label indicating that the displays are currently not mirrored">
Off Off
</message> </message>
<message name="IDS_SETTINGS_DISPLAY_TOUCH_CALIBRATION_TITLE" desc="In Device Settings > Displays, the label for initiating touch calibration.">
Calibrate
</message>
<message name="IDS_SETTINGS_DISPLAY_TOUCH_CALIBRATION_TEXT" desc="In Device Settings > Displays, the sublabel for initiating touch calibration.">
Define the boundaries of your touchscreen over the display
</message>
<!-- Storage --> <!-- Storage -->
<message name="IDS_SETTINGS_STORAGE_TITLE" desc="In Device Settings, the title for storage management."> <message name="IDS_SETTINGS_STORAGE_TITLE" desc="In Device Settings, the title for storage management.">
......
...@@ -129,7 +129,7 @@ ...@@ -129,7 +129,7 @@
<span class="md-select-underline"></span> <span class="md-select-underline"></span>
</div> </div>
</div> </div>
<div id="subpage-trigger" class="settings-box embedded two-line" <div class="settings-box embedded two-line"
on-tap="onOverscanTap_" hidden$="[[selectedDisplay.isInternal]]" on-tap="onOverscanTap_" hidden$="[[selectedDisplay.isInternal]]"
actionable> actionable>
<div class="start"> <div class="start">
...@@ -143,6 +143,16 @@ ...@@ -143,6 +143,16 @@
display-id="{{overscanDisplayId}}"> display-id="{{overscanDisplayId}}">
</settings-display-overscan-dialog> </settings-display-overscan-dialog>
<div class="settings-box embedded two-line"
on-tap="onTouchCalibrationTap_"
hidden$="[[!showTouchCalibrationSetting_(selectedDisplay)]]"
actionable>
<div class="start">
<div>$i18n{displayTouchCalibrationTitle}</div>
<div class="secondary">$i18n{displayTouchCalibrationText}</div>
</div>
<button class="subpage-arrow" is="paper-icon-button-light"></button>
</div>
</div> </div>
</template> </template>
<script src="display.js"></script> <script src="display.js"></script>
......
...@@ -165,6 +165,20 @@ Polymer({ ...@@ -165,6 +165,20 @@ Polymer({
this.currentSelectedModeIndex_ = this.selectedModeIndex_; this.currentSelectedModeIndex_ = this.selectedModeIndex_;
}, },
/**
* Returns true if the given display has touch support and is not an internal
* display. If the feature is not enabled via the switch, this will return
* false.
* @param {!chrome.system.display.DisplayUnitInfo} display Display being
* checked for touch support.
* @return {boolean}
* @private
*/
showTouchCalibrationSetting_: function(display) {
return !display.isInternal && display.hasTouchSupport &&
loadTimeData.getBoolean('enableTouchCalibrationSetting');
},
/** /**
* @param {!Array<!chrome.system.display.DisplayUnitInfo>} displays * @param {!Array<!chrome.system.display.DisplayUnitInfo>} displays
* @return {boolean} * @return {boolean}
...@@ -295,6 +309,16 @@ Polymer({ ...@@ -295,6 +309,16 @@ Polymer({
this.onSelectDisplay_({detail: e.detail.item.displayId}); this.onSelectDisplay_({detail: e.detail.item.displayId});
}, },
/**
* Handles event when a touch calibration option is selected.
* @param {!Event} e
* @private
*/
onTouchCalibrationTap_: function(e) {
settings.display.systemDisplayApi.touchCalibrationStart(
this.selectedDisplay.id);
},
/** /**
* Handles the event when an option from display select menu is selected. * Handles the event when an option from display select menu is selected.
* @param {!{target: !HTMLSelectElement}} e * @param {!{target: !HTMLSelectElement}} e
......
...@@ -608,10 +608,19 @@ void AddDeviceStrings(content::WebUIDataSource* html_source) { ...@@ -608,10 +608,19 @@ void AddDeviceStrings(content::WebUIDataSource* html_source) {
{"displayOverscanResize", IDS_SETTINGS_DISPLAY_OVERSCAN_RESIZE}, {"displayOverscanResize", IDS_SETTINGS_DISPLAY_OVERSCAN_RESIZE},
{"displayOverscanPosition", IDS_SETTINGS_DISPLAY_OVERSCAN_POSITION}, {"displayOverscanPosition", IDS_SETTINGS_DISPLAY_OVERSCAN_POSITION},
{"displayOverscanReset", IDS_SETTINGS_DISPLAY_OVERSCAN_RESET}, {"displayOverscanReset", IDS_SETTINGS_DISPLAY_OVERSCAN_RESET},
{"displayTouchCalibrationTitle",
IDS_SETTINGS_DISPLAY_TOUCH_CALIBRATION_TITLE},
{"displayTouchCalibrationText",
IDS_SETTINGS_DISPLAY_TOUCH_CALIBRATION_TEXT}
}; };
AddLocalizedStringsBulk(html_source, display_strings, AddLocalizedStringsBulk(html_source, display_strings,
arraysize(display_strings)); arraysize(display_strings));
html_source->AddBoolean(
"enableTouchCalibrationSetting",
base::CommandLine::ForCurrentProcess()->HasSwitch(
chromeos::switches::kEnableTouchCalibrationSetting));
LocalizedString storage_strings[] = { LocalizedString storage_strings[] = {
{"storageTitle", IDS_SETTINGS_STORAGE_TITLE}, {"storageTitle", IDS_SETTINGS_STORAGE_TITLE},
{"storageItemInUse", IDS_SETTINGS_STORAGE_ITEM_IN_USE}, {"storageItemInUse", IDS_SETTINGS_STORAGE_ITEM_IN_USE},
......
...@@ -259,6 +259,11 @@ const char kEnableRequestTabletSite[] = "enable-request-tablet-site"; ...@@ -259,6 +259,11 @@ const char kEnableRequestTabletSite[] = "enable-request-tablet-site";
const char kEnableScreenshotTestingWithMode[] = const char kEnableScreenshotTestingWithMode[] =
"enable-screenshot-testing-with-mode"; "enable-screenshot-testing-with-mode";
// Enables the touch calibration option in MD settings UI for valid touch
// displays.
const char kEnableTouchCalibrationSetting[] =
"enable-touch-calibration-setting";
// Enables touchpad three-finger-click as middle button. // Enables touchpad three-finger-click as middle button.
const char kEnableTouchpadThreeFingerClick[] = const char kEnableTouchpadThreeFingerClick[] =
"enable-touchpad-three-finger-click"; "enable-touchpad-three-finger-click";
......
...@@ -89,6 +89,7 @@ CHROMEOS_EXPORT extern const char kEnableNetworkPortalNotification[]; ...@@ -89,6 +89,7 @@ CHROMEOS_EXPORT extern const char kEnableNetworkPortalNotification[];
CHROMEOS_EXPORT extern const char kEnablePhysicalKeyboardAutocorrect[]; CHROMEOS_EXPORT extern const char kEnablePhysicalKeyboardAutocorrect[];
CHROMEOS_EXPORT extern const char kEnableRequestTabletSite[]; CHROMEOS_EXPORT extern const char kEnableRequestTabletSite[];
CHROMEOS_EXPORT extern const char kEnableScreenshotTestingWithMode[]; CHROMEOS_EXPORT extern const char kEnableScreenshotTestingWithMode[];
CHROMEOS_EXPORT extern const char kEnableTouchCalibrationSetting[];
CHROMEOS_EXPORT extern const char kEnableTouchpadThreeFingerClick[]; CHROMEOS_EXPORT extern const char kEnableTouchpadThreeFingerClick[];
CHROMEOS_EXPORT extern const char kEnableVideoPlayerChromecastSupport[]; CHROMEOS_EXPORT extern const char kEnableVideoPlayerChromecastSupport[];
CHROMEOS_EXPORT extern const char kEnterpriseDisableArc[]; CHROMEOS_EXPORT extern const char kEnterpriseDisableArc[];
......
...@@ -70,6 +70,8 @@ api::system_display::DisplayUnitInfo DisplayInfoProvider::CreateDisplayUnitInfo( ...@@ -70,6 +70,8 @@ api::system_display::DisplayUnitInfo DisplayInfoProvider::CreateDisplayUnitInfo(
unit.work_area.top = work_area.y(); unit.work_area.top = work_area.y();
unit.work_area.width = work_area.width(); unit.work_area.width = work_area.width();
unit.work_area.height = work_area.height(); unit.work_area.height = work_area.height();
unit.has_touch_support =
display.touch_support() == display::Display::TOUCH_SUPPORT_AVAILABLE;
return unit; return unit;
} }
......
...@@ -157,6 +157,9 @@ namespace system.display { ...@@ -157,6 +157,9 @@ namespace system.display {
// isSelected=true. Only available on Chrome OS. Will be set to an empty // isSelected=true. Only available on Chrome OS. Will be set to an empty
// array on other platforms. // array on other platforms.
DisplayMode[] modes; DisplayMode[] modes;
// True if this display has a touch input device associated with it.
boolean hasTouchSupport;
}; };
dictionary DisplayProperties { dictionary DisplayProperties {
......
...@@ -123,7 +123,8 @@ chrome.system.display.DisplayLayout; ...@@ -123,7 +123,8 @@ chrome.system.display.DisplayLayout;
* bounds: !chrome.system.display.Bounds, * bounds: !chrome.system.display.Bounds,
* overscan: !chrome.system.display.Insets, * overscan: !chrome.system.display.Insets,
* workArea: !chrome.system.display.Bounds, * workArea: !chrome.system.display.Bounds,
* modes: !Array<!chrome.system.display.DisplayMode> * modes: !Array<!chrome.system.display.DisplayMode>,
* hasTouchSupport: boolean
* }} * }}
* @see https://developer.chrome.com/extensions/system.display#type-DisplayUnitInfo * @see https://developer.chrome.com/extensions/system.display#type-DisplayUnitInfo
*/ */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment