Index: chrome/browser/resources/options/browser_options.js |
diff --git a/chrome/browser/resources/options/browser_options.js b/chrome/browser/resources/options/browser_options.js |
index 96283c3d8b4cd069c9555a1113b6eace1f524bb4..b4dbd5ccdba51c4d51c3cabf80179cdb1665c63c 100644 |
--- a/chrome/browser/resources/options/browser_options.js |
+++ b/chrome/browser/resources/options/browser_options.js |
@@ -339,12 +339,10 @@ cr.define('options', function() { |
// Device section (ChromeOS only). |
if (cr.isChromeOS) { |
- if (loadTimeData.getBoolean('showStylusSettings')) { |
- $('stylus-settings-link').onclick = function(event) { |
- PageManager.showPageByName('stylus-overlay'); |
- }; |
- $('stylus-row').hidden = false; |
- } |
+ // Probe for stylus hardware state. C++ will invoke |
+ // BrowserOptions.setStylusInputStatus_ when the data is available. |
+ chrome.send('requestStylusHardwareState'); |
+ |
if (loadTimeData.getBoolean('showPowerStatus')) { |
$('power-settings-link').onclick = function(evt) { |
PageManager.showPageByName('power-overlay'); |
@@ -1814,6 +1812,21 @@ cr.define('options', function() { |
}, |
/** |
+ * Called when stylus hardware detection probing is complete. |
+ * @param {boolean} hasStylus |
+ * @private |
+ */ |
+ setStylusInputStatus_: function(hasStylus) { |
+ if (!hasStylus) |
+ return; |
+ |
+ $('stylus-settings-link').onclick = function(event) { |
+ PageManager.showPageByName('stylus-overlay'); |
+ }; |
+ $('stylus-row').hidden = false; |
+ }, |
+ |
+ /** |
* This is called from chromium code when system timezone "managed" state |
* is changed. Enables or disables dependent settings. |
* @param {boolean} managed Is true when system Timezone is managed by |
@@ -2412,6 +2425,7 @@ cr.define('options', function() { |
'setNowSectionVisible', |
'setProfilesInfo', |
'setSpokenFeedbackCheckboxState', |
+ 'setStylusInputStatus', |
'setSystemTimezoneAutomaticDetectionManaged', |
'setSystemTimezoneManaged', |
'setThemesResetButtonEnabled', |